Sending Simple Data to Antares
Last updated
Last updated
In this project you will be directed to send simple data from the NB-LYNX-7000 board to the Antares IoT Platform using a series of AT Commands from the SIM7000 module.
The materials required follow the General Prerequisites on the previous page. If you have not prepared the requirements on that page, then you can visit the following page.
The first thing you need to do is to setup the equipment by connecting the NB-LYNX-7000 board to your laptop/computer device using a USB-C cable.
Make sure you have installed the antenna on the GSM antenna port before connecting the NB-LYNX-7000 board to your laptop/computer.
Here are the equipment circuits that have been connected to the laptop/computer.
To send data to Antares, you need to input the programme code below in the Arduino IDE.
Don't forget to replace APPNAME with the name of the application you created on the Antares platform, DEVNAME with the name of the device created on the Antares platform, and ACCESSKEY with your account access-key.
After inputting the programme code, don't forget to save the programme code by selecting File > Save As. Here is how the Arduino IDE looks when you have inputted the code.
In order for the NB-LYNX-7000 board to communicate with the Antares platform, a SIM7000 module is used. SIM7000 is a cellular communication module developed by SIMCom Wireless Solutions. This module implements several protocols that allow the device to connect to the network using AT commands. The following describes some of the AT commands used in the programme code.
In the program code, the command "AT\r\n" is sent as the starting point or initialisation stage of the SIM7000 module. \r is a carriage return, while \n is a line feed. This command is sent to get an "OK" response.
In the programme code there is an "ATE0\r\n" command sent after getting an "OK" response. This command is used to disable echo mode indicating that initialisation has been successful.
In the programme code, the command "AT+CNMP=38\r\n" is sent to select the desired mode. The parameter "38" is set so that the SM7000 module only works on LTE networks, which are commonly used for NB-IoT.
Berikut parameter <mode> lain yang dapat digunakan
2 = Automatic
13 = GSM only
38 = LTE only
51 = GSM and LTE only
The programme code contains the command "AT+CMNB=2\r\n" which is used to select the mode between CAT-M and NB-IoT. The parameter "2" is used to select NB-IoT.
Here are the other parameters available
1 = CAT-M
2 = NB-IoT
3 = CAT-M dan NB-IoT
In the programme code there is a command "AT+CIPSHUT\r\n" which is sent as case 0 to turn off the PDP (packet data protocol) context. PDP context is a protocol in mobile communication that is used to manage data sessions between the device and the network. The "AT+CIPSHUT\r\n" command is used to ensure that all active internet connections have been turned off before continuing with other configurations. The response that will be received when sending this command is "SHUT OK".
In the programme code there is a command "AT+CSTT=""+ String(APN) + ""\r\n" which is sent as case 1 to set the APN (Access Point Name) on the SM7000 module as a GPRS (General Packet Radio Service) connection. String(APN) is used to convert the variable defined at the beginning of the code using #define APN "nb1internet" into a string. Therefore, the APN set in this case will have the value "nb1internet".
In the programme code there is a command "AT+CIICR\r\n" which is sent as case 2 to activate the wireless connection in the form of an IP connection. This IP connection is used as data transmission.
In the programme code there is a command "AT+CIFSR\r\n" which is sent as the default case to get the IP address when the previous cases (case 0, case 1, and case 2) have no match. This command is used to ensure that the IP address is successfully obtained which is indicated by a response in the form of an IP address. If this process fails, the response received is ERROR.
The programme code contains the command "AT+CIPSTATUS\r\n" which is used to query the current connection status.
In the programme code there is a command "AT+CIPSTART="TCP", "platform.antares.id", "8080"\r\n" which is used to start a TCP connection on a host and port. In this case the host used is platform.antares.id with port 8080. You can also replace the host name with the IP address.
The programme code contains the command "AT+CIPSEND\r\n" which indicates that the SIM7000 module is ready to send data through the established TCP connection.
You must set up the board being used by selecting ESP32 Dev Module under Tools > Board > esp32.
After that, you need to set the port used by going to Tools > Port > COM(X). The X value corresponds to the port number used by the NB-LYNX-7000 board.
After you have prepared the programme code, you can then upload the programme code by pressing the upload button as shown in the image below.
If the programme code has been uploaded successfully, you can open the Serial Monitor by pressing the icon as shown in the image below. You can find the icon on the top right-hand side.
You need to set the Serial Monitor's baud rate to 115200 so that its output can be read.
The Serial Monitor display will be as shown below, signalling the initiation of the SIM7000 module.
After successfully sending data 10 times, the programme will stop as shown in the following figure.
To ensure that the data has been sent correctly from the NB-LYNX-7000 board to the Antares IoT Platform, you can open your device URL. The following image shows the display on the Antares IoT Platform that has received data from the NB-LYNX-7000.