PCR2 LoRaWAN® Payload
This document describes PCR2 LoRaWAN® Payload V5 introduced with Firmware V4.0.
PCR2 devices send 3 payloads formats. Each payload has a unique prefix to easily separate them. In addition, different ports are used in each case.
Format | Prefix | Bytes | Port | Uplink | Downlink |
---|---|---|---|---|---|
DeviceID Payload V5 | be01xxd5 | 9 | 190 | after join | n/a |
AppData Payload V5 | be01xxa5 | 10 | 14 | interval | user |
Config Payload V5 | be01xxc5 | 6-7 | 1 | user | user |
DeviceID Payload (Port 190)
After PCR2 has successfully joined a LoRaWAN® network, a DeviceID payload is sent once via port 190.
The DeviceID payload contains device identification data. This can be useful in large installations to maintain a device inventory with information such as type and firmware version. If this is not needed, ignore this payload data.
Downlink to port 190 will be ignored.
Examples
DeviceID Payload | |
---|---|
be0105d50040014200 |
PCR2-ODS with firmware 4.0.1, solar unit firmware 4.2.0 |
be0101d50041020000 |
PCR2-IN with firmware 4.1.2, no solar unit installed |
Format
Byte | Property | Description | Uplink Values | Downlink Values |
---|---|---|---|---|
0 | VID | Vendor ID be for Parametric Devices |
be | n/a |
1 | DEV_FAM | Device Family 01 : PCR2 |
01 | n/a |
2 | DEV_TYPE | Device Type 00 : PCR2-IN 01 : PCR2-OD 04 : PCR2-XIO 05 : PCR2-ODS 06 : PCR2-ODA 07 : PCR2-ODB 08 : PCR2-ODBS |
00-08 | n/a |
3 | PAY_TYPE | d5 = DeviceID Payload V5 | d5 | n/a |
4 | FEAT | Enabled Features (Future use, ignore for now) |
00-ff | n/a |
5 | FW_VER | Firmware Major and Minor Version 41 => V4.1.x |
41 | n/a |
6 | FW_FIX | Firmware Bugfix Version 02 => Vx.x.2 |
00-ff | n/a |
7 | SBX_VER | Solar charger Major and Minor Version 42 => V4.2.x |
41 | n/a |
8 | SBX_FIX | Solar charger Bugfix Version 00 => Vx.x.0 |
00-ff | n/a |
Total lengths: 9 bytes (18 ASCII characters)
Port
Port used: 190
AppData Payload (Port 14)
Application data is sent at regular intervals or on detection (trigger mode).
To save airtime, the payload has been reduced to 10 bytes. This allows operation in all major LoRaWAN® regions such as EU868, AS923, AU915 and US915.
Examples
AppData Uplinks | |
---|---|
be0100a5000a000b0001 |
A PCR2-IN device has been counting 10 persons from the left and 11 from the right. Battery value is 0 because the device is not solar powered. This is message number 1. |
be0105a5000a000b4e10 |
A PCR2-ODS (solar powered) device has been counting 10 persons from the left and 11 from the right. Battery value is 7.8V. This is message number 16. |
AppData Downlinks | |
---|---|
be0100a5000000000000 |
Downlink this payload to port 14 in order to clear both counters (set to zero). |
be0100a503e807d00000 |
Downlink this payload to port 14 in order to set LTR counter to 1000 and RTL counter to 2000. |
Format
Byte | Property | Description | Uplink Values | Downlink Values |
---|---|---|---|---|
0 | VID | Vendor ID be for Parametric Devices |
be | be |
1 | DEV_FAM | Device Family 01 : PCR2 |
01 | 01 |
2 | DEV_TYPE | Device Type 00 : PCR2-IN 01 : PCR2-OD 04 : PCR2-XIO 05 : PCR2-ODS 06 : PCR2-ODA 07 : PCR2-ODB 08 : PCR2-ODBS |
00-08 | 00-08 |
3 | PAY_TYPE | a5 = AppData Payload V5 | a5 | a5 |
4-5 | LTR | Left-to-right interval counter value or total counts when sum up mode is active. | 0000-ffff | 0000-ffff |
6-7 | RTL | Right-to-right interval counter value or total counts when sum up mode is active. | 0000-ffff | 0000-ffff |
8 | SBX_BATT | Battery voltage (only available on solar powered variants) 0.0-25.5V |
00-ff | ignored |
9 | DCNT | Data Message Counter increases as soon as the device receives a confirmed uplink ACK, which means that the has been successfully sent to the server. In this case the device takes the next counter value pair with a new DCNT. Resets after message id 255 (ff) |
00-ff | ignored |
Total length: 10 bytes (20 ASCII characters)
Port
Port used for Uplink and Downlink: 14
Config Downlinks (Port 1)
Config downlinks are used to change application and radar settings in the field. Commands and arguments are sent to the device for this purpose.
Important: LoRaWAN® settings cannot be changed via downlink. This is to preventing to unlink the device by misconfiguration.
Communication takes place via port 1. As soon as the device receives a downlink, the arguments are parsed and range-checked. A confirmation uplink will be sent immediately.
V4.0.x: Changed settings need to be saved and applied with the
be0100c563ee
command. V4.1.x: Settings are applied as soon as downlink is received.
Typical Configuration Sequence
Following example shows a typical sequence to change only one setting.
DL: be 01 00 c5 02 00 0a <- change interval to 10 min
UL: be 01 00 c5 02 00 0a <- uplink showing the value has been accepted
DL: be 01 00 c5 ee <- send the save&restart command
.
JOIN <- device restarts and joins
.
UL: be 01 00 d5 04 00 00 <- DeviceID payload (port 190) after join accept received
.
Starting with firmware V4.0 we made it possible to change single settings rather than sending a 37 bytes long monster payload.
Examples
Config Downlink Sequence | |
---|---|
be0100c502000a be0100c50c5f be0105d5ee |
Change uplink interval to 10 min Set radar sensitivity to 95% Save and restart device (rejoins) |
Config Downlink Sequence | |
---|---|
be0100c5df be0100c5ee |
Apply factory defaults Save and restart device (rejoins) |
Commands
This table show a list of all available settings and commands you can use for Config Downlinks.
Write Command | Read Command | Setting | Description | Example |
---|---|---|---|---|
be0100c501xx |
be0100c501 |
mode | Set uplink mode 00 = Timespan 01 = NotZero 02 = Trigger 03 = CapAlert |
Set Timespan modebe0100c50100 |
be0100c502xxxx |
be0100c502 |
interval | Change uplink interval, 1...1440 min | Set Interval 10 minbe0100c502000a |
be0100c503xxxx |
be0100c503 |
holdoff | Set holdoff timer, 0...600s (0 = off) | Set holdoff to 1sbe0100c5030001 |
be0100c504xxxx |
be0100c504 |
caplim | Set capacity limit, 0...65535 PCR2-XIO only |
Set to 1000be0100c50403e8 |
be0100c505xxxx |
be0100c505 |
timeout | Set auto-zero timeout, 0...1440 min (0=off) | Set to 180 min (3h)be0100c50500b4 |
be0100c506xx |
be0100c506 |
sumup | Enable Sum Up Counter (1 = active, 0 = inactive) | Activate Sum Upbe0100c50601 |
be0100c510xx |
be0100c510 |
radar_enabled | Enable Radar Sensor (1 = active, 0 = inactive) | Activate Radarbe0100c51001 |
be0100c511xx |
be0100c511 |
radar_channel | Set Radar Channel, 1 or 2 | Activate Radar Channel 2be0100c51102 |
be0100c512xx |
be0100c512 |
radar_sens | Set Radar Sensitivity, 10...100% | Set Sensitivity to 90%be0100c5125a |
be0100c513xx |
be0100c513 |
radar_beam | Set Radar Beam Width, 30...80° | Set Beam to 80°be0100c51350 |
be0100c514xx |
be0100c514 |
radar_dir | Set Radar Beam Direction, -30...+30° | Set Beam to -10°be0100c514f6 |
be0100c515xxxx |
be0100c515 |
radar_mindist | Set minimal distance to target, 50...1000cm | Set to 1m (100cm) be0100c5150064 |
be0100c516xxxx |
be0100c516 |
radar_maxdist | Set max distance to target, 50...1000cm | Set to 5m (500cm) be0100c51601f4 |
be0100c517xx |
be0100c517 |
radar_autotune | Enable/Disable Autotuning (1 = active, 0 = inactive) | Enable Autotuningbe0100c51701 |
be0100c563xx |
be0100c563 |
lora_confirmed | Set uplink mode unconfirmed: 00 confirmed: 01 |
Disable confirmed uplinksbe0100c56300 |
be0100c563df |
- | Load Factory Defaults | be0100c5df |
|
be0100c563ee |
- | Save to ROM and restart | be0100c5ee |
Note: All changes need to be saved to ROM with the ee command in order to get active
Format
Byte | Property | Description | Uplink Values | Downlink Values |
---|---|---|---|---|
0 | VID | Vendor ID be for Parametric Devices |
be | be |
1 | DEV_FAM | Device Family 01 : PCR2 |
01 | 01 |
2 | DEV_TYPE | Device Type 00 : PCR2-IN 01 : PCR2-OD 04 : PCR2-XIO 05 : PCR2-ODS 06 : PCR2-ODA 07 : PCR2-ODB 08 : PCR2-ODBS |
00-08 | 00-08 |
3 | PAY_TYPE | c5 = Config Payload V5 | c5 | c5 |
4 | CMD | Command | 01-ee | 01-ee |
5-6 | ARG | Optional 8Bit or 16bit Arguments | - 00-ff* 0000-ffff |
- 00-ff* 0000-ffff |
Total lengths: 5-7 bytes (10-14 ASCII characters) depending on the command used
Port
Port used for Uplink and Downlink: 1
Best Practice
A few hints for implementing payload decoders. You can find code examples on our public repository
Check Prefix and Port
In order to stay backwards compatible with future developments we highly recommend checking uplink port and payload prefix to select an encoder
if ( port == 190 && byte[0] == 0xbe && byte[1] == 0x01 && byte[3] == 0xd5)
{
// decode PCR2 DeviceID Payload V5
}
if ( port == 14 && byte[0] == 0xbe && byte[1] == 0x01 && byte[3] == 0xa5)
{
// decode PCR2 Application Data Payload V5
}
if ( port == 1 && byte[0] == 0xbe && byte[1] == 0x01 && byte[3] == 0xc5) // PCR2 Config Payload (People)
{
// decode PCR2 Config Payload V5 (Acknowledged Config Change)
}
Check DCNT
A confirmed uplink message is a message where a LoRaWAN® endpoint (PCR2) is requesting the LoRaWAN® network to confirm the reception of its uplink message. If it receives a message within the first or second RX window, which ‘ACK’ flag set to 1, it will consider the original uplink message delivered.
If there is no message received, it means the network has not received the uplink. In this case PCR2 simply sends the uplink again and again (up to 10 times or according the attempts setting before doing a rejoin). Counting values are only reset when PCR2 received an ACK for not loosing data.
With firmware V4.0 we added a data message counter DCNT to the payload. This works like a serial number for the submitted data. Checking this value allows the application server to determine if the ACK has been received by the device or if a number is missing.
Example Uplink Sequence
Following sequence of uplinks show problems with RX path of the device. Uplinks have been received by the network. But the device did not hear the ACK.
be 01 00 d5 00 00 00 00 00 01 <- This is the first data message
be 01 00 d5 00 01 00 02 00 02 <- This is the second data message, with some counting values
be 01 00 d5 00 01 00 02 00 02 <- Repeated message, ACK has not been received by the device
be 01 00 d5 00 03 00 05 00 03 <- New data message, ACK has been received
Implementation of an algorithm
- App Server should save the last DCNT value received
- When a new uplink is received the decoder should check if DCNT changed. (Compare with save value)
- If changed, save the counting values to the database. If DCNT did not change, a repetition has been received that can be ignored.