IOT: Integration to the Cloud

A project log for Intelligent Bat Detector

Bat species are auto detected 'in the wild' using machine learning with results transmitted to the cloud

Tegwyn☠TwmffatTegwyn☠Twmffat 02/14/2020 at 13:580 Comments
Following the Adafruit tutorial to connect to The Things Network (TTN). This will get data through a local gateway if one is in range, but will not store the data or produce fancy graphs:

First step accomplished: Get data to the TTN!

Next, create a Payload Format:

function Decoder(bytes, port) {
  // Decode an uplink message from a buffer
  // (array) of bytes to an object of fields.
  var decoded = {};

  //if (port === 1)  decoded.temp = (bytes[1] + bytes[0] * 256)/100;
  if (port === 1)  decoded.field1 = (bytes[1] + bytes[0] * 256)/100;
  //if (port === 1)  decoded.humid = (bytes[3] + bytes[2] * 256)/100;
  if (port === 1)  decoded.field2 = (bytes[3] + bytes[2] * 256)/100;
  //if (port === 1)  decoded.batSpecies = (bytes[5] + bytes[4] * 256);
  if (port === 1)  decoded.field3 = (bytes[5] + bytes[4] * 256);
  return decoded;

The data stream will now look like this:

  1. Register with ThingSpeak and find 'Create new Channel' to process the data. Their instructions are very good and it's dead easy!
  2. Go back to TTN and find the 'Integrations' tab and add ThingSpeak with the appropriate channel ID and write API key from the new ThingSpeak channnel.

Time to render some pretty graphs: