Anyway, enough complaining, I get this is new technology! I've got it working with the Vodafone UK NB-IoT service now and this is how.
You'll need to be able to send AT commands to the uBlox chip and see the returned results, here's some code that'll allow you to do this interactively using the serial connection to the Arduino:
#include <Arduino.h>#include <MKRNB.h>NBModem modem;// baud rate used for both Serial portsunsigned long baud = 115200;void setup() {// reset the ublox modulepinMode(SARA_RESETN, OUTPUT);digitalWrite(SARA_RESETN, HIGH);delay(100);digitalWrite(SARA_RESETN, LOW);Serial.begin(baud);while (!Serial) {;}Serial.println("CPU connected to PC");if (modem.begin()) {Serial.println("Modem connected to CPU");} else {Serial.println("ERROR, no modem answer.");}SerialSARA.begin(baud);}void loop() {if (Serial.available()) {SerialSARA.write(Serial.read());}if (SerialSARA.available()) {Serial.write(SerialSARA.read());}}
I'm using Atom IDE with Platform IO plugin, if you're using the Arduino IDE then remove the first include line from the code. You'll need to have installed the MKRNB library from the Platform IO libraries window.
You'll also need something to send messages to from the MKR1500 board, I used a simple Python script that listens for UDP connections and prints out any text received. I'll let you figure that out on your own, as an even mode basic test you could just run tcpdump or Wireshark on the receiving computer, it needs to be publicly accessible though as the UDP packet will come form Vodafone's M2M network.
Before we start, a few notes on the Vodafone UK trial NB-IoT service:
- it's a trial service, it's not yet meant for use in anger, I suppose it could go offline at any time for any reason with no guarantees of when it'll come back
- SIMs are not publicly available yet, I got a trial as it's related to my job but I cannot help you get SIMs so please don't ask. I am hoping that we'll be able to offer SIMs from my work once Vodafone move from trial to general release of their service
- It's in the T&Cs that you only use UDP, I think this is to keep network traffic to a minimum for the trial
- coverage is limited and there's no published map. They say the west side of the UK is mostly covered, I'm near Manchester and it works. 10 miles away on the other side of the Pennines where my office is, it doesn't work yet.
Once you can send AT commands to the uBlox chip, here's a list if commands in the order I used them to get the connection working and send a "hello world" message over UDP. Since I figured this out by reading the uBlox documentation and using trial & error, some steps may not be necessary. Once I've got this written down I plan on factory resetting the uBlox chip and re-doing it, if anything changes I'll edit this post.
Oh, also, here is a link to the uBlox documentation listing all the AT command set:
AT commands (run in this order):
Command | Expected Response | Description |
---|---|---|
AT | OK | no operation, tests execution of AT commands |
AT+URAT=8 | OK | Set radio access technology. 8 means NB-IoT only |
AT+CGDCONT=1,"IP","ep.inetd.gdsp" | OK | Set connection type and APN |
AT+CGACT=1,1 | OK | Activate the connection config (not sure this is needed) |
AT+UBANDMASK=1,524288 | OK | Change band. This sets the band for NB-IoT to 20 which Voda UK uses. |
AT+CREG=2 | OK | Enable network registration |
AT+CFUN=15 | OK | Resets/reboots the modem, takes a couple of seconds |
AT+CGATT? | +CGATT: 1 | Queries the attachment status, 1 means attached! Wait and retry if it's 0 |
AT+CSQ | +csq: 15,99 | Query signal quality, 1st number returned, if it's 99 then no signal at all |
AT+USOCR=17 | +USOCR: 0 | Create a socket, 17 is UDP. The returned number is the socket ID used later on |
AT+USOCO=0,"0.0.0.0",0000 | OK | Connect over socket, 0.0.0.0 is the IP to connect to, 0000 is the port. The first number (0) is the socket ID from above. |
AT+USOWR=0,12,"Hello world!" | +USOWR: 0,12 | Send some data! First number is the socket ID, 2nd number is the data length |
AT+COPS? | +cops: 0,0,"Vodafone@ DATA ONLY",9 | Query network connected info |
AT+CGDCONT? | +CGDCONT: 1,"IP","ep.inetd.gdsp","123.123.123.123",0,0,0,0 | Query APN & IP info. 123.123.123.123 is the IP assigned by the network. |
AT+USOCL=0 | OK | Close the socket once finished. |
AT+CGATT=0 | OK | Detach from the network. |
That should have got you connected and some data sent over UDP. As far as I'm aware, the data such as APN, bands etc... should be stored in the uBlox chip so after this, I think using the Arduino MKRNB library should work OK. That's what I'll try next.
I also think that after this you can just do "AT+CGATT=1" to re-attached to the network.
I also think that after this you can just do "AT+CGATT=1" to re-attached to the network.