Stand with Ukraine flag
Pricing Try it now
Professional Edition
How to connect LRS20100 LoRaWAN Temperature and Humidity Sensor to ThingsBoard?
Getting Started Documentation Devices Library Guides Installation Architecture API FAQ
On this page

How to connect LRS20100 LoRaWAN Temperature and Humidity Sensor to ThingsBoard?

Introduction

LRS20100 LoRa Ambient Temperature and Humidity Sensor LRS20100 LoRa Ambient Temperature and Humidity Sensor is a high-performance, multi-parameter sensor designed to monitor and report on essential indoor environmental conditions. Ideal for offices, classrooms, hospitals, and public spaces, it provides a comprehensive overview of air quality to support comfortable and healthier indoor environments.

It combines advanced sensing, flexible power options, and long-range wireless communication in compact form-factor.


Key features

  • Multi-sensor monitoring measures temperature, humidity, Carbon Dioxide (CO2), Total Volatile Organic Compounds (TVOC), Particulate Matter (PM1.0, PM2.5, PM10).
  • LoRaWAN connectivity:
    • Long-range, low-power wireless communication.
    • Ideal for smart buildings and IoT integrations.
  • Excellent platform compatibility:
    • Works well with major LoRaWAN network servers and platforms like ThingsBoard, ChirpStack, The Things Stack and LORIOT.
  • Colour LED air quality indicator provides instant visual feedback on air quality level and enables quick assessment without a dashboard.
  • Flexible power options support batteries or DC power supply.

Prerequisites

To continue with this guide, we will need the following:

Add device to the network server

LRS10701 uses LoRaWAN technology to send data to the ThingsBoard platform. To start with, you need to configure the LoRaWAN gateway and network server and make sure the data from the sensor can reach the network server. This guide uses ChirpStack open-source LoRaWAN Network Server.

In this guide, we are using a sensor configured as OTAA as an example. To add a device to the network server, you need to the following information:

  • Device EUI
  • Application EUI
  • Application Key

The information is provided on the purchase of the sensor. Contact your sales or distributor for the information if needed.

First, you need to add your device to ChirpStack:

  • Login to the network server.

  • Go to the “Device profiles” and click “Add device profile”.

  • Input the parameters on the Device Profile page and click Save. For Profile name, input ‘LRS10701-OTAA’ or ‘LRS10701-ABP’ depending on the sensor activation mode configured. It will be used on the data converter to determine the sensor model.

  • Make sure the Payload codec under Codec for the Device Profiles is selected as “None”.

  • Go to Applications, select an existing application or Add application.

  • Click Add device to add the new device.

  • Input the sensor information and click Submit to add the sensor.

  • It will then jump to the OTAA keys page. Input the Application Key of the sensor and click Submit.

Create device on ThingsBoard

Follow the guide on this page to create ChirpStack integration on our Thingsboard account and configure integration on your ChirpStack application.

Import the JSON file SENSO8_data_converter_for_chirpstack_integration.json or copy the codes below for the payloadDecoder function.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
var deviceType = metadata.deviceProfileName; 
var fPort = metadata.fPort;

/**
Decodes the incoming payload and returns a structured object containing telemetry data and attributes.

@param {byte[]} input - The raw payload received as an array of bytes.
@returns {Object} output - The structured output with decoded telemetry and attributes.

*/

function decodePayload(input) {
 // Initialize the output object with empty attributes and telemetry for clarity. 
 var result = { attributes: {}, telemetry: {}};

 // Decode serial number (SN) from the first 4 bytes of the payload.
  // Press '?' icon in the top right corner to learn more about built in helper functions and capabilities.
  result.attributes.sn = parseBytesToInt(input, 0, 4);

  // Extract the timestamp from metadata (represented in milliseconds).
  var timestamp = metadata.ts; // ts is the timestamp parsed from the incoming message's time, or returns the current time if it cannot be parsed.

  // Initialize an object to store decoded key/value telemetry data.
  var values = {};
  if ((deviceType === 'LRS10701-OTAA') || (deviceType === 'LRS10701-ABP')) {
    if (fPort === 10) {
        // Decode event from the 1st byte of the payload.
        values.event = parseBytesToInt(input, 0, 1);

        // Decode AQI, CO2 and temperature from the 2nd to 5th byte of the payload.
        var AQI_CO2_T = parseBytesToInt(input, 1, 4);
        values.aqi = AQI_CO2_T >> 23;
        values.co2 = (AQI_CO2_T >> 10)&0x1FFF;
        values.temperature = ((AQI_CO2_T & 0x3FF) - 300)*0.1;

        // Decode humidity from the 6th byte of the payload.
        values.humidity = parseBytesToInt(input, 5, 1)*0.5;

        // Decode battery level and EC sensor resolution from the 11th byte of the payload.
        var ecr_bat = parseBytesToInt(input, 10, 1);
        var ec_res = ecr_bat >> 7;
        if (ec_res === 1) 
            ec_scale = 10;
        else
            ec_scale = 1000;
        values.battery = ecr_bat & 0x7F;
        
        // Decode gas sensor readings from the 7th to 8th and 9th to 10th byte of the payload.    
        values.gas1 = parseBytesToInt(input, 6, 2)/ec_scale;
        values.gas2 = parseBytesToInt(input, 8, 2)/ec_scale;
      } else if (fPort === 11) {
        // Decode TVOC from the 1st and 2nd byte of the payload.
        values.tvoc = parseBytesToInt(input, 0, 2);
        // Decode PM1.0 from the 3rd to 5th byte of the payload.
        values["pm1.0"] = parseBytesToInt(input, 2, 3)/1000;
        // Decode PM2.5 from the 6th to 8th byte of the payload.
        values["pm2.5"] = parseBytesToInt(input, 5, 3)/1000;
        // Decode PM10 from the 8th to 11th byte of the payload.
        values.pm10 = parseBytesToInt(input, 8, 3)/1000;
      }
  }

  if ((deviceType === 'LRS20100-OTAA') || (deviceType === 'LRS20100-ABP')) {
    if (fPort === 10 && parseBytesToInt(input, 0, 1) === 1) {
        // Decode event from the 2nd byte of the payload.
        values.event = parseBytesToInt(input, 1, 1);

        // Decode temperature from the 4th and 5th byte of the payload.
        var temperature = parseBytesToInt(input, 3, 2);
        if (temperature > 32767) 
            temperature = temperature - 65536;
        values.temperature = temperature/10;

        // Decode humidity from the 6th and 7th byte of the payload.
        values.humidity = parseBytesToInt(input, 5, 2)/10;

        // Decode battery level the 3rd byte of the payload.
        values.battery = parseBytesToInt(input, 2, 1);
    }        
  }

  // Combine the timestamp with values and add it to the telemetry.
  result.telemetry = {
    ts: timestamp,
    values: values
  };

  // Return the fully constructed output object.
  return result;
 
}

var result = decodePayload(payload); 

return result;

And for advance decoding parameters, please refer to the screenshot below.

image

After the device has been added to ChirpStack and integration has been setup on both ThingsBoard and ChirpStack, a new device will appear on the ThingBoard user interface when the device sends any data.

Check data on ThingsBoard

To check the received data, you can go to Devices page under the Entitles. Then select the newly created device from the Device list.

image

The received data can be reviewed on Attributes and Latest telemetry pages.

image

ThingsBoard provides a more user-friendly way to visualize your data with dashboards.

ThingsBoard allows you to create and customize your own dashboard to suit your needs.

If you want to experience the dashboard quickly, you can download this file and import it to your ThingsBoard to get a glimpse of the dashboard experience.

To import the dashboard, follow these steps:

  • Go to the “Dashboards” page, click the + button in the upper right corner of the page.

  • Select “Import dashboard” from the drop-down menu.

  • Select the download file or drag the file to the dialog box and click “Import”.

  • After importing the dashboard, it will go back to the dashboards list, click to select and open the imported dashboard.

  • Click Edit mode to update the dashboard.

  • Hover over a widget to reveal controls in the upper-right, then click the pencil icon to edit.

  • A dialog will pop up for entering the widget properties. Click Device under Datasource to select the device to be monitored. Then click Apply.

  • Repeat the previous steps for other widgets. Lastly, click Save to store the changes and the dashboard is then ready for monitoring the new device.

Conclusion

With the knowledge outlined in this guide, you can easily connect your LRS10701 LoRaWAN IAQ sensor and visualize the data on ThingsBoard.

Explore the platform documentation to learn more about the key concepts and features of ThingsBoard for configuring alarm rules or dashboards.