null

Indoor Temperature and Humidity Helium and Tago Tutorial

Sidebar

Indoor Temperature and Humidity Helium and Tago Tutorial

Posted by Parley Labs ,Nov 21st 2022
Indoor Temperature and Humidity Helium and Tago Tutorial

Adding Temperature & Humidity Sensor (LHT52) to the Helium Network

1. Register for a Helium Console Account

We will be using the Helium Network as our LoRaWAN network provider because of their large network coverage and low fee. You can check out more about them here.

In order to receive data from the Helium LoRaWAN network, we will create a Helium Console account here. Once you created the account and logged in, you will see the following page:

https://hackster.imgix.net/uploads/attachments/1445284/capture_34sbS0MB4j.JPG?auto=compress%2Cformat&w=740&h=555&fit=max

2. Adding Data Credit

Every new Helium Console account comes with 10,000 data credit which will provide about 2 months of data. However, if you want to add more, hover over the DC balance on the top right of your screen and click on "DC Balance" which will take you to the following screen. The minimum purchase with credit card is $10 which will give you plenty of data credit to use with the sensor.

https://hackster.imgix.net/uploads/attachments/1445290/capture_HdUXRnqYnI.JPG?auto=compress%2Cformat&w=740&h=555&fit=max

3. Adding Indoor Temperature & Humidity Sensorto the Helium Network

Select "Devices" on the left column, then "Add New Device". Enter a name for your device and populate the Dev EUI, APP EUI and App Key. Once completed, proceed to "Save Device".

https://hackster.imgix.net/uploads/attachments/1445305/capture_oZyK7kbyMe.JPG?auto=compress%2Cformat&w=740&h=555&fit=max

4. Adding Payload Decoder

Select "Functions" on the left column, then "Add New Function". Set all fields the same as seen below.

Copy and paste the following function into the custom script box.

function str_pad(byte){

var zero = '0';

var hex= byte.toString(16);

var tmp = 2-hex.length;

return zero.substr(0,tmp) + hex;

}

function Decoder(bytes, port) {

var decode = {};

if(port==2)

{

if(bytes.length==11)

{

decode.TempC_SHT=parseFloat(((bytes[0]<<24>>16 | bytes[1])/100).toFixed(2));

decode.Hum_SHT=parseFloat(((bytes[2]<<24>>16 | bytes[3])/10).toFixed(1));

decode.TempC_DS=parseFloat(((bytes[4]<<24>>16 | bytes[5])/100).toFixed(2));

decode.Ext=bytes[6];

decode.Systimestamp=(bytes[7]<<24 | bytes[8]<<16 | bytes[9]<<8 | bytes[10] );

return decode;

}

else

{

decode.Status="RPL data or sensor reset";

return decode;

}

}

if(port==3)

{

decode.Status="Data retrieved, your need to parse it by the application server";

return decode;

}

if(port==4)

{

decode.DS18B20_ID=str_pad(bytes[0])+str_pad(bytes[1])+str_pad(bytes[2])+str_pad(bytes[3])+str_pad(bytes[4])+str_pad(bytes[5])+str_pad(bytes[6])+str_pad(bytes[7]);

return decode;

}

if(port==5)

{

decode.Sensor_Model=bytes[0];

decode.Firmware_Version=str_pad((bytes[1]<<8)|bytes[2]);

decode.Freq_Band=bytes[3];

decode.Sub_Band=bytes[4];

decode.Bat_mV=bytes[5]<<8|bytes[6];

return decode;

}

}

 

Setting Up Tago.IO for Data Visualization

1. Register for a Tago.IO Account

In this guide, we will use Tago.IO to display all data coming from Helium. Register for a free account with Tago and once you are logged in, you will see the following screen.

https://hackster.imgix.net/uploads/attachments/1482115/capture_483Ocx0O1k.JPG?auto=compress%2Cformat&w=740&h=555&fit=max

2. Add New Device to Tago

Select "Devices" on the top left corner, then select "Add Device".

https://hackster.imgix.net/uploads/attachments/1482116/image_M5HgVeExpw.png?auto=compress%2Cformat&w=740&h=555&fit=max

Select "LoRaWAN Helium", then select "Custom Helium" as shown below.

https://hackster.imgix.net/uploads/attachments/1482117/image_8EFwscvKhi.png?auto=compress%2Cformat&w=740&h=555&fit=max

Once you selected "Custom Helium", the following screen will appear. Give your temperature and humidity sensor a name and set the "Data Storage Type" to "Device Data Optimized". For data retention, set your desirable timeframe that you want Tago to retain data. In this example, we will set it to one month. Fill in the EUI field with the Dev EUI. Once done, press "Create My Device",

https://hackster.imgix.net/uploads/attachments/1482118/capture_z9iIFMJprB.JPG?auto=compress%2Cformat&w=740&h=555&fit=max

3. Add Indoor Temperature and Humidity Sensors Dashboard to Tago

Use the following link to automatically install the temperature and humidity sensor dashboard to your Tago account. Select "Install Template" when prompted as shown below.

Select the device name that you added earlier from the drop-down menu. Select "Confirm associations" once you are done.

4. Adding Tago Authorization to Helium Console

At this point, you will see the newly created dashboard on your homepage. However, the dashboard should be empty since you have not gotten any data yet due to the fact that we have not link the Tago account to our Helium Console account. To do this, select your profile name on the top right corner, then select "My account"

https://hackster.imgix.net/uploads/attachments/1482121/image_OG9qxl90y7.png?auto=compress%2Cformat&w=740&h=555&fit=max

Select your profile name on the left, then click on "Token", set permission to "full", and to never expire, then "Generate Token". In order to copy your token, click on the copy symbol as show below.

https://hackster.imgix.net/uploads/attachments/1482122/image_TQpR2L6sTa.png?auto=compress%2Cformat&w=740&h=555&fit=max

Now log back into your Helium Console account, click on "Integrations" on the left column then add TagoIO.

https://hackster.imgix.net/uploads/attachments/1482123/image_3fgYWks6Qn.png?auto=compress%2Cformat&w=740&h=555&fit=max

Paste your newly created Tago token in the Step 2 box below.

https://hackster.imgix.net/uploads/attachments/1482124/capture_x6A9aMjQJh.JPG?auto=compress%2Cformat&w=740&h=555&fit=max

5. Flow Diagram

Finally, we are on the last step. This step will tie everything that we did previously together and allow you to see all data output on Tago.IO.

While in Helium Console, click on "Flows", then add the following items and connect them together. In our case, we will add the LHT52, LHT52 decoder function and the TagoIO authorization.

TagoIO Dashboard Visualization

Congratulation, you are now done! Go back to your Tago dashboard and see all the data fields getting populated as more data come through!

Sold out

The Dragino LHT52 Temperature & Humidity sensor is a Long Range LoRaWAN Sensor. It includes a built-in Temperature & Humidity sensor and has a USB Type-C sensor connector to connect to external sensors such as an External Temperature probe (AS-01), and a Program Converter (AS-02)