I have a arduino connected to TTN via a public lora network.my current application can send the required info to TTN no problem. I now want to setup the same code to transmit to TTN in LPP Cayenne format so i can use Cayenne to show the data. I have been through the docs and see the data structures but i cant seem to implement them. can someone provide me with sample code or tel me how to send 4 integer values to TTN that can be added to widgets.
Thank you for the reply, I have looked through the example provided and i think my main issues is the LLP format. I can not seem to get it right or find an example other then the standard temp,analog, gps exc. The example does not go into detail on the code used on the node and how the information is formatted
@croczey Lets rather start here, below is the code i have working currently. I want to expland this to 4 channels, three channels must just send a integer value(no commas), one must send floating point value value(battery voltage). Every modification i have tried so far TTN could not decode. how do I go about doing this .
void do_send(osjob_t* j) {
// Cayenne LPP Protocal Definition
#define LPP_TEMPERATURE 103 // 0x67 - 103 - 2 bytes, 0.1°C signed
#define LPP_ANALOG_INPUT 2 // 2 bytes, 0.01 signed
// Init declaration
int16_t val;
uint8_t channel;
byte buffer[8];
uint8_t cursor = 0;
// set Sensor Barometric Pressure into payload
val = analogRead(0);
channel = 0x04;
buffer[cursor++] = channel;
buffer[cursor++] = LPP_ANALOG_INPUT;
buffer[cursor++] = val >> 8;
buffer[cursor++] = val;
// set Sensor Temperature into payload
val = 99;
channel = 0x05;
buffer[cursor++] = channel;
buffer[cursor++] = LPP_TEMPERATURE;
buffer[cursor++] = val >> 8;
buffer[cursor++] = val;
// Prepare upstream data transmission at the next possible time.
LMIC_setTxData2(1, buffer, sizeof(buffer)/sizeof(buffer[0]), 0);
//Serial output of message
Serial.println(F("Sending: "));
for(byte b=0; b<(sizeof(buffer)/sizeof(buffer[0])); b++){
Serial.print(buffer[b]);
}