​​​ 

image-20220627094803-5.png

               

Table of Contents:

Data URI image

1.  Introduction

1.1 ​ What is LSN50 LoRa Sensor Node

LSN50 is a Long Range LoRaWAN Sensor Node. It is designed for outdoor data logging and powered by Li/SOCl2 battery for long term use and secure data transmission. It is designed to facilitate developers to quickly deploy industrial level LoRa and IoT solutions. It helps users to turn the idea into a practical application and make the Internet of Things a reality. It is easy to program, create and connect your things everywhere.

It is based on SX1276/SX1278 allows the user to send data and reach extremely long ranges at low data-rates. It provides ultra-long range spread spectrum communication and high interference immunity whilst minimizing current consumption. It targets professional wireless sensor network applications such as irrigation systems, smart metering, smart cities, smartphone detection, building automation, and so on.

LSN50 uses STM32l0x chip from ST, STML0x is the ultra-low-power STM32L072xx microcontrollers incorporate the connectivity power of the universal serial bus (USB 2.0 crystal-less) with the high-performance ARM® Cortex®-M0+ 32-bit RISC core operating at a 32 MHz frequency, a memory protection unit (MPU), high-speed embedded memories (192 Kbytes of Flash program memory, 6 Kbytes of data EEPROM and 20 Kbytes of RAM) plus an extensive range of enhanced I/Os and peripherals.

LSN50 is an open source product, it is based on the STM32Cube HAL drivers and lots of libraries can be found in ST site for rapid development.

1656294562709-486.png

1.2  Specifications

Micro Controller:

  • STM32L072CZT6 MCU
  • MCU: STM32L072CZT6
  • Flash: 192KB
  • RAM: 20KB
  • EEPROM: 6KB
  • Clock Speed: 32Mhz

Common DC Characteristics:

  • Supply Voltage: 2.1v ~ 3.6v
  • Operating Temperature: -40 ~ 85°C
  • I/O pins: Refer to STM32L072 datasheet

LoRa Spec:

  • Frequency Range, 
    • Band 1 (HF): 862 ~ 1020 Mhz

              or

    • Band 2 (LF): 410 ~ 528 Mhz
  • 168 dB maximum link budget.
  • +20 dBm - 100 mW constant RF output vs.
  • +14 dBm high efficiency PA.
  • Programmable bit rate up to 300 kbps.
  • High sensitivity: down to -148 dBm.
  • Bullet-proof front end: IIP3 = -12.5 dBm.
  • Excellent blocking immunity.
  • Low RX current of 10.3 mA, 200 nA register retention.
  • Fully integrated synthesizer with a resolution of 61 Hz .
  • FSK, GFSK, MSK, GMSK, LoRaTM and OOK modulation.
  • Built-in bit synchronizer for clock recovery.
  • Preamble detection.
  • 127 dB Dynamic Range RSSI.
  • Automatic RF Sense and CAD with ultra-fast AFC.
  • Packet engine up to 256 bytes with CRC.
  • LoRaWAN 1.0.2 Specification

Battery:

  • Li/SOCI2 un-chargeable battery
  • Capacity: 4000mAh 
  • Self Discharge: <1% / Year @ 25°C 
  • Max continuously current: 130mA
  • Max boost current: 2A, 1 second

Power Consumption

  • STOP Mode: 2.7uA @ 3.3v
  • LoRa Transmit Mode: 125mA @ 20dBm 44mA @ 14dBm

​1.3  Features

  • LoRaWAN 1.0.3 Class A, Class C
  • STM32L072CZT6 MCU
  • SX1276/78 Wireless Chip
  • Pre-load bootloader on USART1/USART2
  • MDK-ARM Version 5.24a IDE
  • I2C, LPUSART1, USB, SPI2
  • 3x12bit ADC, 1x12bit DAC
  • 20xDigital I/Os
  • LoRa™ Modem
  • Preamble detection
  • Baud rate configurable
  • CN470/EU433/KR920/US915/IN865
  • EU868/AS923/AU915
  • Open-source hardware / software
  • Available Band:433/868/915/920 Mhz
  • IP66 Waterproof Enclosure
  • Ultra-Low Power consumption
  • AT Commands to change parameters
  • 4000mAh or 8500mAh Battery for long term use。

1.4 ​ Applications

  • Smart Buildings & Home Automation
  • Logistics and Supply Chain Management
  • Smart Metering
  • Smart Agriculture
  • Smart Cities
  • Smart Factory

Data URI imageData URI imageData URI imageData URI image

1.5  Pin Definitions and Switch

1656295519542-152.png

1656295532863-613.png

image-20220627101527-1.png

1.5.1  Jumper JP2

Power on Device when put this jumper.

1.5.2  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.3  Reset Button

Press to reboot the device.

1.5.4  LED

It will flash:

  1. When boot the device in flash mode
  2. Send an uplink packet

1.6  Hardware Change log

Note: Hardware version is marked in the PCB.

LSN50 v2.1:

  1. Change R14 to 1M ohm
  2. Change R3, R4 to 4.7Kohm. So no need to modify them for 3 DS18B20 connection.
  3. Add ESD to each I/O

LSN50 v2.0:

  • Change to a new enclosure. Improve with external antenna, IP68, ear hook.

LSN50 v1.3:

  • Add P-MOS to control 5V output

LSN50 v1.2:

  • Add LED. Turn on for every LoRa transmit
  • Add pin PA4, PB13, NRST
  • Add 5V Output, on/off control by PB5(Low to Enable, High to Disable)

1.7  Hole Option

The LSN50 provides different hole size options for different size sensor cable. The options provided are M12, M16 and M20. The definition is as below:

image-20220627104757-1.png

1656298089706-973.png

2.  Use LSN50 with LoRaWAN firmware

2.1  How it works

The LSN50 is pre-loaded with a firmware and is configured as LoRaWAN OTAA Class A mode by default. It has OTAA keys to join LoRaWAN network. To connect a local LoRaWAN network, you just need to input the OTAA keys in the LoRaWAN IoT server and power on the LSN50. It will automatically join the network via OTAA.

 

The diagram below shows the working flow in default firmware (ver 1.7.0):  

image-20220627104855-2.png

In case you can't set the OTAA keys in the LoRaWAN OTAA server, and you have to use the keys from the server, you can use AT Commands to set the keys in the LSN50.

2.2  ​Quick guide to connect to LoRaWAN server (OTAA)

Following is an example for how to join the TTN V3 LoRaWAN Network. Below is the network structure; we use the LG308  as a LoRaWAN gateway in this example.  

Data URI image1655891470063-521.png1656298385089-555.png

 

The LG308 is already set to connected to TTN V3 network , so what we need to now is configure the TTN V3 server.Data URI imageData URI image

 

Step 1: Create a device in TTN with the OTAA keys from LSN50.

Each LSN50is shipped with a sticker with the default device EUI as below:

 

image-20220607170145-1.jpegData URI imageData URI imageData URI imageData URI imageData URI imageData URI imageData URI image

You can enter this key in the LoRaWAN Server portal. Below is TTN screen shot:

Register the device:

Data URI imageData URI image1654935135620-998.pngData URI imageData URI imageData URI imageData URI imageData URI image​​

Data URI imageData URI image

Add APP EUI and DEV EUI:

image-20220611161308-4.pngData URI image

Add APP EUI in the application:

image-20220611161308-5.pngData URI image

Add APP KEY

image-20220611161308-6.pngData URI image

Data URI imageData URI imageData URI imageData URI image

Data URI imageData URI imageData URI imageData URI image

Step 2: Power on LSN50

Put a Jumper on JP2 to power on the device. 

image-20220627145643-5.png 

  

  

For LSn50v2:

1656313034748-905.png 

Data URI imageData URI imageData URI imageData URI imageData URI imageData URI image

Step 3:  The LSN50 will auto join to the TTN V3 network. After join success, it will start to upload messages to TTN V3 and you can see the messages in the panel.

Data URI imageData URI image1656312908855-552.pngData URI image

Data URI imageData URI imageData URI imageData URI image​​

2.3  ​Working Mode & Uplink Payload

LSN50 has different working mode for the connections of different type of sensors. This section describes these modes. Use can use the AT Command AT+MOD to set LSN50 to different working modes.

For example:

 AT+MOD=2 // will set the LSN50 to work in MOD=2 distance mode which target to measure distance via Ultrasonic Sensor.

NOTE:

1. Some working modes has payload more than 12 bytes, The US915/AU915/AS923 frequency bands’ definition has maximum 11 bytes in DR0. Server sides will see NULL payload while LSn50 transmit in DR0 with 12 bytes payload.
2. All modes share the same Payload Explanation from HERE.
3. By default, the device will send an uplink message every 5 minutes.

Size (bytes)

24122
Value

ignore

2.3.1  MOD=1 (Default Mode)

In this mode, uplink payload includes in total 11 bytes. Uplink packets use FPORT=2.
 

Size(bytes)222122
ValueBAT

Temperature

(DS18B20)

ADCDigital in & Digital Interrupt

Temperature

(SHT20 or SHT31 or Ultrasonic Sensor)

Humidity

(SHT20)

image-20220627150949-6.png

 

2.5  ​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.5.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.5.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:

1655972693463-687.png

Explain:

  • Alarm & MOD bit is 0x7C, 0x7C >> 2 = 0x31: Means this message is the Alarm settings message.

2.6  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.7  Button Function

Internal RESET button:

Press this button will reboot the device. Device will process OTAA Join to network again.

2.8  ​Firmware Change Log

Firmware version and change log please see: See this link.

3.  Battery Info

The LSN50v2-S31 battery is a combination of a 8500mAh ER26500 Li/SOCI2 Battery and a Super Capacitor. The battery is non-rechargeable battery type with a low discharge rate (<2% per year). This type of battery is commonly used in IoT devices such as water meter.

The battery is designed to last for more than 5 years for the LSN50v2-S31.

The battery related documents can be found as below:

The connector is as below incase user want to use their own battery

image-20220607172042-11.pngData URI imageData URI imageData URI image​​Data URI imageData URI image

There are several parameters affect the battery power. Please see consumption report from here for the detail explain:

 

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:

image-20220623095817-4.png

  

image-20220623100044-7.png

5.  Developer Guide

  

LSN50 is an open source project, developer can use compile their firmware for customized applications. User can get the source code from:

Use Keil to open project file:

STM32CubeExpansion_LRWAN/Projects/Multi/Applications/LoRa/DRAGINO-LRWAN(AT)/MDK-ARM/STM32L072CZ-Nucleo/Lora.uvprojx

In Keil, you can see what frequency band the code support.

image-20220627162417-15.png

1. If you want to change frequency, modify the Preprocessor Symbols.
For example, change EU868 to US915

1656318662202-530.png

file:///C:/Users/93456/AppData/Local/Temp/msohtmlclip1/01/clip_image002.emz

2. Compile and build

image-20220627163212-17.png

6.  FAQ

6.1  Why there is 433/868/915 version?

Different countries have different rules for the ISM band for LoRa. Although the LoRa chip can support a wide range of Frequencies, we provide different versions of the hardware for best tune of the LoRa hardware part.

6.2  What is the frequency range of LT LoRa part? ?

Different LT version supports different frequency range, below is the table for the working frequency and recommend bands for each model:

image-20220627155456-9.png

6.3  How to change the LoRa Frequency Bands/Region?

You can follow the instructions for how to upgrade image.
When downloading the images, choose the required image file for download.

6.4  Can I use Private LoRa protocol?

The stock firmware is based on LoRaWAN protocol. You can use a private LoRa protocol in LSN50. This section describes an example for base LoRa transfer. It is a reference/demo and we do not provide further software development support on this topic.

In this demo, we will show the communication between LoRa Shield and LSN50, both of them using the basic LoRa library. LSN50 will send a message to a LoRa Shield and the LoRa Shield will print it to the console.

 

LoRa Shield + UNO:

Use the LoRa Library and upload the LoRa Receive Sketch to Arduino.

Refs:

http://www.dragino.com/downloads/index.php?dir=LSN50-LoRaST/LoRa_Raw_Example/Arduino/&file=LoRa.zip

http://www.dragino.com/downloads/downloads/LSN50-LoRaST/LoRa_Raw_Example/Arduino/LoRaReceiver.ino

Open the serial monitor to Arduino. The device acts as a LoRa Receiver and listen on the frequency 868.3Mhz by default.

LSN50:

Use the <LoRa RAW code> . The project file is in: MDK-ARM\STM32L072CZ-Nucleo\ Lora.uvprojx

Compile it and Upload it to LSN50, the LSN50 will transfer on the frequency 868.3Mhz.

In the Arduino Console, it will see the received packets as below.

image-20220627160116-10.png

6.5  How to set up LSN50 to work in 8 channel mode

By default, the frequency bands US915, AU915, CN470 work in 72 frequencies. Many gateways are 8 channel gateways, and in this case, the OTAA join time and uplink schedule is long and unpredictable while the end node is hopping in 72 frequencies.

You can configure the end node to work in 8 channel mode by using the AT+CHE command. The 500kHz channels are always included for OTAA.

For example, in US915 band, the frequency table is as below. By default, the end node will use all channels (0~71) for OTAA Join process. After the OTAA Join, the end node will use these all channels (0~71) to send uplink packets.

image-20220627160940-13.png

When you use the TTN V3 network, the US915 frequency bands use are:

  • 903.9 - SF7BW125 to SF10BW125
  • 904.1 - SF7BW125 to SF10BW125
  • 904.3 - SF7BW125 to SF10BW125
  • 904.5 - SF7BW125 to SF10BW125
  • 904.7 - SF7BW125 to SF10BW125
  • 904.9 - SF7BW125 to SF10BW125
  • 905.1 - SF7BW125 to SF10BW125
  • 905.3 - SF7BW125 to SF10BW125
  • 904.6 - SF8BW500

Because the end node is now hopping in 72 frequency, it makes it difficult for the devices to Join the TTN V3 network and uplink data. To solve this issue, you can access the device via the AT commands and run:

AT+CHE=2

ATZ

to set the end node to work in 8 channel mode. The device will work in Channel 8-15 & 64-71 for OTAA, and channel 8-15 for Uplink.

The AU915 band is similar. Below are the AU915 Uplink Channels.

image-20220627161124-14.png

6.6  How to set up LSN50 to work with Single Channel Gateway such as LG01/LG02?

In this case, users need to set LSN50 to work in ABP mode and transmit in only one frequency.

Assume we have a LG02 working in the frequency 868400000 now, below is the steps.

Step1: Log in TTN V3, Create an ABP device in the application and input the network session key (NETSKEY), app session key (APPSKEY) from the device.

image-20220627160542-11.png

Note: You need to make sure the above three keys match in the device and in TTN V3. You can change them either in TTN V3 or in the Device to make them match. In TTN V3, NETSKEY and APPSKEY can be configured in the setting page, but the Device Addr is generated by TTN V3.
You can also change the Device ADDR in TTN V3 by using the The Things Network CLI.

Step2:  Run AT commands to make the LSN50 work in Single frequency and ABP mode. Below are the AT commands:

AT+FDR       Reset Parameters to Factory Default, Keys Reserve

AT+NJM=0  Set to ABP mode

AT+ADR=0  Set the Adaptive Data Rate Off

AT+DR=5    Set Data Rate (Set AT+DR=3 for 915 band)

AT+TDC=300000        Set transmit interval to 5 minutes

AT+CHS=868400000  Set transmit frequency to 868.4Mhz

AT+DADDR=26 01 1A F1  Set Device Address to 26 01 1A F1

ATZ                                     Reset MCU

As shown  below:

image-20220627160542-12.png

6.7  How to configure the EUI keys in LSN50?

The early version of LSN50 firmware doesn't have pre-configured keys.
It is recommended that you update the image to the latest version before configure the keys. Refer upgrade_image to update the firmware to the latest version.

Run AT commands to set the keys to desired keys; refer AT Command manual

7.  Trouble Shooting

7.1  Connection problem when uploading firmware.

Issue: While using USB to TTL to upload firmware via UART interface. It works for several times but most of times it fails.

Checklist:

1. Double check if follow up exactly the steps as manual.

2. Check if hardware works fine: a) check if AT command works, b) check if ISP / flash switch works: PA12 will have different output level while set the ISP/Flash Switch in different position. c) check if reset button works.

3. If you use Windows10 system. Please change the flash loader to run in Windows7 compatibility mode.

image-20220627153421-8.png

4. We have seen cases where the FT232 USB TTL adapter has a reliability issue with the PC USB chipset (Intel). In this case, even though points 1 and 2 above work, it still has a reliability issue for uploading. If this happens, change to a different PC or change the USB to TTL adapter to solve the issue.

7.2  Why I can't join TTN V3 in US915 / AU915 bands?

It is due to channel mapping. Please see the Eight Channel Mode section above for details. 

7.3  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. 

8.  Order Info

Part Number: LSN50-XX-YY  or  LSN50-XX-YY-ZZ

XX: 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

YYHole Option

  • 12: With M12 waterproof cable hole
  • 16: With M16 waterproof cable hole
  • 20: With M20 waterproof cable hole (LSN50 v2 doesn’t have this version)
  • NH: No Hole

ZZBattery Option ( Only valid for v2 model)

  • 4: with 4000mAh battery
  • 8: with 8500mAg battery

9. ​ Packing Info

For LSN50:

Package Includes:

  • LSN50 LoRa Sensor Node x 1

Dimension and weight:

  • Device Size: 8 x 6.5 x 5 cm
  • Device Weight: 137g
  • Package Size / pcs : 9 x 7 x 6cm
  • Weight / pcs : 160g

For LSN50 v2:

Package Includes:

  • LSN50 v2 LoRa Sensor Node x 1
  • External antenna x 1
  • Spring Antenna (evaluate purpose)

Dimension and weight:

  • Device Size: 9.7 x 6.5 x 4.7 cm
  • Device Weight: 150g
  • Package Size / pcs : 14.0 x 8x 5 cm
  • Weight / pcs : 180g

 

 

10.  ​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.

11.  References

 

Tags:
    
Copyright ©2010-2022 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0