Passthrough¶
The SODAQ NB-IoT shield is using the uBlox Sara N2 series NB-IoT module, which is based on the Neul chipset. The AT Commands are depending on the firmware version of the NB-IoT module on your board.
The Neul chipset is controlled by AT Commands. These are ASCII commands that are sent to the module over the serial interface at 9600bps. If the command is executed correctly, the module replies with OK.
You can write an embedded application that communicates with the module, or you can send the commands directly from your computer over the USB interface. To do so you must load the following Arduino sketch on your board:
Arduino code¶
#include "Arduino.h"
#if defined(ARDUINO_AVR_LEONARDO)
#define USB Serial
#define UBLOX Serial1
#elif defined(ARDUINO_SODAQ_EXPLORER)
#define USB SerialUSB
#define UBLOX Serial
#elif defined(ARDUINO_SAM_ZERO)
#define USB SerialUSB
#define UBLOX Serial1
#else
#error "Please select a Sodaq ExpLoRer, Arduino Leonardo or add your board."
#endif
// Pin to turn on/off the nb-iot module
#define powerPin 7
unsigned long baud = 9600; //start at 9600 allow the USB port to change the Baudrate
void setup()
{
// Turn the nb-iot module on
pinMode(powerPin, OUTPUT);
digitalWrite(powerPin, HIGH);
// Start communication
USB.begin(baud);
UBLOX.begin(baud);
}
// Forward every message to the other serial
void loop()
{
while (USB.available())
{
uint8_t c = USB.read();
UBLOX.write(c);
}
while (UBLOX.available())
{
USB.write(UBLOX.read());
}
// check if the USB virtual serial wants a new baud rate
if (USB.baud() != baud) {
baud = USB.baud();
UBLOX.begin(baud);
}
}
T-Mobile CoAP¶
You can reboot to bring it into a ‘clean’ mode by:
NCONFIG settings are saved into the memory of the module. You only need to do this once.
You can check if these settings are correctly set by reading the NCONFIG settings:
Switch the radio off by:
Then select the CDP (in this case Nokia Impact on the T-Mobile platform).
Then set the APN for authentication. For the T-Mobile Netherlands platform this is:
Then switch on the radio. The previous commands are ‘sticky’ (stored in NVRAM) so only need to be entered once. Next time you can just start with this command:
Then select the right band (in case of T-Mobile BAND 8, for Vodafone use Band 20)
Forces an attempt to select and register with the network operator (20416 is T-Mobile NL, while for Vodafone it is 20404)
You can now check the signal quality. Keep repeating this until you get something else than 99,99.
You can now check if you are attached to the network. If you get a value of 1 you are!
You can check your IP address. This is from a private IP range.
For T-Mobile you can ping the CDP if you like, while Vodafone allows you to ping 8.8.8.8:
You are now ready to send the first message. On the T-Mobile network we use the messaging protocol. You can first switch on the Send Message Indicator (optionally)
And send a message: (in this case 11 bytes, encode in HEX)
Check you send message queue:
Here are a few more commands. Check the manufacturer of the module:
Check the firmware version:
Check the IMEI Number:
Display network statistics:
T-Mobile UDP¶
Setup
AT+CSCON=1
//Give URC's of when the sara module has communication with the base station, useful for debugging
AT+CEREG=5
//Give URC's of the netwok registration status, useful for debugging and knowing whether you have received the power save timers
AT+NPSMR=1
//Give URC's whenever the module sleeps and awakens, useful for knowing whenever you want into low power
AT+CPSMS=1,,,"00000001","00000001"
//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.
AT+NCONFIG="CR_0354_0338_SCRAMBLING","TRUE" //Enable Scrambling
AT+NCONFIG="CR_0859_SI_AVOID","FALSE" //Specific setting for Vodafone
AT+CFUN=0 //Disable antenna
AT+CGDCONT=0,"IP","cdp.iot.t-mobile.nl" //Set vodafone PDP settings
AT+CFUN=1 //Enable antenna
AT+NBAND=8 //Set band to 8 (T-Mobile uses 8)
AT+CFUN=0 //Turn antenna off
AT+CFUN=1 //Turn antenna on (this appears to force a refresh and works best in practice)
AT+COPS=1,2,"20416" //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 attached.
Wait for connection
AT+CSQ //Check for signal strength, the first or second variable should not be 99
AT+CGATT? //Check for GPRS attachment, should return 1
For sending an UDP package you need to open a socket after having connection.
Socket
AT+NSOCR="DGRAM",17,16666,0 //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. With T-Mobile NL you send your data to the T-Mobile CDP.
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 network 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 powerEnable 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 these NCONFIG Settings
Turn radio off.
Set vodafone PDP settings.
Turn radio on.
Set band,Vodafone uses 20.
Turn radio off and on. (this appears to force a refresh and works best in practice)
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, 0 = not attached, 1 = attached.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!