[SOLVED] TTN - Lorawan - Payload

I’m using a wireless stick lite with the OTA code, sending data to HT-M02 Lorawan gateway register at TTN.

So when I look for the serial port I can see that the Join was done, and the acknowledge was received.
However the payload is “weird” at the TTN traffic is there any cryptography of the data?

I want to understand if the Appdata[] is inside this payload information.

Yes. Gateways only see encrypted data (remember it might not be your GW that sees the traffic), you need to route your traffic to a TTN Application and there you will see the decrypted data (in the TTN console, or if you send it on to an actual app then there as well)

1 Like

Hello @andrelmbraga1

if you are using the example sketch OTAA the content of the AppData will be

	AppData[0] =   'A';
        AppData[1] =   'B';
        AppData[2] =   'C';
        AppData[3] =   'D';
        AppData[4] =   '.';
        AppData[5] =   '3';
        AppData[6] =   '3';
        AppData[7] =   'C';
        AppData[8] =   'D';
        AppData[9] =   '0';
        AppData[10] =  'E';
        AppData[11] =  'F';
        AppData[12] =  '6';
        AppData[13] =  '5';
        AppData[14] =  '%';
        AppData[15] =  '4';

if you are using the sketch OTAA_DHT11 you will have to edit Lora.cpp and make following changes

  1. comment the lines from 71-90
  2. Remove the comments from the lines 91-105

Making the above change will help to send your temperature and humidity information to the TTN
@bwooce Do you have payload decoder for the sketch OTAA_DHT11?

@bwooce thanks ! I have created an app at TTN. I had also register my device on it.

I have change this following defines on Commissioning.h file

Blockquote
#define LORAWAN_APPLICATION_EUI
#define LORAWAN_APPLICATION_KEY
#define LORAWAN_NWKSKEY
#define LORAWAN_APPSKEY

Should I change the LORAWAN_NETWORK_ID ?

In the LoRaMac-definitions.h I have change the frequency as following:

Blockquote
//#define USE_BAND_868
#define USE_BAND_915

I can see that my device send some msg on the traffic, after creating an app I can see the data coming. However the data on the application side give me that:

“payload not provided”

I’m using the OTAA example. I have create a simple decoder as following:

Blockquote
function Decoder(bytes, Port)
{
var teste0 = bytes[0];
var teste1 = bytes[10];
var result={
“sensor”:{
“teste0”: teste0,
“teste1”: teste1,
}
}
return result;
}

As I’m sending this:

Blockquote
#elif defined( USE_BAND_915 ) || defined( USE_BAND_915_HYBRID )
AppData[0] = ‘1’;
AppData[1] = ‘2’;
AppData[2] = ‘3’;
AppData[3] = ‘4’;
AppData[4] = ‘5’;
AppData[5] = ‘6’;
AppData[6] = ‘7’;
AppData[7] = ‘8’;
AppData[8] = ‘9’;
AppData[9] = ‘0’;
AppData[10] = ‘a’;
#endif

I would like to see the ‘0’ and ‘a’ as output of the decoder. As you (@BDM) have tested this example, could you or anyone help me to find the source of my problem?

@andrelmbraga1

Not sure why the data is not shown. Please make sure that LORAWAN_DEVICE_ADDRESS in comminsioning.h is also changed.

Can you explain why? I understand that this will be done by the lib inside my node with the BoardUniqueId. Also, in OTAA I dont need to fill this information on TTN application. I just need to fill the LORAWAN_DEVICE_EUI

> /*!
>  Device address on the network (big endian)
>  *
>  * \remark In this application the value is automatically generated using
>  *         a pseudo random generator seeded with a value derived from
>  *         BoardUniqueId value if LORAWAN_DEVICE_ADDRESS is set to 0
>  */
> #define LORAWAN_DEVICE_ADDRESS                      ( uint32_t )0x26011713

Furthermore, the LORAWAN_DEVICE_EUI also do that, and I got the number at the traffic informations of the gateway. I did something wrong?

/*!
 * Mote device IEEE EUI (big endian)
 *
 * \remark In this application the value is automatically generated by calling
 *         BoardGetUniqueId function
 */
#define LORAWAN_DEVICE_EUI                          { IEEE_OUI,  0xD3, 0x51, 0xD5, 0x4C, 0xD7 }

@Supporter @BDM

@Saber could you help me ?