- Ultrasonic Residential Smart Gas Meter LoRaWAN “Smartico G-1.6” telemetry upload
- Introduction
- Prerequisites
- Step 1. Creation UpLink Data Converters.
- Step 2. Integration configuration.
- Step 3. Verifying the receipt of data from the device.
- Step 4. Creation Pulse Sensor Asset.
- Step 5. Rule chain import and configuration.
- Step 6. Dashboard import and configuration.
- See also
- Your feedback
- Next steps
Ultrasonic Residential Smart Gas Meter LoRaWAN “Smartico G-1.6” telemetry upload
Introduction
Residential gas meters “Smartico” are produced by the size range G-1.6, G-2.5, G-4, G-6 and are used to measure the volume of used natural and liquefied gas, with conversion to standard reference at a temperature of 20 °C. The meter is made in a compact design, which has no moving mechanical parts and allows mounting in a confined space. The meter measurement system provides high-precision metrological characteristics. The meter provides the possibility visual control and wireless data transmission by license-free frequency range using LoRaWAN technology. The figure shows a dashboard with processed telemetry results.
Prerequisites
LoRaWAN technology is used to transfer data from the Gas Meter G-1.6 to the ThingsBoard platform. This is the wireless communication technology that allows small amounts of data to be exchanged over a long distance. First of all, you need to configure the LoRaWAN server and make sure that data from the device goes to the server. This guide uses ChirpStack open-source LoRaWAN Network Server. After finishing the server configuration on the Applications page, an entry with the device type should appear in the table.
For example, we connected a device with the serial number 12676. With the correct configuration of the LoRaWAN server, we should see the data flow from the device. The frequency of data transmission from the device depends on the Gas Meter settings.
To be able to receive data via the MQTT protocol, you need to integrate the LoRaWAN server and the Mosquitto MQTT broker.
Step 1. Creation UpLink Data Converters.
First, you should create the Uplink Data Converter according to the device protocol. The converter will decode incoming telemetry payload data from Ultrasonic Residential Smart Gas Meter LoRaWAN “Smartico G-1.6” that contains in encoded Base64 string to human readable, simplified ThingsBoard data format. Import uplink_gas_meter.json file with Uplink data converter.
Step 2. Integration configuration.
To integrate Ultrasonic Residential Smart Gas Meter LoRaWAN “Smartico G-1.6” into ThingsBoard platform you should create a new integration as shown on the figure.
Also below you should add the topic filter according to LoRaWAN server configuration (in this example application/1/device/+/rx
). In the Host and Port fields, enter the ip-address where the MQTT broker is installed and port for working with it.
Step 3. Verifying the receipt of data from the device.
Connect Gas Meter to transfer information. If the integration was performed without errors, after the transmission of the first telemetry, a new device with the name “012676” will appear in the DEVICE GROUPS → All. Also you can verify the input and output data, respectively, before and after conversion in DATA CONVERTERS → Uplink Gas Meter → EVENTS.
Input data from Gas Meter looks like this:
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
{
"applicationID": "1",
"applicationName": "Smartico_gas_meters",
"deviceName": "12676",
"devEUI": "02aaaa0200003184",
"rxInfo": [{
"gatewayID": "647fdafffe00d228",
"uplinkID": "bd949c88-fd1e-4c97-bbef-ad6412139d89",
"name": "Kona_micro_lite",
"rssi": -65,
"loRaSNR": 6,
"location": {
"latitude": 48.44229794818326,
"longitude": 35.014479160308845,
"altitude": 144
}
}],
"txInfo": {
"frequency": 868300000,
"dr": 0
},
"adr": true,
"fCnt": 742,
"fPort": 2,
"data": "BAwMAQAxhAAAA1YK4w=="
}
The payload is contained in the “data” field and encrypted in Base64. After decoding output data will look like this:
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
{
"deviceName": "12676",
"deviceType": "Gas Meter",
"attributes": {
"integrationName": "Gas Meter"
},
"telemetry": {
"gasMeter": 0.854,
"temperature": 27.87,
"REAL_TIME": "26.08.2020 15:02:39",
"SN": "12676",
"FLG_LOW_BAT": 0,
"FLG_MOTION_DETECT": 0,
"FLG_MAGNET_DETECT": 1,
"FLG_TAMPER_DETECT": 1,
"STS_VALVE": 0,
"FLG_ERR_OVR": 0,
"FLG_ERR_REVERSE": 0,
"FLG_ERR_SENSOR": 0,
"FLG_ERR_GAS": 1,
"FLG_ERR_TIME": 1,
"FLG_POWER_ON": 0,
"FLG_LOCK": 0,
"FLG_CFG_DONE": 0
}
}
The input and output data are for example purposes only and not related to the dashboard shown at the beginning of the guide. Before turning on the device, you can verify the functionality of programming code from uplink_gas_meter.json file. For this purpose, open the Test decoder function for Uplink Gas Meter in the DATA CONVERTERS and copy the input data from this guide into Payload content field. Press TEST button then in Output field should appear decoding output data as shown on the figure (the REAL_TIME field displays the current date and time).
Step 4. Creation Pulse Sensor Asset.
To be able to display data in the dashboard, you should first create an asset and add device 012685 in the RELATIONS, as shown in the figures.
Step 5. Rule chain import and configuration.
In addition to meter readings, it is possible to monitor the status of the device. For example, you can get information about a low battery, opening the device case, exposure to a magnetic field, and others. This information is displayed in the Alarm widget. Therefore, you should set up Rule chain first. Import alarms_gas_meter.json file with alarms and save the configuration of the Rule chain in ThingsBoard.
Then configure Root Rule chain. You should add in Root Rule chain Alarms Gas Meter as it shown on the figure.
Step 6. Dashboard import and configuration.
To display data to users, you need to create a dashboard that can be imported from the dashboard_gas_meter.json file.
When importing a dashboard, it will be necessary to create an alias, as shown in the figure.
If everything was done correctly, in DASHBOARD GROUPS → All you will see the new dashboard Ultrasonic Residential Smart Gas Meter LoRaWAN “Smartico G-1.6” that was provided at the beginning of the guide.
See also
Browse other samples or explore guides related to main ThingsBoard features:
- Device attributes - how to use device attributes.
- Telemetry data collection - how to collect telemetry data.
- Using RPC capabilities - how to send commands to/from devices.
- Rule Engine - how to use rule engine to analyze data from devices.
- Data Visualization - how to visualize collected data.
Your feedback
Don’t hesitate to star ThingsBoard on github to help us spread the word. If you have any questions about this sample - post it on the issues.
Next steps
-
Getting started guides - These guides provide quick overview of main ThingsBoard features. Designed to be completed in 15-30 minutes.
-
Connect your device - Learn how to connect devices based on your connectivity technology or solution.
-
Data visualization - These guides contain instructions on how to configure complex ThingsBoard dashboards.
-
Data processing & actions - Learn how to use ThingsBoard Rule Engine.
-
IoT Data analytics - Learn how to use rule engine to perform basic analytics tasks.
-
Advanced features - Learn about advanced ThingsBoard features.
-
Contribution and Development - Learn about contribution and development in ThingsBoard.