This article gives some examples of how to decode data from the SensorNode LoRaWAN.

Temperature Readings

Consider this example data from an Actility LoRaWAN backend:

POST //SaveData.ashx?LrnDevEui=70B3D57050000DC4&LrnFPort=41&LrnInfos=TWA_100006667.21976.AS-1-1637 HTTP/1.1

Content-Length: 630

Content-Type: application/json

Accept: */*

Host: XXXX



{"DevEUI_uplink": {"Time": "2018-06-04T15:17:23.433+02:00","DevEUI": "70B3D57050000DC4","FPort": 41,"FCntUp": 598,"MType": 2,"FCntDn": 83,"payload_hex": "5f052afb0528e005","mic_hex": "c83d51cd","Lrcid": "00002F01","LrrRSSI": -114.000000,"LrrSNR": -14.000000,"SpFact": 12,"SubBand": "G2","Channel": "LC7","DevLrrCnt": 1,"Lrrid": "FF010D29","Late": 0,"LrrLAT": -26.076149,"LrrLON": 27.925920,"Lrrs": {"Lrr": [{"Lrrid": "FF010D29","Chain": 0,"LrrRSSI": -114.000000,"LrrSNR": -14.000000,"LrrESP": -128.169540}]},"CustomerID": "100006667","CustomerData": {"alr":{"pro":"LORA/Generic","ver":"1"}},"ModelCfg": "0","DevAddr": "5ECDC81A"}}

We interpret this message according to the specification here. The data is uploaded in ID/Value pairs. The first ID is given by the LoRaWAN Port. The ID determines the length and datatype of the value bytes.

Using the example above:

  • FPort = 41: this gives us the first ID (I2C temperature probe 1 (red)).  This implies the value is INT16 (2 bytes) x 100 degC.
  • 0x5f05 = the 1st 4 bytes of payload. INT16 x 100 degC. Litte endian, so remember to switch byte order. 0x055f = 1375 => 13.75 deg C
  • 0x2a = 41. This is the next ID. This is I2C temperature probe 2 (blue)). This implies the value is INT16 (2 bytes) x 100 degC.
  • 0xfb05 = next 4 bytes of payload. 0x5fb = 1531 => 15.31 deg C
  • 0x28 = 40. This is next ID. This is internal temperature. INT16 (2 bytes) x 100 degC.
  • 0xe005 = next 4 bytes of payload. 0x5e0 = 1505 => 15.04 deg C
  • No more payload bytes. We're finish.