Forcing my 3g electron to 2G GPRS

I have been having a long connection time when getting back from sleep in a place where 3g coverage is not so good,
is there a way to force my electron to work on 2g network

1 Like

This should do it. You need to issue the AT+URAT=0 command while the modem is disconnected and the next connection will be 2G.

#include "Particle.h"

// In order to change the RAT to 2G you must be disconnected from the cellular network, so you need to use
// SEMI_AUTOMATIC or MANUAL mode
SYSTEM_MODE(SEMI_AUTOMATIC);

void setup() {
	Serial.begin(9600);

	Cellular.on();

	// If you have SYSTEM_THREAD(ENABLED), comment out this delay:
	// delay(2000);

	// 0 = force 2G
	// 1 = normal operation (3G or 2G)
	int resp = Cellular.command("AT+URAT=0\r\n");
	Serial.printlnf("response=%d", resp);

	Particle.connect();
}

void loop() {

}

2 Likes

thanks, is it reversible or will it be stuck in 2g forever?

I’m pretty sure it reverts back when you completely power off the modem. However there’s a small chance I misunderstood the documentation, and if that’s the case just change it to AT+URAT=1 which is the normal factory default.

To revert I found this:
So sound the AT need to be

int resp = Cellular.command("AT+URAT=1,0\r\n");

?
• GSM and UMTS (set the module in the automatic 2G/3G RAT with AT+URAT=1,2 or AT+URAT=1,0): the user
sets both the ARFCN and the UARFCN, PSC pair to make the module enter dual mode. The module searches
for any of the two locking cells and camps on the first cell found. Reselections in idle mode are allowed to
the other locking cell only. In connected mode:
o In normal lock mode, the UE can leave the locked cells due to the handovers and the radio reconfiguration
by the network. The Ue cannot leave its RATs
o In extended lock mode, the handovers are inhibited. The reconfiguration via redirection IEs is still allowed
o In extended redirection lock mode, any reconfiguration via redirection IEs is rejected or ignored


Has anyone tested this to see if it works? I get the response of -2.

Does it work? I get response=-2

@rickkas7, you have mentioned

// If you have SYSTEM_THREAD(ENABLED), comment out this delay:
// delay(2000);

I am a bit confused. If I have SYSTEM_THREAD(ENABLED), should I include 'delay(2000)' or not (I am confused as in the code, the 'delay(2000)' is already commented)?

Include the delay if system thread is enabled.

If system thread is not enabled, the delay is not necessary.