====== Dragino LoRa Components ======
===== DLOS8 4G =====
Outdoor gateway with 4G modem.
http://www.dragino.com/downloads/index.php?dir=LoRa_Gateway/DLOS8/
===== LSN50 v2 =====
[[https://www.antratek.de/lsn50-v2-waterproof-lora-sensor-node|{{https://cdn.antratek.nl/media/product/a14/lsn50-v2-waterproof-lora-sensor-node-lsn50-v2-eu868-12-cdd.jpg?400}}]]
\\
//Fig.: LSN50-V2 WATERPROOF LORA SENSOR NODE ([[https://www.antratek.de/lsn50-v2-waterproof-lora-sensor-node|Antratek]])//
A list of all relevant documentation:
* **[[https://www.dragino.com/downloads/index.php?dir=LSN50-LoRaST/|LSN50 Documentation Collection]]** from the Dragino Download Server
* {{http://www.dragino.com/downloads/downloads/LSN50-LoRaST/LSN50_LoRa_Sensor_Node_UserManual_v1.7.1.pdf|LSN50 LoRaWAN Sensor Node User Manual, Document Version: 1.7.1}}
* {{https://www.dragino.com/downloads/downloads/LSN50-LoRaST/DRAGINO_LSN50_AT_Commands_v1.6.3.pdf|LSN50 AT Commands v1.6.3}}
===== LSE01 Soil Sensor Kit =====
The LSE01 sensor kit consists of a LSN50 v2 LoRaWAN node plus a soil sensor providing soil moisture, soil temperature as well as soil electrical conductivity. Unfortunately the LSE01 software to communicate with the soil sensor as well as the soil sensor itself are closed source. It is totally unclear how the sensor works. It is not specified and not even the brand is known.
[[https://www.antratek.de/lsn50-v2-waterproof-lora-sensor-node|{{https://cdn.antratek.nl/media/product/bdf/lse01-lorawan-soil-sensor-lse01-eu868-7d5.jpg?400}}]]
\\
//Fig.: LSE01 LORAWAN SOIL SENSOR ([[https://www.antratek.de/lse01-lorawan-soil-sensor|Antratek]])//
A list of all relevant documentation:
* **[[https://www.dragino.com/downloads/index.php?dir=LoRa_End_Node/LSE01/|LSE01 Documentation Collection]]** from the Dragino Download Server
* :!: {{https://www.dragino.com/downloads/downloads/LoRa_End_Node/LSE01/LoRaWAN_Soil_Moisture_%26_EC_Sensor_UserManual_v1.4.pdf|LSE01 LoRaWAN Soil Moisture & EC Sensor User Manual v1.4}} (pdf)
* {{https://www.dragino.com/downloads/downloads/LoRa_End_Node/LSE01/LSE01_AT_Commands_v1.0.pdf|LSE01 AT Commands v1.0}} (pdf)
==== Shopping ====
State of 2021-01-04:
* https://www.antratek.de/catalogsearch/result/?q=lse01
* https://www.reichelt.de/index.html?ACTION=446&LA=0&nbc=1&q=lse01
* https://www.exp-tech.de/plattformen/lora/9965/lorawan-soil-moisture-ec-sensor
* https://shop.maker-store.de/home-automation-messen-steuern/industrial-automation/lora-iot-sensoren/4215/dragino-lorawan-soil-moisture-amp-ec-sensor-lse01-eu868
===== LSE01/LSN50 Device Registration in a The Things Network Application =====
A84041B2A18264AC
A840416151829000
The procedure is also described in the **{{https://www.dragino.com/downloads/downloads/LoRa_End_Node/LSE01/LoRaWAN_Soil_Moisture_%26_EC_Sensor_UserManual_v1.4.pdf|LSE01 manual v1.4}}**.
Any LoRaWAN device has to be registered ("paired") with a TTN application. Preferably over the air activation (OTAA) is used. In the case of OTAA the following information has to be transferred from the preset LoRaWAN device to the TTN application.
^ LoRaWAN Device ^ Direction ^ TTN Application ^ Description ^
| APPEUI | **=>** | **App EUI** | Application EUI, unique application ID |
| APPKEY | **=>** | **App Key** | Application Key for message encryption |
| DEVEUI | **=>** | **Device EUI** | Device EUI, unique device ID |
**DEVEUI**, **APPEUI** and **APPKEY** are preset in the **Dragino LoRaWAN devices**. They can be read and modified by means of AT commands. The easiest way to read the parameters from the device is to issue the command ''AT+CFG'' to retrieve all configuration parameters. The three parameters can also be taken from stickers attached to the LSE01/LSN50 device as well as a sticker on the paper box of the device.
Create a new application on the TTN console to collect all the data from the sensor nodes. An application can have several **different App EUIs** each of which being capable to serve as an unique application identifier for a registered device. Additional App EUIs can be created an manually filled in. The APPEUI suggested by the device to be registered has to be added to the list of the TTN App EUIs.
The problem with this method is that that you have individual App EUIs for each device connected. The advantage is that the device does not have to be opened and configured via a serial interface. It is also easier to bind the device to another application without changing/programming the device.
When the TTN application is created successfully it allows to **register devices**. Each device has a unique **Device EUI**. This can be taken from the LSE01/LSN50 settings and filled in into the respective field during device registration.
Furthermore an **App Key** has to be set in TTN which is shared between device and application to encrypt the data transmission on application level. Each device can have its own App Key or the devices share the same key. Fill in the APPKEY from the device into the respective field during TTN device registration.
Create a new application on your TTN console and click on register new device. \\
Insert the Device EUI of the Dragino sensor node (to be found on the sticker on your device or retrieved by ''AT+CFG'').
{{ :supp:lora:dragino:ttn_register_device.png?600&direct |}}
TTN will generate an App Key and an App EUI. Additional App EUIs can be added under //settings//. An individual App Key per registered device can be set during device registration.
===== Setting and Getting Configuration Parameters of LSE01/LSN50 =====
In some cases it may be reasonable to change parameters in the LoRaWAN nodes, e.g. so that all devices are configured to use the same APPEUI and APPKEY. It also may make sense to change the time interval for taking measurements depending on the application.
The configuration is done by means of a **serial terminal** (e.g. putty, realterm, hterm, etc.) and a **USB-to-Serial Converter** connected to the microcontroller board. The available commands follow an **extended AT modem command set**.
=== Connecting USB-to-Serial ===
You have to open the enclosure and connect a **USB-to-Serial Converter** to the microcontroller pins PA2 and PA3 as well as ground. The USB-to_Serial-converter should work on **3.3V logic**.
According the datasheet
https://www.st.com/resource/en/datasheet/stm32l051c6.pdf the MC pins PA2 and PA3 are **5V tolerant** but you would better use a 3.3V converter.
^ Microcontroller Pin ^ USB-to-Serial Converter Pin ^
| **PA2** (USART2_**TX**, 5V tolerant) | **RX** |
| **PA3** (USART2_**RX**, 5V tolerant) | **TX** |
| GND | GND |
| {{ :supp:lora:dragino:dragino_conv_con.jpg?600&direct}} |
| //Fig.: A USB-to-Serial Converter (here [[https://wiki.seeedstudio.com/UartSBee_V4/|UARTSBee]] by Seeedstudio) connected to LSE01. // |
{{ :supp:lora:dragino:conv_con.png?600&direct |}}
{{ :supp:lora:dragino:dragino_pinout.png?600&direct |}}
Power up the Dragino node by setting the yellow jumper. \\
Connect it to your computer and open a serial terminal (for example Putty or RealTerm). \\
Open the windows device manager to check on which com port the USB ttl converter has connected
{{ :supp:lora:dragino:dev_man.png?600&direct |}}
Open the com port with your terminal (baud rate: 9600).
{{ :supp:lora:dragino:rterm_port.png?600&direct |}}
Send the following command to your device:\\ AT+CFG
If everything went well you will get a response with the current configuration of your device.
{{ :supp:lora:dragino:rterm_send.png?600&direct |}}
To connect to your TTN application you will need to set the App Key and App EUI with the following commands:
AT+APPEUI=
and
AT+APPKEY=
Example:
AT+APPEUI=70 B3 D5 7E D0 03 A6 67
AT+APPEUI=? //get current App EUI
AT+APPKEY=1C 8D FF DB D6 73 B5 43 00 9A E6 1D 3D C6 08 6A
AT+APPKEY=? //get current App Key
You should get an "ok" response if your command was accepted. \\
Go to your TTN application and check if the device connected:
{{ :supp:lora:dragino:ttn_dev_con.png?600&direct |}}
By default the dragino node will send the battery voltage as the first two bytes of the payload
{{ :supp:lora:dragino:ttn_data.png?600&direct |}}
You can change the transmit interval with the following command: AT+TDC=30000 //time in ms
Dragino has a set of extended AT command e.g. for setting the LoRa parameters. Have a look at the official \\ [[http://wiki.dragino.com/index.php?title=End_Device_AT_Commands_and_Downlink_Commands|List of AT-Commands]] on the Dragino Wiki.
Please refer to the manual to see how you can change the mode and connect a sensor: \\ {{http://www.dragino.com/downloads/downloads/LSN50-LoRaST/LSN50_LoRa_Sensor_Node_UserManual_v1.7.1.pdf|LSN50 LoRaWAN Sensor Node User Manual, Document Version: 1.7.1}}
===== Soil Moisture, Temperature & EC Sensor =====
**It is unclear which soil sensor is used for LSE01 kit.** The sensor as well as the LSE01 firmware are closed source. The sensor has an orange sticker with several tick mark fields for different interface and power options. This may help to identify it.
| {{:supp:lora:dragino:2020-12-31_141244.jpg?direct&300|}} | {{https://sc01.alicdn.com/kf/H6cebb18491b94dac98848d5c84e251e4x.jpg?300}} |
| //Fig.: The soil sensor of the LSE01// | //Fig.: A picture from the internet. // |
**Some product pages to be analyzed further:**
* https://www.alibaba.com/product-detail/UART-RS485-MODBUS-RTU-Volumetric-water_1600075897556.html
* https://www.alibaba.com/product-detail/5-24V-RS485-MODBUS-RTU-UART_1600078056735.html
* Chinese, but with MODBUS protocol description: https://www.aliexpress.com/item/4000249441083.html
* Chinese, but with MODBUS protocol description: https://www.aliexpress.com/item/1005001332617508.html
* RK520-02: https://www.rikasensor.com/rk520-02-soil-moisture-sensor-temperature-probe-ec-sensor.html
* https://www.youtube.com/watch?v=6nLcasczX7Y
* https://german.alibaba.com/product-detail/rs485-0-5v-0-10v-output-high-precision-soil-moisture-content-and-temperature-sensor-earth-humidity-sensor-62299855350.html
* https://german.alibaba.com/product-detail/rika-rk520-02-temperature-humidity-sensor-for-iot-salinity-control-unit-and-ec-irrigation-62235506950.html
* https://german.alibaba.com/product-detail/4-20ma-0-5v-rs485-output-tdr-electronic-soil-moisture-sensor-62255506323.html
* Shandong Renke: https://sdrkck.en.alibaba.com/?spm=a2700.md_de_DE.cordpanyb.3.6a095fe2QKNltU
===== LoRa-Lite-Gateway (IMST iC880 + Raspberry PI) =====
==== Wifi Configuration ====
* https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md
===== How to Compile the Dragino STM32 LoRa Firmware =====
The firmware of Dragino LSN50 is compiled with Keil Compiler Suite. \\
Chapter 5 (p. 54 ff) of the [[https://www.dragino.com/downloads/downloads/LSN50-LoRaST/LSN50_LoRa_Sensor_Node_UserManual_v1.7.1.pdf|LSN50_LoRa_Sensor_Node_UserManual_v1.7.1]] lists all the links to the necessary information.
==== Firmware Source Code ====
* https://github.com/dragino/LoRa_STM32/tree/master/STM32CubeExpansion_LRWAN
==== KEIL Firmware Compile Instructions ====
* http://wiki.dragino.com/index.php?title=Firmware_Compile_Instruction_--_STM32
==== Hardware Design Flies ====
* https://github.com/dragino/Lora/tree/master/LSN50
==== Pre-Compiled HEX File for LSN50 ====
The pre-compiled hex codes for LSN50 can be found here: \\ https://www.dragino.com/downloads/index.php?dir=LSN50-LoRaST/Firmware/LSN50.hex/