Hands-On LTE-M NB-IoT Workshop on the Vodafone and NB-IoT and LTE-M network SODAQ Author: Jan van Loenen
Unboxing 3 Installation 4 Arduino IDE 4 SODAQ Download URL 5 Add Boards 6 Libraries 8 All Things Talk 9 AT Commands 10 Library 13 All Things Talk 14 Send ASCII to ATT 14 Sending the temperature to ATT 17 GPS 19
Unboxing - SODAQ SARA AFF - Universal telecom antenna - Usb cable - Vodafone NB-IoT SIM - Vodafone LTE-M SIM
Installation Arduino IDE This manual is written to use the Arduino IDE, feel free to use your own Arduino compatible IDE. I prefer to use Visual Studio with Visual Micro. Download the latest Arduino IDE from https://www.arduino.cc/en/main/software The Arduino IDE version is 1.8.8 while writing this document.
SODAQ Download URL Add the Sodaq download URLs Go to File Preferences Add the following url in the Additional Boards Manager URLs http://downloads.sodaq.net/package_sodaq_samd_index.json This URL is to download SODAQ Arduino compatible SAMD Boards and libraries.
Add Boards We need to install the SODAQ SARA board before we can use it. Go to the Boards Manager. Tools Board Boards Manager Install the SODAQ SAMD boards
Select the correct Board and Port. The Board must be SODAQ SARA As for the port this name will be the first SAMD board in the list. This can be the SODAQ SARA or an other board, in the image the SAMD boards of Arduino are also installed and Arduino thinks we have an Arduino Zero attached.
Libraries Go to Sketch Include Library Manage Libraries Install the following libraries: Sodaq_wdt Sodaq_nbiot Sodaq_LSM303AGR Sodaq_UBlox_GPS
All Things Talk Create an account on https://maker.allthingstalk.com/ The device comes pre-loaded with the AllThingsTalk maker software. This software will upload the temperature and gps, when enabled, to AllThingsTalk. With the code on the sticker you can claim your device on AllThingsTalk. Click on the button New Device Type in your activation code, press the find button and confirm to claim your device. Your devices already had the unique ATT Token inside, on the sticker it s called deviceid. You only need this when in a later stage you override this software and want to again use it. When your device is turned on, you should see data in your account.
AT Commands The current loaded software has a command mode. To enter the command mode, you have to close the serial monitor (if open). Connect the usb, board to computer. Press the reset button. Check in Arduino if the com port is available. Open the Serial Monitor. Don t forget to change to Both NL & CR.
Send the command cmd to enter command mode If successful entered you should see this: In this mode you can send all the available u-blox commands. All commands can be found in this PDF, the most common commands are already in the command men. https://www.u-blox.com/sites/default/files/sara-r4-sara-n4_atcommands_%28ubx-170 03787%29_0.pdf
By default the operator is set to Vodafone NB-IoT. The printed commands are automatically set for Vodafone NB-IoT To send AT command for Vodafone LTE-M. The 2nd sim card is for Vodafone LTE-M. Send exit to go out of the command mode. Update the Telco in the operator to Vodafone Lte-M with sending the command tlc=2 Telco (tmobile=0, vf-n=1, vf-m=2, kpn=3, mono=4) (tlc=): 1 Go again into into command mode. The AT command list is now updated to the Vodafone LTE-M commands.
Library In the Arduino Library manager it is possible to install the sodaq libraries. Search and install the following libraries: Click on an item in the list to get the install button. sodaq_wdt sodaq_nbiot sodaq_ublox_gps sodaq_lsm303agr The LteM library is not released yet. We are still making it ready for the public. Today you will need to download it from iot.sodaq.com Unzip the file Move it to Documents Arduino libraries Reopen Arduino to load the new library
All Things Talk Send ASCII to ATT Create a new asset Use ascii as name Choose type: String Load the example from the Arduino IDE to send Hello World! to AllThingsTalk.
Add your keys to the sketch, you can find these under Settings in your ATT account. Upload the sketch See if you get the data on your All Things Talk account. Change the string something else and reupload the sketch.
Sending the temperature to ATT Create a new asset. Name it temp Choose Number Open the LteM_UDP_ATT_Temperature. Add your keys!! And upload your sketch
It will send the temperature value every 5 seconds. If you have enabled the data storage you will be able to see the average data over time.
GPS Create a new asset. Name it gps Go to the advanced tab. And update it to: { "type": "object", "properties": { "latitude": { "type": "number" }, "longitude": { "type": "number" }, "altitude": { "type": "number" }, "timestamp": { "type": "number" } } }
Open the GPS example. Add your keys!! And upload your sketch
In AllThingsTalk you will see some JSON block as your data. To be able to show it into a map we have to create a Pinboard
Now you have a nice map of where your device is. By default when there is no data if will show 0,0 Your map will update when you have a valid GPS position.
More information about LTE-M and NB-IoT can be found here: SODAQ Forum: http://forum.sodaq.com/ SODAQ Suport pages: http://support.sodaq.com/