Keep-alive
The keep-alive is a periodic message sent by the CO2 Display with sensor data and more. In this page you will learn how to decode keepalive messages and how to set the keepalive interval.
Keep-alive decoding
Periodically sent message which contains the most important device data.
The data is described in Table 3. In Table 4 example packet is given.
Byte | Bit Index | Value | Meaning |
---|---|---|---|
0 | - | 01 | Command byte for this packet. |
1 | - | XX | Internal temperature sensor data, bits 15:8 – T[15:8]. |
2 | - | XX | Internal temperature sensor data, bits 7:0 - T[7:0]. t [°C] = (T[15:0] - 400) / 10 |
3 | - | XX | Relative Humidity data; RH [%] = (XX * 100) / 256 |
4 | - | XX | Device battery voltage data, bits 15:8. |
5 | - | XX | Device battery voltage data, bits 7:0. Battery voltage, [mV]. |
6 | - | XX | CO2 value in ppm, bits 7:0. |
7 | 7:3 | - | CO2 value in ppm, bits 12:8. |
2:0 | - | Power source status. Тhe device is powered by: 000 - Built-in photovoltaic panel; 001 - АА batteries; 002 - USB power supply. | |
8 | XX | Device light intensity data, bits 15:8. | |
9 | XX | Device light intensity data, bits 7:0. Light intensity [Lux]. | |
10 | XX | PIR sensor status: 00 - No motion detected; 01 - Motion detected. |
Table 3.
Keepalive example
Byte | Bit index | Value | Meaning |
---|---|---|---|
0 | - | 01 | Command byte for this packet. |
1 | - | 02 | Internal temperature sensor data, bits 15:8 – T[15:8]. |
2 | - | 88 | Internal temperature sensor data, bits 7:0 - T[7:0]. t [°C] = (T[15:0]-400)/10 t [°C] = (0x0288-400)/10 = (648-400)/10 = 24.8 deg C. |
3 | - | 80 | Relative Humidity data; RH [%] = (XX*100)/256 (0x80 * 100)/256 = (128*100)/256 = 50% RH |
4 | - | 0A | Device battery voltage data, bits 15:8. |
5 | - | 45 | Device battery voltage data, bits 7:0. Battery voltage, [mV]. 0x0A45 = 2629mV |
6 | - | 1B | CO2 value in ppm, bits 7:0. |
7 | 7:3 | 00 | CO2 value in ppm, bits 12:8. CO2, [ppm]=CO2[12:0] 0x1B00=0001101100000000 CO2, [ppm]=CO2[12:0]=0001101100000=864 ppm |
2:0 | 00 | Power source status. Тhe device is powered by: 0x00=0001101100000000 [3:0]=000 000 - Built-in photovoltaic panel; | |
8 | 02 | Device light intensity data, bits 15:8. | |
9 | 7A | Device light intensity data, bits 7:0. Light intensity [LUX]. 0x027A = 634 LUX | |
10 | 00 | PIR sensor status: 00 - No motion detected; |
Table 4.
Keepalive period
Byte index | Hex value - Meaning |
0 | 02 – Command code to set keepalive period |
1 | XX – keep-alive period in minutes. Value 0x00 isn’t applicable. Default value 0A=10min. |
Example command: 0x020A
The example sets the keep-alive period to 10 minutes.
Note that the period value must respect the LoRaWAN messages duty cycle limitations. Otherwise the message will be sent when this is allowed. Also, the bigger period value, the less battery discharge. In most of cases, min. allowed period is 3 minutes and recommended values are 10 minutes or greater.
Last updated