This is a small tutorial on setting up NIDD (Non-IP Data Delivery) in the MTS cloud service with the self-explanatory name "M2M manager". The essence of NIDD is the energy-efficient exchange of small data packets over the NB-IoT network between devices and a server. If earlier GSM devices communicated with the server exchanging TCP / UDP packets, then an additional communication method - NIDD became available for NB-IoT devices. At the same time, the server interacts with the operator's network using unified POST / GET requests. I am writing for myself (so as not to forget) and everyone who will find it useful.
You can read about NB-IoT:
NB-IoT, Narrow Band Internet of Things. General information, features of
NB-IoT technology, Narrow Band Internet of Things. Power saving modes and control commands
NIDD theory from MTS
Documentation for the NB-IoT module that was used in the testing process:
Neoway N21 .
MTS service for managing M2M devices .
To feel the NIDD, we need:
- SIM card NB-IoT MTS
- NB-IoT device with NIDD support
- password and login from M2M-manager of MTS
As a device, I used the N21 DEMO board , and the MTS employees kindly provided me with the password and login for accessing the M2M manager. For this, as well as for the various assistance and numerous consultations, many thanks to them.
So, go to the M2M manager and check that:
- in the menu item "SIM-manager" there is "NB-IoT control center";
- in the "NB-IoT Control Center" our NB-IoT card has appeared, as well as sections:
NIDD APN
NIDD NIDD Accounts
Security - at the very bottom there is a menu item "API M2M" with "NIDD Developer's Guide"
All this economy should look something like this:
If something is missing in the M2M manager, feel free to send a request to your manager in MTS with a detailed description of your wishes.
If the required items of the NB-IoT Control Center are in place, you can start filling them in. Moreover, the item "NIDD Accounts" is the last one: it will need data from neighboring sections.
- NIDD APN: Come up with and fill in the name of our APN and the "Application ID".
- NIDD Security: here we indicate the IP address of our application server, which will communicate with NB-IoT devices through the MTS service (server).
- NIDD Accounts: just fill in all the fields and click "Save".
As soon as all the items are filled in, you can begin to deal with the requests that our server should generate. Go to API M2M and read the NIDD Developer's Guide. In order for the device to register in the NB-IoT network, you need to create an SCS AS configuration:
The manual contains a description of the individual request parameters, I will only give a couple of small comments:
- link for sending requests: m2m-manager.mts.ru/scef/v1/3gpp-nidd/v1/ {scsAsId }/configurations, where scsAsId is the “application ID” from the “NIDD APN” menu item;
- basic authorization method with username and password - use the username and password that you came up with when filling out the "NIDD Accounts" menu item;
- notificationDestination - your server address. From it you will send non-ip messages to devices, and the MTS server will send notifications about sending and receiving non-ip messages to it.
When the SCS AS configuration is created, and the device has successfully registered in NIDD mode in the operator's NB-IoT network, you can try to exchange the first non-ip messages between the server and the device.
To transfer a message from the server to the device, study the section "2.2 Sending a message" of the manual:
{configurationId} in the request link - the value of the "hex-abracadabra" type obtained at the stage of creating the configuration. Has the form: b00e2485ed27c0011f0a0200.
data - message content in Base64 encoding.
Configuring an NB-IoT Device to Work in NIDD
Of course, in order to exchange data with the server, our device must not only be able to work in the NB-IoT network, but also support the NIDD (non-ip) mode. In the case of the N21 DEMO board or other device based on the N21 NB-IoT module, the sequence of actions for transmitting non-ip messages is described below.
We activate the configuration with APN, which we came up with when filling in the "NIDD APN" item of the M2M manager (here - EFOnidd):
AT + CFGDFTPDN = 5, "EFOnidd"
and ask the device to re-register in the network:
AT + CFUN = 0
AT + CFUN = 1
after that we send the command
AT + CGACT = 1,1
and send the message "test":
AT + NIPDATA = 1, "test"
When a non-ip message is received on the UART of the N21 module, an unsolicited message is issued of the form:
+ NIPDATA: 1,10,3132333435 // non-ip-message '12345' received
where
1 is CID, pdp context
10 is the number of data bytes after the decimal point
The message is sent to the server in Base64 encoding (in a POST request).
PS It is convenient to use Postman to simulate data transfer from the server . Any script that simulates an HTTP server can be used to receive messages.
Hope it comes in handy for someone.
Thanks.