Refer to the “Data Types” section here
https://mydevices.com/cayenne/docs/lora/#lora
The uplink Payload Structure is as follows
1 Byte 1 Byte N Bytes 1 Byte 1 Byte M Bytes …
Data1 Ch. Data1 Type Data1 Data2 Ch. Data2 Type Data2
Each data type can use 1 or more bytes to send the data according to the following table.
Type IPSO LPP Hex D.Size Data Resolution per bit
Digital Input 3200 0 0 1 1
Digital Output 3201 1 1 1 1
Analog Input 3202 2 2 2 0.01 Signed
Analog Output 3203 3 3 2 0.01 Signed
Illuminance Sensor 3301 101 65 2 1 Lux Unsigned MSB
Presence Sensor 3302 102 66 1 1
Temperature Sensor 3303 103 67 2 0.1 °C Signed MSB
Humidity Sensor 3304 104 68 1 0.5 % Unsigned
Accelerometer 3313 113 71 6 0.001 G Signed MSB per axis
Barometer 3315 115 73 2 0.1 hPa Unsigned MSB
Gyrometer 3334 134 86 6 0.01 °/s Signed MSB per axis
GPS Location 3336 136 88 9 Latitude : 0.0001 ° Signed MSB
Longitude : 0.0001 ° Signed MSB
Altitude : 0.01 meter Signed MSB
Check out how @kersing sends this data in his code here
Here is the code bit, you can see the first channel has 9 bytes for GPS( 0x88), and the 2nd channel has 2 bytes for the analog (battery voltage) value
if (fix) {
buffer[i++] = 0x01;
buffer[i++] = 0x88;
h = lat / 1000L;
buffer[i++] = (h >> 16) & 0xff;
buffer[i++] = (h >> 8) & 0xff;
buffer[i++] = h & 0xff;
h = lon / 1000L;
buffer[i++] = (h >> 16) & 0xff;
buffer[i++] = (h >> 8) & 0xff;
buffer[i++] = h & 0xff;
buffer[i++] = (alt >> 16) & 0xff;
buffer[i++] = (alt >> 8) & 0xff;
buffer[i++] = alt & 0xff;
}
measuredvbat *= 2; // we divided by 2, so multiply back
measuredvbat *= 3.3; // Multiply by 3.3V, our reference voltage
measuredvbat /= 1024; // convert to voltage
h = measuredvbat * 100;
Serial.print("VBat: " ); Serial.println(h);
buffer[i++] = 0x02;
buffer[i++] = 0x02;
buffer[i++] = (h >> 8) & 0xff;
buffer[i++] = h & 0xff;
This is how he sets up Cayenne here
When you are at the Cayenne end, you can represent the data channel as you want e.g. an analog value can be represented as “Battery Voltage”
The whole GPS tracker works nicely!
Well done @kersing