Abeeway Micro Tracker Helium and Tago Tutorial
Adding Abeeway Micro Tracker 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:
2. Adding Data Credits
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.
3. Adding Abeeway Micro Tracker to 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".
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 step_size (lo, hi, nbits, nresv) {
return 1.0/((((1 << nbits) -1) -nresv)/(hi -lo));
}
function mt_value_decode(value, lo, hi, nbits, nresv) {
return ((value -nresv /2) * step_size(lo, hi, nbits , nresv) + lo);
}
function Decoder(bytes, port) {
var msg_type = bytes[0];
var decoded_frame ={};
switch (msg_type) {
case 0x03:
decoded_frame.message_type = "POSITION";
decoded_frame.mode = ((1 << 3) - 1) & (bytes[1] >> 5);
decoded_frame.battery = bytes[2];
decoded_frame.temperature = Math.round(100*mt_value_decode(bytes[3],-44,85,8,0))/100;
decoded_frame.ack = (bytes[4] >> 4) & ((1 << 4)-1);
position_type = bytes[4] & ((1 << 4) - 1);
switch (position_type) {
case 0x00:
decoded_frame.position_type = "GPS fix";
decoded_frame.age = mt_value_decode(bytes[5], 0, 2040, 8, 0);
lat_raw = ((bytes[6] << 8|bytes[7]) << 8| bytes[8]) << 8;
if (lat_raw > 2147483647) {
lat_raw = lat_raw - 268435456;
}
decoded_frame.lat= lat_raw/10000000;
lng_raw= ((bytes[9] << 8|bytes[10]) << 8| bytes[11]) << 8;
if (lng_raw > 2147483647) {
lng_raw = lng_raw - 268435456;
}
decoded_frame.lng = lng_raw/10000000;
decoded_frame.accuracy = Math.round(100*mt_value_decode(bytes[12], 0, 1000, 8, 0))/100;
break;
}
break;
case 0x04:
decoded_frame.message_type = "ENERGY STATUS";
decoded_frame.mode = ((1 << 3) - 1) & (bytes[1]>>5);
decoded_frame.battery = bytes[2];
decoded_frame.temperature = Math.round(100* mt_value_decode(bytes[3], -44, 85, 8, 2)) / 100;
decoded_frame.ack = (bytes[4] >> 4) & ((1 << 4)-1);
break;
case 0x05:
decoded_frame.message_type = "HEARTBEAT";
decoded_frame.mode = ((1 << 3) - 1) & (bytes[1]>>5);
decoded_frame.battery = bytes[2];
decoded_frame.temperature = Math.round(100* mt_value_decode(bytes[3], -44, 85, 8, 2)) / 100;
decoded_frame.ack = (bytes[4] >> 4) & ((1 << 4)-1);
decoded_frame.cause = bytes[5];
break;
case 0x0A:
decoded_frame.message_type = "EVENT";
decoded_frame.mode = ((1 << 3) - 1) & (bytes[1]>>5);
decoded_frame.battery = bytes[2];
decoded_frame.temperature = Math.round(100* mt_value_decode(bytes[3], -44, 85, 8, 2)) / 100;
decoded_frame.ack = (bytes[4] >> 4) & ((1 << 4)-1);
switch (bytes[5]) {
case 0x00:
decoded_frame.event_value = "geolocation_start";
break;
case 0x01:
decoded_frame.event_value = "motion_start";
break;
case 0x02:
decoded_frame.event_value = "motion_end";
break;
case 0x03:
decoded_frame.event_value = "BLE connected";
break;
case 0x04:
decoded_frame.event_value = "BLE disconnected";
break;
case 0x05:
decoded_frame.event_value = "temperature_information";
break;
case 0x06:
decoded_frame.event_value = "BLE_bond_deleted";
break;
case 0x07:
decoded_frame.event_value = "SOS_start";
break;
case 0x08:
decoded_frame.event_value = "SOS_stop";
break;
case 0x09:
decoded_frame.event_value = "angle_detection";
break;
case 0x0A:
decoded_frame.event_value = "BLE_geozoning";
break;
}
break;
}
return decoded_frame;
}
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.
2. Add New Device to Tago
Select "Devices" on the top left corner, then select "Add Device".
Select "LoRaWAN Helium", then select "Custom Helium" as shown below.
Once you selected "Custom Helium", the following screen will appear. Give your Abeeway micro tracker 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",
3. Add Abeeway Micro Tracker Dashboard to Tago
Use the following link to automatically install the Abeeway 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"
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.
Now log back into your Helium Console account, click on "Integrations" on the left column then add TagoIO.
Paste your newly created Tago token in the Step 2 box below.
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 Abeeway tracker, Abeeway 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!