Paige Niedringhaus
Published © LGPL

Low Code GPS Asset Tracker and Map Display

Build a GPS-enabled tracker with just a few lines of code to a Blues Wireless Notecarrier, and visualize it with IoT platform Datacake.

BeginnerFull instructions provided2 hours4,947
Low Code GPS Asset Tracker and Map Display

Things used in this project

Hardware components

Blues Wireless Feather Starter Kit for ESP32
Blues Wireless Feather Starter Kit for ESP32
×1
Adafruit Lithium Ion Polymer Battery - 3.7v 2500mAh
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1
USB-C to USB-A Adapter
×1

Software apps and online services

Blues Notehub.io
Blues Notehub.io
Datacake

Story

Read more

Code

Notecard Asset Tracking JSON Configuration Code

JSON
This is the code to configure a Notecard to work as an asset tracker in a Notecarrier-AF development board. Enter each line of JSON separately into the in-browser REPL available at https://dev.blues.io while a Notecard is attached to the computer via a micro-USB connector.
{"req":"card.restore","delete":true}
# response {}

{"req":"hub.set","mode":"periodic","product":"[YOUR_PRODUCT_UID_HERE]","outbound":60,"inbound":720}
# response {}

{"req":"card.location.mode","seconds":3600,"mode":"periodic"}
# response {"seconds":3600,"mode":"periodic"}

{"req":"card.location.track","start":true,"heartbeat":true",hours":12}
# response {"start":true,"hours":12,"heartbeat":true}

Datacake HTTP Decoder Code

JavaScript
This code goes into the HTTP Decoder under the Configurations Tab in a Datacake workspace.
function Decoder(request) {
   var data = JSON.parse(request.body);
   var device = data.device; // this is your Device UID

   var decoded = {};
   decoded.temp = data.body.temperature;
   if(data.body.motion){
    decoded.motion = data.body.motion; 
   } else {
    decoded.motion = 0;
   }
   decoded.location = "(" + data.where_lat + "," + data.where_lon + ")";
   decoded.time = data.when;

   return [
      {
            device: device,
            field: "TEMP",
            value: decoded.temp
      },
      {
            device: device,
            field: "MOTION",
            value: decoded.motion
      },
      {
            device: device,
            field: "LOCATION",
            value: decoded.location
      },
      {
            device: device,
            field: "TIME",
            value: decoded.time
      }
   ];
}

Credits

Paige Niedringhaus

Paige Niedringhaus

8 projects • 38 followers
Staff Software Engineer @ Blues Wireless. In tech since 2016, but new to IoT and eager to learn.

Comments