A small demo project, part of a much bigger effort, based on WisBlock RAK4631 (nRF52840 + SX1262), RAK1901 (Sensirion SHTC3 Temperature and Humidity Sensor) and RAK12010 (VEML7700 Light Sensor).
I reads periodically datapoints from the two sensors, encodes them as 6 bytes, and sends them to the nearest gateway. The data is (hopefully) forwarded to TTN, from where any number of post-processing can happen – in my case, webhooks send the decoded frame back to a server, hosted on a Raspberry Pi 3B+ with custom Python code that parses the data, saves it in an sqlite3 database, and CSV files for display in a dashboard. Then it goes back to sleep for #define OTAA_PERIOD (900000)
, ie 900 seconds – 15 minutes.
But that's just me – you do you! :-)
Because this is an experiment, I bypassed CayenneLPP and used a very crude encoding format – at the expense of having more code on the server to recognize what the data is (I have other nodes sending different datapoints): in a more formal implementation, it would be better to have just one script parsing Cayenne data, and only one webhook. Also there's no checksum, which is probably not ideal. This'll come in time.
A Secret.h
file is required, with the following content:
#define OTAA_DEVEUI {0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX}
#define OTAA_APPEUI {0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX}
#define OTAA_APPKEY {0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX}
These are the keys required by TTN to accept your device on the network. Use your own :-)