Many users ask about how the payload in ADRadioNet is organized. The PC tool ANODE CENTER POINT is the best place to start with to understand this. The [Start] tab in the ANodeCenterPoint tool displays the total packets received in byte streams format, as shown in the following snapshot. This consists of - Link layer header, Message header & Payload (Sensor Data + Local statistics).
The port number (byte #25-#26 in the message header) is used to differentiate between network & data. Users can define their own unused port numbers in the source code to communicate with other device. Please note that the payload starts from 27th byte on wards in the data stream.
Packet format at MAC layer
SRD_BUFFER_SIZE (128 Bytes Max.) |
|||
LLH_LEN (9 Bytes) |
MB_MSGHEADLEN (17 Bytes) |
Payload(102 Bytes) |
|
|
|
Data (66 Bytes) |
Local statistics (36 Bytes) Added if Local Statistics are enabled to send |
The Data field of the payload in the above packet format contains:
- Sensor Packet => Sensor information
- Registration Packet => Configuration parameters
- Heartbeat Packet => No Data
The following explains how the ADRadioNet protocol encapsulates different types of data, like sensor data (66 bytes) and statistics (36 bytes). Put together with link layer header (9 bytes) message header length (17 bytes), the total size is 128 bytes. However, when this has to be sent over UART to the PC, additional headers get added taking the requirement to 134 bytes as shown below. Needless to say, the useful sensor data in this example is 66 bytes. The additional data bytes are dedicated for displaying useful statistics information (36 bytes).
As shown above the payload comprising of sensor data along with statistics information (corresponding to a specific sensor mote) is encapsulated with required headers and is sent over the UART. This is deciphered on the PC side to show the results on the ANodeCenterPoint tool. Please note that in the example shown above the sensors are organized in a pre-defined manner. It is up to the user to define this order or make a new schema to decipher information based on the requirement.
The example UART sensor information packet received at the ANodeCenterPoint tool from CP is given below.
Each and every component in the payload is associated with a mark byte to define the length and type of the variable as shown below.
Mark Tag |
Value in Hex |
Length in bytes |
STR_MARK(string ) |
0x73 |
1 byte length+(1*string length) + 1 byte NULL |
LONG_MARK |
0x6C |
4 |
SINGLE_MARK |
0x66 |
4 |
INT_MARK |
0x69 |
2 |
BYTE_MARK |
0x63 |
1 |
BYTEARY_MARK |
0x61 |
1 byte length +(1* size of array) |
An example sensor information captured by the ANodeCenterPoint tool is shown as below
- AD7151 => Proximity Sensor
- SHT21 => Sensirion Temperature & Humidity Sensor
- ADXL362 => Accelerometer
The sensor data is followed by statistics. The sensor data is highlighted in different colors above.
Yellow => LED Information (LED5 and LED6 are ON)
Turquoise => SHT21 (Temperature and Humidity)
Dark Green => Proximity turquoise
Grey Color => Accelerometer (X, Y and Z axis)
Hope this helps.
This FAQ was generated from the following discussion: How the payload in ADRadioNet protocol is encoded