Thanks for your interest.
It’s kind of a big topic. For integrating the sensor, you can check, for example, the sketches in Catena-Sketches, for example
catena4612-simple. If the sensor is simple, you have to grab the data at the right time. If the sensor is complex (requires a lot of attention) you have to do a little more work in your loop() routine.
As for uplink formats, you need the following:
- a description – this is critical, you’ll waste lots of time if you don’t do this
- a test vector generator – something to generate sample messages to test your decoder
- scipts foryour target data handling system – I tend to use NodeRED as part of our docker-iot-dashboard.
I suggest you start by reviewing the document catena-message-port1-format-22.md in the mcci-catena-4430 repo.
You’ll find useful starting points for all of these things.
.mdfile was written as my referenence (hint: I filled in the answers for the test vectors later, and I started with a previous example).
catena-message-port2-format-22-decoder-ttn.js. Again, I started with a previous example.
- Next, I adapted the test vector generator
catena-message-port2-format-22-test.cpp from a previous example. I got it to compile and tested manually.
- Then I wrote a test-vector input file
catena-message-port2-format-22.vec. I fed it into the test vector generator.
- I copied the
.js file into an application on the TTN console. (I used V2, but you can also do this on V3.) I then cut/paste the output from the test vector generator into the test input box of the TTN console. I examined the output, compared to the input; and if the JSON output looked right, I copied this back to the test vectors in the
- Finally, I updated the code in the sketch to output the new format. By this point, I was so familiar with the new format, that this was easy.
- Run the sketch, send data to TTN and check that the decoder decodes your data correctly.
After this, you still may need to do additional work, depending on your app. I also:
- build a Node-RED decoder – this just calls the TTN decoder. Since TTN decoder scripts are uncontrolled, I prefer to re-decode the data in my application. See
- create a Node-RED function to prepare my data for InfluxDB. Again, I’m always in a hurry so I end up cutting/pasting from a prevous app. See
- Incidentally, I find it useful to put device performance data into yet another database in my app. See
influxdb-prep-rf.js for an example.
Hope this helps!