Category Archives: LoRaWAN application

DWM-DF12LD LoRaWAN TEMP/ HUM/ Smoke Sensor Connect to Chirpstack Guide

Pre-Work: Gateway Setting

Radio Setting

Log in to the web management page of the gateway and configure the LoRa radio as shown in the figure below. The figure below shows the configuration of U915 as an example.

The default working frequency of the Smoke Sensor is 0 to 7 channels in the US915 band, and the corresponding frequency points are shown in the following figure.

Click “LoRa Gateway” and “LoRa RF” in the left menu bar, and set according to the working frequency of the LoRa smoke sensor.
RF 0 center frequency: 902.6MHz, RF 1 center frequency: 903.4MHz,
The corresponding frequency points are 902.3, 902.5, 902.7, 902.9, 903.1, 903.3, 903.5, 903.7 (Unit: MHz)

LoRa Gateway Server Setting

Configure the LoRa server

1. Login to ChirpStack 

In the browser address bar, enter the ChirpStack server address, then enter your account and password to log in.

2. Add Gateway

Go to “Gateways”, click “Add gateway” in the top right corner to add a gateway. 

You have to make sure a LoRawan Gateway and the sensor node are ready for data transmission if you want to check the data receiving through the Chripstack.
Name: Custom gateway name;
Description: Gateway description;
Gateway ID: Enter the gateway EUI, fill in according to the actual situation; 
Stats interval: The interval at which the gateway sends statistics, unit: s;

Fill in the required gateway information to be added, then click “Submit”. 

3. Gateway configuration 

Log in to the gateway’s configuration page, fill in the actual ChirpStack server address and uplink/downlink ports according to the actual information of the ChirpStack server.

3.1 Gateway status

Go to the “Gateway” interface, in the gateway list, you can view the gateway connection status, Online indicates the gateway has successfully connected.

  3.2  Add Device 

Using a smoke sensor device as an example. For other devices, modify according to the actual parameters: 

3.2.1 Create device profile

Go to “Device Profiles”, click “Add device profile” in the top right corner to add a device profile.

Name: Custom device profile name;
Description: Device profile description;
Region: US915;
MAC version: LoRaWAN 1.0.2;
Regional parameters revision: A;
ADR algorithm: Default ADR algorithm (LoRa only);
Join (OTAA/ABP): OTAA;

After filling in the device profile information, click “Submit”.

4.  Add application 

Go to “Application”, click “Add application” in the top right corner to add an application. 

Name: Custom application name;
Description: Application description;

After filling in the application information, click “Submit”. 

4.1 Add device 

Go to “Application”, click on the application where you want to add a device, then click “Add device” to add a device. 

Name: Custom device name; 
Description: Device description;
Device EUI: Device DevEUI;
Join EUI: Device AppEUI;
Device profile: Select the newly created device profile above;
Application key: Device AppKey

After filling in the device information, click “Submit”. 

5. Check device status

Go to the ChirpStack interface, in “Dashboard”, check the device status. Active indicates the device has successfully joined the network. 

6. View device data

Go to “Applications”, select the corresponding device, and view the data flow in Events.

DWM-DF12LD LoRaWAN TEMP/ HUM/ Smoke Sensor User Manual

1.AT Command

1.1Command List

The list of AT instructions related to the device is as follows:

1.2 Command Format

The command uses ASCII code string, there are 3 formats, they are as follows:

1. Execution format: at+<command><CR>; 2. Query format: at+<command>=?<CR>; 3. Configuration format: at+<command>=<parameter1>[,parameter2]…[,parametern]<CR>.

Each command supports at least one type. Format description:

1. The command starts with “at+” and ends with<CR>(carriage return, hexadecimal value is 0x0D, which is represented by ‘ r’ in C language); 2. If the end of the command (or in the command) contains a newline character (<LF>),<LF>is ignored; 3.<>: indicates the part that must be included; 4. []: indicates an optional part; 5. Commands and parameters are not case sensitive.

The return format of command execution varies depending on the command, and there are mainly the following types of formats:

1. <ok><CR><LF>, indicating success, more common in the return of configuration commands; 2. <error,1><CR><LF>, indicating that the input command cannot be recognized; 3. <error,2><CR><LF>, indicating that the command can be recognized, but the input parameter is invalid, which is more common in the return of configuration commands; 4. <parameter1>[,<parameter2>,…<parametern>]<CR><LF>, which is more common in the return of query commands; 5. Other forms, which vary from command to command, are more common in the return of execution-type commands. Where <CR> is the carriage return character and <LF> is the line feed character (0x0A in hexadecimal, represented by ‘\n’ in C language).

1.3 Command Reply

1.3.1 Success

After executing the command, if the return is successful, return ok\r\n.

1.3.2 Error

After executing the command, if an error is returned, it has the following format: error,<error number>,[error description string]\r\n Among them, the error number and error description string are shown in the following table:

1.4 System Commands

1.4.1 ver

1.4.2 reboot

1.4.3 def

1.5 Application Commands

1.5.1 buzzer

1.5.2 report

Communication Protocol

1.1 Periodic reporting

The status reporting period defaults to 8h/packet :

Report example :01 41 01 00 1C 00 01 01 19 FF 00 00 01 62 7B 23 5E FF AA 00 1E 01 4C 22 17 64 00 00 63 00
FA 01 F4 D2 4A
Data Analysis: Device DevEUI: 00010119FF000001; UTC Timestamp: 1652237150; Signal Strength: -86dBm;
Signal-to-Noise Ratio: 3.0dB; Battery Voltage: 3.32V; Software Version: 2, Protocol Version: 2; Message Type:
Normal; Smoke Concentration Percentage: 0%; Temperature: 25.0℃; Humidity: 50.0%; CRC Check: 0xd24a

1.2 Cancel the alarm report

When the device detects that the smoke concentration is 100%, the device will trigger an alarm and report at a high frequency of 10s/packet. Users can cancel the smoke alarm through the following ModBus commands. Disarm the alarm report and only stop the high-frequency report of 10s/packet .

The device follows the standard ModBus communication protocol, please use the 0x10 function code to
write to the register.
Example of Canceling the alarm report: 01 10 03 03 00 01 02 01 73 d5 16

Device Debugging

1.3 LoRaWAN NS

The following LoRaWAN NS operations only show the general operation process

1.3.1 Create an application

After logging into the platform, create a LoRa smoke sensor application. Note: Select “Please select a parser” for “Data codec”, do not select other options.

1.3.2 Creating a Device Template

1.3.3 Registering the device

As shown in the figure below, create a device, paste DevEUI on the back of the device, and remove the hanging plate to see it.

As shown in the figure below, after creating the device, you need to fill in the device key (AppKey, shipped
with the product)

1.4 Gateway

1.4.1 LoRa RF

Log in to the web management page of the gateway and configure the LoRa radio as shown in the figure below. The figure below shows the configuration of CN470 as an example.

1.4.2 LoRa Server

As shown in the figure below, configure the LoRa server.

After the above configuration is complete, make sure that the gateway is working normally, as shown in the following figure.

1.5Device

1.5.1Connect Network

The following operations can trigger the device to join the network: 1. Power on the device again. 2. If the device is not connected to the network, press and hold the button for 3s and then release it, and the device will access the network once. The device is successfully connected to the network, and the red LED is always on for 5s. The network connection fails, and the red LED flashes slowly for 5s.

1.5.2 Test Alarm

After the device is successfully connected to the network, the alarm test can be performed. Press and hold the button for 3s and release it. During the press and hold, the device will emit sound and light alarms. After releasing, the device will report the test alarm data to the platform through LoRaWAN. As shown in the figure below, please refer to Chapter III for data analysis.

LT-M9500 LoRaWAN TVOC and eCO2 Temperature & Humidity Air Quality Sensor Node Connect to Dragino gateway and ChirpStack

For the first use, if it has been powered on, it can be used directly; if it has not been powered on, install the battery, plug the 2-core plug of the battery box into the battery socket (white) on the circuit board. Wait for the power indicator light to stay on, indicating that the program is running. If you need to reset the rotary switch again, please disconnect the power after setting (more than 1 minute to ensure that the microcontroller is completely reset or short-circuit the two short needles of the white socket on the main board) and then power on. At this time, users can install the sensor on site and put it into use.    The wireless sensor should be placed as high as possible and in a relatively open space. It is recommended to be more than 1 meter above the ground; avoid placing metal objects around the sensor to avoid weakening the wireless signal; electronic interference may come from the following objects, so they should be avoided: generators, high current equipment, high voltage relays, transformers, etc.; vibration or impact may also be a source of interference, so the equipment should be kept stationary as much as possible during installation. Please do not install the equipment in an environment beyond the measurement range of the sensor, otherwise it may cause the product to malfunction and permanent damage to the sensor.

Count the second one from the left in the figure as the sensor address selected by the rotary switch. The user needs to select and set the slave station address within 001~255. The setting will take effect after power off and restart.

The method of setting the address with the rotary switch is as follows:

As shown in the figure, the rotary switch and the values represented by each bit, switch to “ON” is the valid value, switch to the opposite direction of “ON” is the invalid value, the address is the sum of the valid values. For example: if the address is 100, then the 3rd, 6th and 7th bits of the rotary switch are switched to the ON position, that is, 4+32+64=100. 

Communication Protocol 

Register address 0000H 0001H 0002H 0003H 0004H 0005H 0006H 0007H 0008H
Parameters    Temperature Humidity Spare Spare TVOC CO2 Spare Spare Spare
Unit %RH   PPM PPM        
Range -40-80 0-100   0-50   0-5000      
Sample Value /10 /10   /10   /1      
Operation Read only Read only   Read only Read only        
Parameters  0009H 000AH 000BH 000CH 000DH 000EH 000FH    
Parameters Spare Spare Spare Spare Battery voltage Online sign signal strength    
Unit                  
Range                  
Sample Value                  
Operation                  

Connect to Dragino gateway and ChirpStack

Connect via LAN port with direct connection from PC ,Power on the gateway, access the gateway with the url( 10.130.1.1) in the browser( Access via WiFi AP network http:// IP_ADDRESS:8000 ), click LORA, and select correct frequency plan and frequency band mask. The default frequency band mask is: 1 . click Save & Apply

Select the LORANWAN configuration interface to set the NS address of the gateway. We use The CHIRPSTACK server as example for the test, so select CUSTOM and select it according to the real server address.  Record the GATEWAY EUI information. click Save & Apply.

Log in to the ChirpStack server Enter the IP address and port, enter the user name and password, and click Login.

Add a LORAWAN gateway. Click Gateways and CREATE to enter the gateway EUI, which is the gateway EUI shown in the pictures below.

Add an app Click Applications and click CREATE to add an app

 Click Add Application, add device, click CREATE to add device name.

Device Description DEVEUI of device, select the corresponding frequency band, and click Add Device, as shown in picture below.  AU915 communication is not very stable, which may be related to the frequency band. It is recommended to disable the frame count verification function.

Add APPKEY, enter APPKEY parameter in Application Key, and click SET device-keys.

Click DEVICE DATA to view the DATA


DECODE Example
function Decode(fPort, bytes, variables) {
var paramLength = bytes[2]/2;
var params = new Object();
for(var i=0;i<paramLength;i++)
{
params[“param”+i] = bytes[3+i2]256+bytes[4+i*2];
}
return params;
}

DECODER

function decodeUplink(input) {
var params = new Object();
params[“Temp”] = input.bytes[3]256+input.bytes[4]   

params[“Humi”] = input.bytes[5]256+input.bytes[6]   
params[“PM2.5”] = input.bytes[7]256+input.bytes[8] 

params[“TVOC”] = input.bytes[11]256+input.bytes[12]   

params[“CO2”] = input.bytes[13]256+input.bytes[14]    

params[“O3”] = input.bytes[17]256+input.bytes[18]    

params[“HCHO”] = input.bytes[11]256+input.bytes[22]  
return {
data: params
};
}

TTN Device Hardware options

Brand: stmicroelectronics Model: nucleo-wl55jc1 Hardware version: 1.0 Firmware version: 1.0

TTN Decoder

function decodeUplink(input) {
var params = new Object();
params[“Temp”] = input.bytes[3]256+input.bytes[4]   

params[“Humi”] = input.bytes[5]256+input.bytes[6]   
params[“PM2.5”] = input.bytes[7]256+input.bytes[8] 

params[“TVOC”] = input.bytes[11]256+input.bytes[12]   

params[“CO2”] = input.bytes[13]256+input.bytes[14]    

params[“O3”] = input.bytes[17]256+input.bytes[18]     params[“HCHO”] = input.bytes[11]256+input.bytes[22]
return {
data: params
};
}

LT-W208 LoraWAN Soil NPK Sensor node Connect to Dragino gateway and ChirpStack

Overview

LT-W208  LoraWAN Soil NPK Sensor node is powered by battery, with long battery life, no wiring, and convenient construction.Useing the LoraWAN spread spectrum technology which Products are widely used in the field of smart farming. this document shows a basic idea about LT-W208  LoraWAN Soil NPK Sensor node Connect to Dragino gateway and ChirpStack.

1.Connect via LAN port with direct connection from PC ,Power on the gateway, access the gateway with the url( 10.130.1.1) in the browser( Access via WiFi AP network http:// IP_ADDRESS:8000 ), click LORA, and select correct frequency plan and frequency band mask. The default frequency band mask is: 1 . click Save & Apply .

2. Select the LORANWAN configuration interface to set the NS address of the gateway. We use The CHIRPSTACK server as example for the test, so select CUSTOM and select it according to the real server address.  Record the GATEWAY EUI information. click Save & Apply.

3. Log in to the ChirpStack server Enter the IP address and port, enter the user name and password, and click Login .

4. Add a LORAWAN gateway. Click Gateways and CREATE to enter the gateway EUI, which is the gateway EUI shown in the pictures below. 

5. Add an app Click Applications and click CREATE to add an app. 

6. Click Add Application, add device, click CREATE to add device name.

7. Device Description DEVEUI of device, select the corresponding frequency band, and click Add Device, as shown in picture below.  AU915 communication is not very stable, which may be related to the frequency band. It is recommended to disable the frame count verification function. 

8. Add APPKEY, enter APPKEY parameter in Application Key, and click SET device-keys.

9. Click DEVICE DATA to view the DATA.

10. DECODE Example

function Decode(fPort, bytes, variables) {

  var paramLength = bytes[2]/2;

  var params = new Object();

  for(var i=0;i<paramLength;i++)

  {

    params[“param”+i] = bytes[3+i*2]*256+bytes[4+i*2];

  }

  return params;

}

DECODER

function decodeUplink(input) {
var params = new Object();
params[“N”] = input.bytes[23]256+input.bytes[24]

params[“P”] = input.bytes[25]256+input.bytes[26]
params[“K”] = input.bytes[27]256+input.bytes[28]

params[“BAT”] = (input.bytes[29]256+input.bytes[30])/1000
return {
data: params
};
}

TTN Device Hardware options

Brand: stmicroelectronics Model: nucleo-wl55jc1 Hardware version: 1.0 Firmware version: 1.0

TTN Decoder

function decodeUplink(input) {
var params = new Object();
params[“N”] = input.bytes[23]256+input.bytes[24]
params[“P”] = input.bytes[25]256+input.bytes[26]
params[“K”] = input.bytes[27]256+input.bytes[28]
params[“BAT”] = (input.bytes[29]256+input.bytes[30])/1000
return {
data: params
};
}