项目作者: myDevicesIoT

项目描述 :
Cayenne Low Power Payload (LLP)
高级语言: C++
项目地址: git://github.com/myDevicesIoT/CayenneLPP.git
创建时间: 2018-12-07T17:59:53Z
项目社区:https://github.com/myDevicesIoT/CayenneLPP

开源协议:GNU General Public License v3.0

下载


Cayenne Low Power Payload

Overview

The Cayenne Low Power Payload (LPP) provides a convenient and easy way to send data over LPWAN networks such as LoRaWAN. The Cayenne LPP is compliant with the payload size restriction, which can be lowered down to 11 bytes, and allows the device to send multiple sensor data at one time.

Additionally, the Cayenne LPP allows the device to send different sensor data in different frames. In order to do that, each sensor data must be prefixed with two bytes:

  • Data Channel: Uniquely identifies each sensor in the device across frames, eg. “indoor sensor”
  • Data Type: Identifies the data type in the frame, eg. “temperature”.

Payload structure






















1 Byte1 ByteN Bytes1 Byte1 ByteM Bytes
Data1 Ch.Data1 TypeData1Data2 Ch.Data2 TypeData2

Data Types

Data Types conform to the IPSO Alliance Smart Objects Guidelines, which identifies each data type with an “Object ID”. However, as shown below, a conversion is made to fit the Object ID into a single byte.

  1. LPP_DATA_TYPE = IPSO_OBJECT_ID - 3200

Each data type can use 1 or more bytes to send the data according to the following table.


















































































































TypeIPSOLPPHexData SizeData Resolution per bit
Digital Input32000011
Digital Output32011111
Analog Input32022220.01 Signed
Analog Output32033320.01 Signed
Illuminance Sensor33011016521 Lux Unsigned MSB
Presence Sensor33021026611
Temperature Sensor33031036720.1 °C Signed MSB
Humidity Sensor33041046810.5 % Unsigned
Accelerometer33131137160.001 G Signed MSB per axis
Barometer33151157320.1 hPa Unsigned MSB
Gyrometer33341348660.01 °/s Signed MSB per axis
GPS Location3336136889Latitude : 0.0001 ° Signed MSB
Longitude : 0.0001 ° Signed MSB
Altitude : 0.01 meter Signed MSB

Examples

Device with 2 temperature sensors























Payload (Hex)03 67 01 10 05 67 00 FF
Data ChannelTypeValue
03 ⇒ 367 ⇒ Temperature0110 = 272 ⇒ 27.2°C
05 ⇒ 567 ⇒ Temperature00FF = 255 ⇒ 25.5°C

Device with temperature and acceleration sensors

Frame N


















Payload (Hex)01 67 FF D7
Data ChannelTypeValue
01 ⇒ 167 ⇒ TemperatureFFD7 = -41 ⇒ -4.1°C

Frame N+1
























Payload (Hex)06 71 04 D2 FB 2E 00 00
Data ChannelTypeValue
06 ⇒ 671 ⇒ AccelerometerX: 04D2 = +1234 ⇒ +1.234G
Y: FB2E = -1234 ⇒ -1.234G
Z: 0000 = 0 ⇒ 0G

Example use

  1. #include 'CayenneLPP.h';
  2. #define MAX_SIZE 200; // depends on spreading factor and frequency used
  3. CayenneLPP Payload(MAX_SIZE);
  4. float celsius = -4.1;
  5. float accel[] = {1.234, -1.234, 0};
  6. float rh = 30;
  7. float hpa = 1014.1;
  8. float latitude = 42.3519;
  9. float longitude = -87.9094;
  10. float altitude:10
  11. int size = 0;
  12. Payload.reset();
  13. size = Payload.addTemperature(0, celsius);
  14. if (size == 0) {
  15. // not enough byte left to add the data
  16. }
  17. else {
  18. // add function returned current payload size
  19. }
  20. Payload.addAccelerometer(1, accel[0], accel[1], accel[2]);
  21. Payload.addRelativeHumidity(3, rh);
  22. Payload.addBarometricPressure(4, hpa);
  23. Payload.addGPS(5, latitude, longitude, altitude);
  24. // Call LoRaWAN library to send the frame
  25. LORA_SEND(Payload.getBuffer(), Payload.getSize());