sending pysense accelerometer data to TTN
-
Hi
I have been able to do OTAA join to TTN and also able to print accelerometer data to the local machine. How can I send this data to TTN ?
-
@robert-hh but i dont see the mqtt integration in my console ?
-
@abhishek2101 Not in TTN. the idea is that you define an integration with the application, which deals with the data. The only thing I did was sending data to Cayenne. But you can also define your own service for the data.
-
@abhishek2101 any idea how can i unpack the values in TTN ?
-
@abhishek2101 No difference. The sign is part of the binary represenration.
-
@robert-hh how about the negative values ?
-
@abhishek2101 For instanve using the struct module. Example.
import struct value = 1.234 buffer = struct.pack("<f", value)
More information at https://docs.python.org/3.5/library/struct.html
Note, that micropython does not support all options, but all important ones.
-
@dan do we need to convert data into bytes before sending to TTN ? if yes how do we convert float data ?
-
@abhishek2101 TTN is just the transport vehicle. You have to register an integration at your TTN application to receive the data. For a first test, Cayenne can be used. They support various types of sensors.
-
@abhishek2101 Hi, you can find examples for LoRa in our docs. You can see how to send data with LoRaWAN and OTAA on this page.
Have you tried
s.send(li.acceleration())
? (this is after you've set up a LoRa socket)