I have seen serveral posts here asking for NB-IoT support for Boron LTE in Europe, but could not find any success reports or working code. I was able to successfully establish a connection to the Particle cloud over NB-IoT and would like to share the code here.
Please note that NB-IoT is not officially supported by Particle. This means that there is no guarantee for reliability and compatibility with future DeviceOS versions.
Particle supports LTE Cat M1 which is the leading LTE low power variant in North America. In Germany (and other european countries) the carriers have decided to roll out NB-IoT instead, so we have to go this way here.
My code shows that supporting NB-IoT seems to require (relativly) simple software only changes. I would like to see Particle adding official support for this.
#include "dct.h"
SYSTEM_THREAD(ENABLED);
SYSTEM_MODE(SEMI_AUTOMATIC);
void setup() {
Cellular.setActiveSim(EXTERNAL_SIM);
Cellular.setCredentials("iot.telekom.net");
Particle.keepAlive(30);
// Optional: This clears the setup done flag on brand new devices so it won't stay in listening mode
const uint8_t val = 0x01;
dct_write_app_data(&val, DCT_SETUP_DONE_OFFSET, 1);
Cellular.on();
Cellular.command("AT+URAT=8\r\n");
Cellular.command("AT+COPS=1,2,\"26201\"\r\n");
Particle.connect();
}
void loop() { }
The code is quite simple. Only two AT commands are needed to reconfigure the modem:
-
AT+URAT=8
switches the modem from Cat M1 (7) to NB-IoT (8) [1, p.45] -
AT+COPS=1,2,"26201"
selects the operator. [1, p.42]. Without this command it did not work for me.
Notes
- The time from power on to cloud connected is about 30-40s
- All cloud stuff including firmware update seems to work as usual, tested multiple hours. Even the vitals look good:
- I am using a NB-IoT third party sim from Deutsche Telekom
- APN and MCC+MNC must be adapted for other carriers
- Necessary keep alive interval has not been tested yet
- DeviceOS version is 1.4.0
- The usual setup via Particle app does not work here because of the third party sim and custom code. I installed system, bootloader and softdevice via CLI. I verified the versions with
particle serial inspect
@Particle:
Changing the modem settings via AT commands is no big deal, but I am not entirely happy with that because I don’t know if there are potential situations where the DeviceOS undoes some of these changes. Perhaps when the modem is restarted in case of a failure?
To build reliable software, we would need to know all of this cases, check for them and resend the AT commands, which is not nice.
I would love to see official commands for switching to NB-IoT and setting the operator which take care of all internal corner cases. @rickkas7: Perhaps this is something you can initiate?
I did this research because of customers asking me explicitly for NB-IoT. I’m sure there are more Particle users interested in NB-IoT.
Marking some people who might be interested in this because of asking about NB-IoT in other threads:
@4np @chrisg112 @manumonti @abrilevskiy @conoro @hbierau @Alph @T1mS
[1] https://www.u-blox.com/sites/default/files/SARA-R4-SARA-N4_ATCommands_(UBX-17003787).pdf