LSN50v2-S31-S31B LoRaWAN Temperature & Humidity Sensor User Manual
Table of Contents:
- 1. Introduction
- 2. How to use LSN50v2-S31?
- 3. Battery & Power Consumption
- 4. Use AT Command
- 5. FAQ
- 6. Trouble Shooting
- 7. Order Info
- 8. Packing Info
- 9. Support
1. Introduction
1.1 What is LSN50V2-S31 LoRaWAN Temperature & Humidity Sensor
The Dragino LSN50v2-S31 is a LoRaWAN 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 LoRaWAN wireless protocol.
The temperature & humidity sensor used in LSN50v2-S31 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.
LSN50v2-S31 supports temperature and humidity alarm feature, user can get alarm for instant notice.
LSN50v2-S31 is powered by8500mAh Li-SOCI2 battery, It is designed for long term use up to 10 years. (Real-world battery life depends on the use environment, update period. Please check related Power Analyze report).
Each LSN50v2-S31 is pre-load with a set of unique keys for LoRaWAN registration, register these keys to local LoRaWAN server and it will auto connect after power on.
1.2 Specifications
Micro Controller:
- MCU: STM32L072xxxx
- Flash:128KB
- RAM:20KB
- EEPROM: 6KB
- Clock Speed: 32Mhz
Common DC Characteristics:
- Supply Voltage: built in 8500mAh Li-SOCI2 battery
- Operating Temperature: -40 ~ 85°C
Temperature Sensor:
- Range: -40 to + 80°C
- Accuracy: ±0.2 @ 0-90 °C
- Resolution: 0.1°C
- Long Term Shift: <0.03 °C/yr
Humidity Sensor:
- Range: 0 ~ 99.9% RH
- Accuracy: ± 2%RH ( 0 ~ 100%RH)
- Resolution: 0.01% RH
- Long Term Shift: <0.25 %RH/yr
LoRa Spec:
- Frequency Range,
- Band 1 (HF): 862 ~ 1020 Mhz
- 168 dB maximum link budget.
- High sensitivity: down to -148 dBm.
- Bullet-proof front end: IIP3 = -12.5 dBm.
- Excellent blocking immunity.
- Built-in bit synchronizer for clock recovery.
- Preamble detection.
- 127 dB Dynamic Range RSSI.
- Automatic RF Sense and CAD with ultra-fast AFC.
- LoRaWAN 1.0.3 Specification
Power Consumption
- Sleeping Mode: 20uA
- LoRaWAN Transmit Mode: 125mA @ 20dBm 44mA @ 14dBm
1.3 Features
- LoRaWAN v1.0.3 Class A
- Ultra-low power consumption
- External 3 meters SHT31 probe
- Measure range -40°C ~ 80°C
- Temperature & Humidity alarm
- Bands: CN470/EU433/KR920/US915/EU868/AS923/AU915/IN865
- AT Commands to change parameters
- Uplink on periodically or Interrupt
- Downlink to change configure
- 8500mAh Battery for long term use
1.4 Applications
- Wireless Alarm and Security Systems
- Home and Building Automation
- Industrial Monitoring and Control
- Long range Irrigation Systems.
1.5 Pin Definitions and Switch
The latest mother board for LSN50v2-S31 is :
1.5.1 Pin Definition
The device is pre-configured to connect to SHT31 sensor. The other pins are not used. If user want to know more about other pins, please refer the user manual of LSn50v2 at: https://www.dropbox.com/sh/djkxs7mr17y94mi/AABVlWbM9uzK9OA3mXyAT10Za?dl=0
1.5.2 Jumper JP2
Power on Device when put this jumper.
1.5.3 BOOT MODE / SW1
1. ISP: upgrade mode, device won't have any signal in this mode. but ready for upgrade firmware. LED won't work. Firmware won't run.
2. Flash: work mode, device starts to work and send out console output for further debug
1.5.4 Reset Button
Press to reboot the device.
1.5.5 LED
It will flash:
1. When boot the device in flash mode
2. Send an uplink packet
1.5.6 Probe Dimension
1.6 Hardware Variant
Model | Photo | Description |
---|---|---|
LSN50v2-S31 | External 3 meters SHT31 probe | |
LSN50v2 -S31B | On device SHT31 Probe |
2. How to use LSN50v2-S31?
2.1 How it works
The LSN50v2-S31 is working as LoRaWAN OTAA Class A end node. Each LSN50v2-S31 is shipped with a worldwide unique set of OTAA and ABP keys. User needs to input the OTAA or ABP keys in the LoRaWAN network server to register. Open the enclosure and power on the LSN50v2-S31, it will join the LoRaWAN network and start to transmit data. The default period for each uplink is 20 minutes.
2.2 Quick guide to connect to LoRaWAN server (OTAA)
Here is an example for how to join the TTN LoRaWAN Server. Below is the network structure, in this demo we use DLOS8 as LoRaWAN gateway.
The DLOS8 is already set to connect to TTN . What the rest we need to is register the LSN50V2-S31 to TTN:
Step 1: Create a device in TTN with the OTAA keys from LSN50V2-S31.
Each LSN50V2-S31 is shipped with a sticker with the default device EUI as below:
You can enter this key in the LoRaWAN Server portal. Below is TTN screen shot:
Register the device:
Add APP EUI and DEV EUI:
Add APP EUI in the application:
Add APP KEY
Step 2: Power on LSN50v2-S31
Step 3: LSN50V2-S31 will auto join to TTN network via the LoRaWAN coverage by DLOS8. After join success, LSN50V2-S31 will start to uplink temperature value to server.
2.3 Uplink Payload
2.3.1 Payload Analyze
Normal Upload Payload:
LSN50v2-S31 use the same payload as LSn50v2 mod1, as below. (Since firmware version 1.8.0, the third to sixth bytes are timestamps)
Size(bytes) | 2 | 4 | 1 | 2 | 2 |
---|---|---|---|---|---|
Value |
Battery:
Check the battery voltage.
Ex1: 0x0B45 = 2885mV
Ex2: 0x0B49 = 2889mV
Temperature:
Example:
If payload is: 0105H: (0105 & 8000 == 0), temp = 0105H /10 = 26.1 degree
If payload is: FF3FH : (FF3F & 8000 == 1) , temp = (FF3FH - 65536)/10 = -19.3 degrees.
(FF3F & 8000:Judge whether the highest bit is 1, when the highest bit is 1, it is negative)
Humidity:
Read:0x(0197)=412 Value: 412 / 10=41.2, So 41.2%
Alarm Flag& MOD:
Example:
If payload & 0x01 = 0x01 --> This is an Alarm Message
If payload & 0x01 = 0x00 --> This is a normal uplink message, no alarm
If payload >> 2 = 0x00 --> means MOD=1, This is a sampling uplink message
If payload >> 2 = 0x31 --> means MOD=31, this message is a reply message for polling, this message contains the alarm settings. see this link for detail.
2.3.2 Payload Decoder file
In TTN, use can add a custom payload so it shows friendly.
In the page Applications --> Payload Formats --> Custom --> decoder to add the decoder from:
2.3.3 Historical Temperature and humidity of S31, FPORT=3(Since firmware 1.8.0)
S31 stores sensor values and users can retrieve these history values via the downlink command.
The historical payload includes one or multiplies entries and every entry has the same payload as Real-Time water flow status.
- Each data entry is 11 bytes and has the same structure as real time water flow status, to save airtime and battery, S31 will send max bytes according to the current DR and Frequency bands.
For example, in the US915 band, the max payload for different DR is:
a) DR0: max is 11 bytes so one entry of data
b) DR1: max is 53 bytes so devices will upload 4 entries of data (total 44 bytes)
c) DR2: total payload includes 11 entries of data
d) DR3: total payload includes 22 entries of data.
If S31 doesn't have any data in the polling time. It will uplink 11 bytes of 0
Downlink:
0x 31 64 22 5B 00 64 22 5D 58 05
Uplink:
00 00 00 00 E1 02 95 64 22 5B 37 00 00 00 00 E1 02 97 64 22 5B 74 00 00 00 00 E0 02 98 64 22 5B B0 00 00 00 00 E0 02 9C 64 22 5B EC 00 00 00 00 E0 02 9C 64 22 5C 28 00 00 00 00 DF 02 9D 64 22 5C 64 00 00 00 00 DF 02 9F 64 22 5C A0 00 00 00 00 DE 02 A0 64 22 5C DC 00 00 00 00 DE 02 A9 64 22 5D 18 00 00 00 00 DE 02 A4 64 22 5D 54
Parsed Value:
<Temperature, Humidity, Unix TimeStamp>
[22.5,66.1,2023-03-28 03:12:55],
[22.5,66.3,2023-03-28 03:13:56],
[22.4,66.4,2023-03-28 03:14:56],
[22.4,66.8,2023-03-28 03:15:56],
[22.4,66.8,2023-03-28 03:16:56],
[22.3,66.9,2023-03-28 03:17:56],
[22.3,67.1,2023-03-28 03:18:56]
[22.2,67.2,2023-03-28 03:19:56],
[22.2,68.1,2023-03-28 03:20:56],
[22.2,67.6,2023-03-28 03:21:56],
Serial port:
2.4 Datalog Feature
2.4.1 Unix TimeStamp
S31 uses Unix TimeStamp format based on
Users can get this time from the link: https://www.epochconverter.com/ :
Below is the converter example
2.4.2 Set Device Time
Through LoRaWAN MAC Command
Once S31 Joined the LoRaWAN network, it will send the MAC command (DeviceTimeReq) and the server will reply with (DeviceTimeAns) to send the current time to S31. If S31 fails to get the time from the server, S31 will use the internal time and wait for the next time request.
Note: LoRaWAN Server needs to support LoRaWAN v1.0.3(MAC v1.0.3) or higher to support this MAC command feature.
2.4.3 Poll sensor value
Users can poll sensor values based on timestamps. Below is the downlink command.
Downlink Command to poll Open/Close status (0x31) | |||
---|---|---|---|
1byte | 4bytes | 4bytes | 1byte |
31 | Timestamp start | Timestamp end | Uplink Interval |
Timestamp start and Timestamp end-use Unix TimeStamp format as mentioned above. Devices will reply with all data logs during this period, using the uplink interval.
For example, downlink command
Is to check 2021/11/12 12:00:00 to 2021/11/12 15:00:00's data
Uplink Internal =5s,means CPL01 will send one packet every 5s. range 5~255s.
2.4.4 Clear Flash Record
Feature: Clear flash storage for data log feature.
AT Command: AT+CLRDTA
Command Example | Function | Response |
---|---|---|
AT+CLRDTA | Clear date record | Clear all stored sensor data… |
2.4.5 Set system time
Feature: Set system time, Unix format. See here for format detail.
AT Command:
Command Example | Function | Response |
---|---|---|
AT+TIMESTAMP=1611104352 | Set System time to 2021-01-20 00:59:12 | OK |
Downlink Command:
0x306007806000 // Set timestamp to 0x(6007806000),Same as AT+TIMESTAMP=1611104352
2.4.6 Set Time Sync Mode
Feature: Enable/Disable Sync system time via LoRaWAN MAC Command (DeviceTimeReq), LoRaWAN server must support v1.0.3 protocol to reply to this command.
SYNCMOD is set to 1 by default. If user wants to set a different time from the LoRaWAN server, the user needs to set this to 0.
AT Command:
Command Example | Function | Response |
---|---|---|
AT+SYNCMOD=1 | Enable Sync system time via LoRaWAN MAC Command (DeviceTimeReq) The default is zero time zone. | OK |
AT+SYNCMOD=1,8 | Enable Sync system time via LoRaWAN MAC Command (DeviceTimeReq) Set to East eight-time zone. | OK |
AT+SYNCMOD=1,-12 | Enable Sync system time via LoRaWAN MAC Command (DeviceTimeReq) Set to West Twelve Time Zone. | OK |
Downlink Command:
0x28 01 // Same As AT+SYNCMOD=1
0x28 01 08 // Same As AT+SYNCMOD=1,8
0x28 01 F4 // Same As AT+SYNCMOD=1,-12
0x28 00 // Same As AT+SYNCMOD=0
2.5 Temperature & Humidity Alarm Feature
LSN50V2-S31 work flow with Alarm feature.
User can use AT+SHTEMP and AT+SHHUM command to set the alarm low limit or high limit. Device will check the temperature & Humidity every minute, if the temperature lower than low limit or greater than high limit. LSN50v2-S31 will send an Alarm packet base on Confirmed Uplink Mode to server.
Below is an example of the Alarm Packet.
2.6 Configure LSN50v2-S31
LSN50V2-S31 supports configuration via LoRaWAN downlink command or AT Commands.
- Downlink command instructions for different platform: Use Note for Server(IoT LoRaWAN Server)
- AT Command Access Instructions: LINK
There are two parts of commands: General one and Special for this model.
2.6.1 General Configure Commands
These commands are to configure:
- General system settings like: uplink interval.
- LoRaWAN protocol & radio related command.
These commands can be found on the wiki: End Device AT Commands and Downlink Commands
2.6.2 Sensor related commands
Set Temperature Alarm Threshold:
- AT Command:
AT+SHTEMP=min,max
- When min=0, and max≠0, Alarm higher than max
- When min≠0, and max=0, Alarm lower than min
- When min≠0 and max≠0, Alarm higher than max or lower than min
Example:
AT+SHTEMP=0,30 // Alarm when temperature higher than 30.
- Downlink Payload:
0x(0C 01 00 1E) //Set AT+SHTEMP=0,30
(note: 3rd byte= 0x00 for low limit(not set), 4th byte = 0x1E for high limit: 30)
Set Humidity Alarm Threshold:
- AT Command:
AT+SHHUM=min,max
- When min=0, and max≠0, Alarm higher than max
- When min≠0, and max=0, Alarm lower than min
- When min≠0 and max≠0, Alarm higher than max or lower than min
Example:
AT+SHHUM=70,0 // Alarm when humidity lower than 70%.
- Downlink Payload:
0x(0C 02 46 00) //Set AT+SHTHUM=70,0
(note: 3rd byte= 0x46 for low limit (70%), 4th byte = 0x00 for high limit (not set))
Set Alarm Interval:
The shortest time of two Alarm packet. (unit: min)
- AT Command:
AT+ATDC=30 // The shortest interval of two Alarm packets is 30 minutes, Means is there is an alarm packet uplink, there won't be another one in the next 30 minutes.
- Downlink Payload:
0x(0D 00 1E) ---> Set AT+ATDC=0x 00 1E = 30 minutes
Poll the Alarm settings:
Send a LoRaWAN downlink to ask device send Alarm settings.
- Downlink Payload:
0x0E 01
Example:
Explain:
- Alarm & MOD bit is 0x7C, 0x7C >> 2 = 0x31: Means this message is the Alarm settings message.
2.7 LED Status
LSN50-v2-S31 has an internal LED, it will active in below situation:
- LED will fast blink 5 times when boot, this means the temperature sensor is detected.
- After the fast blinks on boot, the LED will flash once which means device is trying to send Join Packet to the network.
- If device successful join LoRaWAN network, the LED will be solid on for 5 seconds.
2.8 Button Function
Internal RESET button:
Press this button will reboot the device. Device will process OTAA Join to network again.
2.9 Firmware Change Log
Firmware version and change log please see: See this link.
3. Battery & Power Consumption
LSN50v2-S31 uses ER26500 + SPC1520 battery pack. See below link for detail information about the battery info and how to replace.
Battery Info & Power Consumption Analyze .
4. Use AT Command
4.1 Access AT Commands
User can use a USB to TTL adapter to connect to LSN50V2-S31 to use AT command to configure the device. Example is as below:
5. FAQ
5.1 What is the frequency range of LSN50v2-S31?
Different LSN50V2-S31 version supports different frequency range, below is the table for the working frequency and recommend bands for each model:
Version | LoRa IC | Working Frequency | Best Tune Frequency | Recommend Bands |
433 | SX1278 | Band2(LF): 410 ~525 Mhz | 433Mhz | CN470/EU433 |
868 | SX1276 | Band1(HF):862~1020 Mhz | 868Mhz | EU868/IN865/RU864 |
915 | SX1276 | Band1(HF):862 ~1020 Mhz | 915Mhz | AS923/AU915/ |
5.2 What is the Frequency Plan?
Please refer Dragino End Node Frequency Plan: End Device Frequency Band
5.3 How to update the firmware?
User can upgrade the firmware for:
Support new features
For bug fix
Change LoRaWAN bands.
Please see this link for how to upgrade: Firmware Upgrade Instruction
6. Trouble Shooting
6.1 AT Command input doesn't work
In the case if user can see the console output but can't type input to the device. Please check if you already include the ENTER while sending out the command. Some serial tool doesn't send ENTER while press the send key, user need to add ENTER in their string.
6.2 Abnormal temperature
When the temperature is displayed as - 0.1, it means that the sensor is not connected.
Please check whether the wiring is loose/Blocked by the insulation layer of the wire/pin damaged
7. Order Info
Part Number: LSN50V2-S31-XXX Or LSN50V2-S31B-XXX
XXX: The default frequency band
- AS923 : LoRaWAN AS923 band
- AU915 : LoRaWAN AU915 band
- EU433 : LoRaWAN EU433 band
- EU868 : LoRaWAN EU868 band
- KR920 : LoRaWAN KR920 band
- US915 : LoRaWAN US915 band
- IN865 : LoRaWAN IN865 band
- CN470 : LoRaWAN CN470 band
8. Packing Info
Package Includes:
LSN50V2-S31 or LSN50V2-S31B LoRaWAN Temperature Sensor x 1
Dimension and weight:
- Device Size: cm
- Device Weight: g
- Package Size / pcs : cm
- Weight / pcs : g
9. Support
- Support is provided Monday to Friday, from 09:00 to 18:00 GMT+8. Due to different timezones we cannot offer live support. However, your questions will be answered as soon as possible in the before-mentioned schedule.
- Provide as much information as possible regarding your enquiry (product models, accurately describe your problem and steps to replicate it etc) and send a mail to support@dragino.com.