Dragino temperature/moisture sensor N95S31B
The Dragino N95S31B is a NB-IoT Temperature and Humidity Sensor for Internet of Things solution.
It is used to measure the surrounding environment temperature and relative air humidity precisely, and then upload to IoT server via NB-IoT network.
The temperature & humidity sensor used in N95S31B is SHT31, which is fully calibrated, linearized, and temperature compensated digital output from Sensirion, it provides a strong reliability and long-term stability.
The SHT31 is fixed in a waterproof anti-condensation casing for long term use.
It supports sending data through UDP, MQTT and COAP over NB-IoT.
Useful resources
Find here the useful resources:
Configuring the device
Register the device
The imei can be found on the top cover of the device, please register the device in your iotcreators project before attempting to connect the device to the network.
Register the device
Opening the device
Connect the antenna to the device, then unscrew the four screws that hold the waterproof cover in place. This is the top view of the board:
Inserting the sim card
To mount the sim card into the sim card tray, unscrew the "modem removal screw" as showed above and insert the sim card.
Please be sure to insert the sim card as shown in this photo:
Connecting the device to a computer
To connect the device to a computer, you will need a usb to serial converter, which supports 3V3 or 5V logic. The logic voltage level can be selected with the "logic voltage switch" switch.
Set the correct voltage level
Please carefully setup the correct voltage level 3.3V according to your usb-to-serial converter. Failing to do so may unrecoverably damage your device!
You need 3 cables to connect the device to a serial monitor: GND (ground), TX (transmit) and RX (receive).
Just connect the PA3 of the dragino sensor serial COM to the TX of the usb-to-serial converter, the PA2 of the dragino sensor serial COM to the RX of the usb-to-serialconverter and the GND of the dragino sensor serial COM to the GND of the usb-to-serial converter.
Baudrate must be set to 9600 bps
First startup
To boot up the device, please set up the power on jumper as shown in section "Opening the device" to power on the device. Please make sure that the device is correctly attached to a computer.
Open your favourite serial monitor (for example: miniterm on linux or arduino serial monitor on windows) and the device will start to output info about its startup like so:
16:24:32.861 -> [12589]NBIOT has responded.
16:24:37.191 -> [16922]Echo mode turned off successfully.
16:24:39.123 -> [18868]Model information:BC95-GV.
16:24:40.458 -> [20206]The IMEI number is:<your_imei_here>.
16:24:41.824 -> [21554]The IMSI number is:<your_imsi_here>.
16:24:43.157 -> Currently set frequency band:1,3,5,8,20,28
If the imsi is correctly read, it means that the sim card has been correctly inserted.
Enter configuration mode
To enter configuration mode, just input the correct password, which for this device is 12345678.
Just input
12345678
And if the password is correct, the device will respond
16:53:09.872 -> [122884]Password Correct
You can set a custom device ID (the default will be the device imei) with command
AT+DEUI=<device_id> (15 bytes)
This means you are not able to enter at commands to configure the device.
Setting network parameters
You will need to configure the usual iotcreators parameters in order to attach the device to the iotcreators, APN, server address and port, protocol. In this guide i will use UDP since it is the simplest one.
To configure the protocol, in this case we will use plain UDP, just input:
AT+PRO=2
To configure the APN (please take a look here to check the correct APN for your sim card, the one below is just an example) just input
AT+APN=scs.telekom.tma.iot
To configure the device to send data to the iotcreators UDP server, just input
AT+SERVADDR=172.27.131.100,15683
You can then restart the device with the reset button.The device will then try to attach to the network.
If the device fails to register to the network, thus you always receive signal strength indication = 99, it is likely that the device is not having enough time to register to it. In this case, you can issue command
AT+CSQTIME=10
Troubleshooting CSQ=99,99 error
Dragino hosts this page here to help you troubleshoot this issue.
To set the network registration timeout to 10 minutes, which should be sufficient to conenct to the network.
Sending data to iotcreators
Register the device
Remember to register the device before sending data to iotcreators, see chapter above.
The device will automatically send data at the specified interval of time. Such interval can be configured with command
AT+TDC=<time_in_seconds>
You can immediately send collected data with command
AT+NOUD
Payload decoding
There are two types of possible payload structures, before firmware 1.2 and after firmware 1.2
Before firmware 1.2
Payload includes in total 21 bytes.
Size (bytes) | 6 | 2 | 2 | 1 | 1 | 5 | 2 | 2 |
---|---|---|---|---|---|---|---|---|
Value | Device ID | BAT | Version | Signal | MOD | Interrupt flag | Temperature SHT31 | Humidity SHT31 |
The payload can be decoded as such, a payload example of:
724031607457006e0ccd1b0100dc000ccc00e10186
Where
- Device ID: 0x724031607457 = 724031607457
- Version: 0x006e=110=1.1.0
- BAT: 0x0ccd = 3277 mV = 3.277V
- Signal: 0x1b = 27
- Model: 0x01 = 1
- 0x00dc000ccc= reserve, ignore in N95S31B
- Temperature by SHT31: 0x00e1 = 225 = 22.5 °C
- Humidity by SHT31: 0x0186 = 390 = 39.0 %rh
Firmware 1.2+
In this mode, uplink payload includes 91 bytes in total by default.
Each time the device uploads a data package, 8 sets of recorded data will be attached. Up to 32 sets of recorded data can be uploaded.
Size (bytes) | 8 | 2 | 2 | 1 | 1 | 2 | 1 | 2 | 2 | 2 | 4 | 2 | 2 | 4 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Value | Device ID | BAT | Version | Signal Strength | MOD | TemDS18B20 | Interrupt | ADC | SHTTEM | SHTHUM | Timestamp | SHTTEM | SHTHUM | Timestamp |
The payload can be decoded as such, a payload example of:
f868411056758782000c0d0f0c0100000000300114023163199d3c0113023163199d120113023163199c5e0112023763199baa0112023263199af60111023b631999a70112023b631998f3011202426319983f01110242631996eb
Where
- Device ID: f868411056758782 = f868411056758782
- Version: 0x000c=120=1.2
- BAT: 0x0d0f = 3343 mV = 3.343V
- Signal: 0x0c = 12
- Mod: 0x01 = 1
- TemDS18B20: 0x0000= 0 = 0
- Interrupt: 0x00= 0
- ADC: 0x0030= 48
- SHTTEM: 0x0114= 276 = 27.6
- SHTHUM: 0x0231 =561=56.1%
- Timestamp : 0x63199d3c =1662342011 (Unix Epoch Time)
- SHTTEM,SHTHUM,Time stamp : 0113023163199d12
- 8 sets of recorded data: SHTTEM,SHTHUM,Time stamp : 0113023163199c5e, .......
Convert UNIX timestamps to human readable timestamps
You can convert UNIX timestamps to human readable timestamps with this online tool here for example.
Code example
Uplink decoder
See this example to decode your uplinks https://github.com/iotcreators/doclib-downloads/blob/master/device-integrations/Simple%20http%20application/src/decoders/dragino_n95s31b.py
Forwarding data to your application endpoint
To forward data to your application endpoint, you can follow the user guide here:
Forwarding data
Updated over 1 year ago