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:
- Register with ThingSpeak and find 'Create new Channel' to process the data. Their instructions are very good and it's dead easy!
- 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:
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.