Passthrough¶
General¶
With the passthrough sketch you can send AT commands to the ublox module on the SODAQ SARA.
This example doesn’t require any additional libraries.
Uncomment #define R4XX
if you use an R4XX module.
Uncomment #define N3XX
if you use an N3XX module.
Note
Connect a battery if you use an R412M.
Sketch¶
#include <Arduino.h>
//#define R4XX // Uncomment when you use the ublox R4XX module
//#define N3XX // Uncomment when you use the ublox N3XX module
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial1
#if defined(R4XX)
unsigned long baud = 115200; //start at 115200 allow the USB port to change the Baudrate
#elif defined(N3XX)
unsigned long baud = 57600; //start at 57600 allow the USB port to change the Baudrate
#else
unsigned long baud = 9600; //start at 9600 allow the USB port to change the Baudrate
#endif
void setup()
{
// Turn the power to the SARA module on.
// we have a powerswitch on board to switch the power to the SARA on/of when needed
// in most applications we keep the power on all the time
pinMode(SARA_ENABLE, OUTPUT);
digitalWrite(SARA_ENABLE, HIGH);
#if defined(R4XX) || defined(N3XX)
// Turn the nb-iot module on
// The R4XX module has an on/off pin. You can toggle this pin or keep it low to
// switch on the module
pinMode(SARA_R4XX_TOGGLE, OUTPUT);
digitalWrite(SARA_R4XX_TOGGLE, LOW);
delay(2000);
pinMode(SARA_R4XX_TOGGLE, INPUT);
#endif
// Start communication
DEBUG_STREAM.begin(baud);
MODEM_STREAM.begin(baud);
}
// Forward every message to the other serial
void loop()
{
while (DEBUG_STREAM.available())
{
MODEM_STREAM.write(DEBUG_STREAM.read());
}
while (MODEM_STREAM.available())
{
DEBUG_STREAM.write(MODEM_STREAM.read());
}
// check if the USB virtual serial wants a new baud rate
// This will be used by the UEUpdater to flash new software
if (DEBUG_STREAM.baud() != baud) {
baud = DEBUG_STREAM.baud();
MODEM_STREAM.begin(baud);
}
}
Note
Make sure in the Serial Monitor New Line and Carriage Return (NL & CR)
are enabled.
The baudrate for the N211 = 9600.
The baudrate for the N310 = 57600.
The baudrate for the R41X = 115200.
The first command send to the N310 module must be AT
uppercase.
AT Commands¶
R4¶
General R4 Commands¶
Remove SIM pin
Two commands, first unlock your SIM. Then remove the SIM pin. “0000” needs to be replaced by your SIM pin.
Unlock SIM.
Remove SIM pin.Disable PSM and eDRX
In the latest ublox firmware PSM and eDRX are enabled by default.
When these features are enabled the modem goes automatic in sleep, when the module is in sleep it won't respond on AT Commands.
With these commands you can turn PSM and eDRX off.
Disable Power Saving Mode
Disable eDRX
Disable Power saving control
KPN NL - LTE-M¶
After uploading the passthrough sketch use the following commands to send a message.
These commands communicate on the LTE-M Network of KPN NL.
Reset the module.
Turn off echo. Check selected MNO Profile. Set MNO profile. (1=automatic,100=standard europe) Set URAT to LTE-M. Enable URCs. Set verbose error values. Set the APN. Autoselect the operator. Or force select an operator, use 20408 to force KPN NL. Check Siganl strenght, repeat till you have a valid CSQ (99,99 means no signal). Wait for attach, 1 = attached. Open a socket. Send data over the socket.Vodafone NL - LTE-M¶
After uploading the passthrough sketch use the following commands to send a message.
These commands communicate on the LTE-M Network of Vodafone.
Reset the module.
Turn off echo. Check selected MNO Profile. Set MNO profile. (1=automatic,100=standard europe) Set URAT to LTE-M. Enable URCs. Set verbose error values. Set the APN. Autoselect the operator Or force select an operator, use 20404 to force Vodafone NL Check Siganl strenght, repeat till you have a valid CSQ (99,99 means no signal). Wait for attach, 1 = attached. Open a socket. Send data over the socket.Vodafone NL - NB-IoT¶
After uploading the passthrough sketch use the following commands to send a message.
These commands communicate on the NB-IoT Network of Vodafone NL.
For Vodafone we have multiple APNs, use the correct APN! nb.inetd.gdsp –> default external APN dev.sodaq.com –> early access APN
Reset the module.
Turn off echo. Check selected MNO Profile. Set MNO profile. (1=automatic,19=Vodafone,100=standard europe) Limit the bandmask to only band 20 Check current URAT. Set URAT to NB-IoT. Enable URCs. Set verbose error values. Set the APN. Check used APN. Turn on the radio. Autoselect the operator Or force select an operator, use 20404 to force Vodafone NL Check Siganl strenght, repeat till you have a valid CSQ (99,99 means no signal). Wait for attach, 1 = attached. Check if you have a valid IP address. Open a socket. Send data over the socket.AT+USOST=[socket number],[YOURUDPSERVERIP],[YOURUDPSERVERPORT],[payload length],[payload]
AT+USOST=0,"YOURUDPSERVERIP",8891,4,"Yes!"
T-Mobile NL - LTE-M¶
SIM | APN |
---|---|
TMNL | smartsites.t-mobile |
Managed M2M | m2m.public.nl |
After uploading the passthrough sketch use the following commands to send a message.
These commands communicate on the LTE-M Network of KPN NL.
Reset the module.
Turn off echo. Check selected MNO Profile. Set MNO profile. (1=automatic,100=standard europe) Set URAT to LTE-M. Enable URCs. Set verbose error values. Set the APN. Autoselect the operator. Or force select an operator, use 20416 to force T-Mobile NL. Check Siganl strenght, repeat till you have a valid CSQ (99,99 means no signal). Wait for attach, 1 = attached. Open a socket. Send data over the socket.T-Mobile NL - NB-IoT¶
After uploading the passthrough sketch use the following commands to send a message.
These commands communicate on the NB-IoT UDP Network of T-Mobile NL.
Note
Your device must be registered as a UDP device and not as CoAP.
Reset the module.
Turn off echo. Check selected MNO Profile. Set MNO profile. (1=automatic,100=standard europe) Check current URAT. Set URAT to NB-IoT. Enable URCs. Set verbose error values. Set the APN. Check current APN. Turn on radio. Autoselect the operator Or force select an operator, use 20416 to force T-Mobile NL Check Siganl strenght, repeat till you have a valid CSQ (99,99 means no signal). Wait for attach, 1 = attached. Open a socket. Send data over the socket. Close socket.Monogoto - LTE-M¶
After uploading the passthrough sketch use the following commands to send a message.
These commands communicate on the LTE-M Network of Vodafone.
Reset the module.
Turn off echo. Check selected MNO Profile. Set MNO profile. (1=automatic,100=standard europe) Set URAT to LTE-M. Enable URCs. Set verbose error values. Set the APN. Auto select operator If the auto operator selection doesn't work, you can force the operator. Check Siganl strenght, repeat till you have a valid CSQ (99,99 means no signal). Wait for attach, 1 = attached. Open a socket. Send data over the socket.N2¶
General N2 Commands¶
You can reboot to bring it into a ‘clean’ mode by:
NCONFIG settings are saved into the memory of the module.
You can check if these settings
You can check your IP address. This is from a private IP range.
Check the firmware version:
orCheck the IMEI Number:
Check the CCID, SIM card number:
Vodafone NL – UDP¶
Setup
Give URC's of when the Sara module has communication with the base station, useful for debugging.
Give URC's of the netwok registration status, useful for debugging and knowing whether you have received the power save timers. Give URC's whenever the module sleeps and awakens, useful for knowing whenever you want into low power. Enable power save mode, request RPTAU of 10 seconds and request RAT of 2 seconds. Note that the above values are requested, you will receive some set timers from the network after connection, look for the last two variables with CEREG URC.Set the Following NCONFIG settings. This only have to be done once. The settings are saved in memmory.
Turn the radio off. Set vodafone PDP settings. Turn the radio on. Set band to 20 (Vodafone uses 20). Toggle the radio off and on (this appears to force a refresh and works best in practice). Connect to Vodafone.Now make sure you actually have connection to the base station. Periodically check for base station signal strength and whether GPRS is attached.
Wait for connection
Check for signal strength, the first or second variable should not be 99.
Check for GPRS attachment, should return 1. For sending an UDP package you need to open a socket after having connection.Socket
Create a socket on port 16666 for sending and receiving datagrams (UDP).
Now that you’re connected, transmit a message.
Transmit
Send Hello world! , immediately stop transmitting after sending the command.
Make sure to enter your own ip and port!T-Mobile NL – UDP¶
Setup
Give URC's of when the Sara module has communication with the base station, useful for debugging.
Give URC's of the netwok registration status, useful for debugging and knowing whether you have received the power save timers. Give URC's whenever the module sleeps and awakens, useful for knowing whenever you want into low power.Enable power save mode, request RPTAU of 10 seconds and request RAT of 2 seconds.
Note that the above values are requested, you will receive some set timers from the network after connection, look for the last two variables with CEREG URC.Set the Following NCONFIG settings. This only have to be done once. The settings are saved in memmory.
Turn the radio off. Set T-mobile PDP settings. Turn the radio on. Set band to 8 (T-Mobile uses 8). Toggle the radio off and on (this appears to force a refresh and works best in practice). Connect to T-Mobile. Now make sure you actually have connection to the base station. Periodically check for base station signal strength and whether GPRS is attachedWait for connection
Check for signal strength.
The first or second variable should not be 99. Repeat the command till you get a valid CSQ.Check for attachment, if attached the module should return 1.
For sending an UDP package you need to open a socket after having connection.
Socket
Create a socket on port 16666 for sending and receiving datagrams (UDP)
Now that you’re connected, transmit a message.Transmit
Send Hello world!
and immediately stop transmitting after sending the command.
T-Mobile NL – CoAP¶
N3¶
General N3 Commands¶
The first command has to be in uppercase:
You can reboot to bring it into a ‘clean’ mode by:
You can check your IP address. This is from a private IP range.
Check the firmware version:
Check the firmware revision:Check the IMEI Number:
Check the CCID, SIM card number:
If your APN requires an user/password you can set these with this command after you have set the APN.
Vodafone – UDP¶
Setup
Give URC's of when the Sara module has communication with the base station, useful for debugging.
Give URC's of the netwok registration status, useful for debugging and knowing whether you have received the power save timers. Give URC's whenever the module sleeps and awakens, useful for knowing whenever you want into low power. Enable power save mode, request RPTAU of 10 seconds and request RAT of 2 seconds. Note that the above values are requested, you will receive some set timers from the network after connection, look for the last two variables with CEREG URC.Check PDP settings.
Set Vodafone PDP settings. Turn the radio on. Set band to 900 and 800 these are the main bands in Europe. Use the autoconnect function. If the autoconnect does not work, you can try the force operator method. Force connect to Vodafone Netherlands.Now make sure you actually have connection to the base station. Periodically check for base station signal strength and whether GPRS is attached.
Wait for connection
Check for signal strength, the first or second variable should not be 99.
Check for attachment, if attached you should have an IP address.
For sending an UDP package you need to open a socket after having connection.
Socket
Create a socket on port 16666 for sending and receiving datagrams (UDP).
Set the device in HEX mode Now that you’re connected, transmit a message.Transmit
Send Hello world! , immediately stop transmitting after sending the command.
Make sure to enter your own ip and port!T-Mobile – UDP¶
Setup
Give URC's of when the Sara module has communication with the base station, useful for debugging.
Give URC's of the netwok registration status, useful for debugging and knowing whether you have received the power save timers. Give URC's whenever the module sleeps and awakens, useful for knowing whenever you want into low power.Enable power save mode, request RPTAU of 10 seconds and request RAT of 2 seconds.
Note that the above values are requested, you will receive some set timers from the network after connection, look for the last two variables with CEREG URC.Check PDP settings.
Set T-mobile PDP settings, IoT Creators APN Set T-mobile PDP settings, Easy Connect APN Turn the radio on. Set band to 900 and 800 these are the main bands in Europe. Use the autoconnect function. If the autoconnect does not work, you can try the force operator method. Force connect to T-Mobile Netherlands. Now make sure you actually have connection to the base station. Periodically check for base station signal strength and whether GPRS is attachedWait for connection
Check for signal strength.
The first or second variable should not be 99. Repeat the command till you get a valid CSQ.Check for attachment, if attached you should have an IP address.
For sending an UDP package you need to open a socket after having connection.
Socket
Create a socket on port 16666 for sending and receiving datagrams (UDP)
Set the device in HEX mode Now that you’re connected, transmit a message.Transmit
Send Hello world!
and immediately stop transmitting after sending the command.