Decode data at TTN

It is not possible to read directly from the data received where it comes from or what the temperature was at that location. The data must first be decoded.

 

To do this, the Payload formatters item must be selected on the left-hand side of the TTN application.

We then select the UPLINK item, as we want to decode the data that we receive.

 

 

The data packet from the Raspberry Pi Pico (H) was converted into a string variable (character) for sending. In order to generate a decimal number from the transmitted data stream, we have to convert the characters from the individual data bytes back into decimal numbers.

We can now program the decoder by comparing the transmitted data and the data received in the TTN.

Transmitted data:

Received data:

 

Comparison:

 

A possible decoding can now be carried out with the aid of an ASCII table.

A 32 in hexadecimal notation is a 50 in decimal notation.

To get from 50 to 2, we now subtract 48.

Using this procedure, we now process all bytes of the received data packet.

Furthermore, we divide the data packet back into the previously known structure

on.

 

 

vetskilling_TTN_decoder.zip

Using the decoder

In order to read the received data in TTN directly, we can also use the decoder directly within the TTN application.

To do this, we copy the created decoder ...

 

and add it to the application

in the Formatter code field.

 

To test it, we can insert the byte stream we have received and test the decoder.

 

Congratulations - your weather station is ready and is sending data to TheThingsNetwork!

 

In further tutorials we will show you how to retrieve the data from there and process it graphically!