Tiny Frame decoding

Everything about programming the platform and using the Waspmote API
Post Reply
element
Posts: 8
Joined: Sun May 26, 2019 7:24 am
Company: ELEMENT

Tiny Frame decoding

Post by element » Wed Sep 11, 2019 1:28 pm

Hello, I try to understand the tiny frame decoding but I dont understand the guide seems incomplete.

I receive the following frame:

Code: Select all

-------------------------------
-             LOOP            -
-------------------------------
- Battery Level:86
- RTC current time: Sun, 00/02/05, 14:55:16
- Watchdog will trigger when Alarm matches [Date, hh:mm] --> [05, 15:55]
- Sensor reading: 
  SOCKET_A --> Current: 4.71 mA
- Frame buffer: 3C3D3E061828433F057C10540F4D595F4D4F544523213456AFB1C59640
- Frame length: 29
- LoRaWAN switch ON OK
- LoRaWAN join network OK
- LoRaWAN maximum payload: 51
- Tiny frame generated:21093456AFB1C59640
- LoRaWAN unconfirmed sending...
- LoRaWAN send packet OK
- LoRaWAN switch OFF OK
- RTC current time: Sun, 00/02/05, 14:55:29
- RTC will trigger after (dd:hh:mm:ss): 00:00:02:00
- Go to deep sleep mode...
Frame to decode: 21093456AFB1C59640
Guide says:
Byte 1: Frame sequence: 21
Byte 2: frame length:09
Then ?

I have only one socket defined from the binary code generator (PCS)
I need to get the value: 4.71 mA from 4-20mA Loop on socket_A

Regards,

element
Posts: 8
Joined: Sun May 26, 2019 7:24 am
Company: ELEMENT

Re: Tiny Frame decoding

Post by element » Wed Sep 11, 2019 2:20 pm

Ok I discover that the first sensor is always the battery so with the following tiny frame:
# PAYLOAD: 13093455aff8df7f41
# Byte 0 : 13 : Frame sequence
# Byte 1 : 09 : Frame length
# Byte 23 : 3455 : SENSOR_BAT_ID (34=52): 85 (%)
# Byte 4: AF = 175 in DEC -> SENSOR_4_20_SOCKET_A
Then I did not suceed to get my 4-20mA Loop value, I should have 4.71mA (with f8 df 7f 41)

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: Tiny Frame decoding

Post by libelium-dev » Wed Sep 11, 2019 2:36 pm

Hi,

We show bellow the frame decoded

21 - Sequence
09 - Lenght
34 = 52 - Battery ID - uint8_t - 1 byte
56 = 86% battery level
AF = 175 - Current(P&S! SOCKET A) ID - float - 4 bytes
B1C59640 = 4.7116322517 mA

We have used this code to convert from hex to float

Code: Select all

void setup()
{
  uint8_t l[] = {0xb1, 0xc5, 0x96, 0x40};
  float var1;
  memcpy(&var1, l, 4);
  USB.println(var1);
}

void loop()
{
}
Regards

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest