heltec_wifi_lora_32_V3 - radiolib - CayenneLPP - lorawan

HI,

I’m not very knowledgeable in programming…
I have the card in question and I would like to send data to a Lorawan network using the radiolib library. Has anyone already done something about this?
I would like to try using the CayenneLPP library in order to delegate all the data encoding work to it and at the same time use the decoding part already present in TTN and/or chirpstack.

When I try to use the “sendReceive” or “uplink” methods I see that with the same name there are two possible implementations, both in “String” and “uint8_t*” but I can’t…

node.sendReceive(lpp.getBuffer(), lpp.getSize(), 10, dataDown, sizeof(dataDown), true, &eventUp, &eventDown);

it seems that as the first parameter I can’t understand that it’s not a string.

ideas?

Davide

Hi @evon800c

While I understand what you are trying to achieve, I am not sure what your actual question is. Is the problem that your code does not compile?
Personally, my compiler was also complaining, thinking that I was supplying a String while in fact I was supplying a uint8_t* array. After fiddling around with the arguments for a while, it did at some point accept it.

Please be aware that confirmed uplinks are not the way to go; please set the sixth argument to false unless you are running some sort of atomic bomb shelter that you need to know if it is actually still closed. While a gateway is sending a downlink, the whole area will be filled with ‘useless’ airwaves and the gateway is unable to receive any other packet in the meantime, because it cannot receive while sending. And your device is not magically going to send better uplinks by requesting downlinks from the server.

Hi,

thanks for you time …
my basic question is… how can I send data with radiolib library methods sendreceive or uplink, using cayennelpp.

davide

What is wrong with the line you provided in your first post? It looks fine to me.

Hi,

sorry for late response, but I work on my personal project not continuously.

I’ll try to respond you, saying that also for me my code had nothing wrong, but when I tried to compile, it does going for type problem.
Please don’t ask me how, but after some change, with no change, now seem to be fine and i can send data.

I have a question, I don’t know if I can use this thread, I try and in case that is wrong, i’ll try to open other one.

it’s possible to set radio in FSK mode for read some data and after that set radio in “lorawan” mode, to send/receive and after that start again the loop?
if yes, there are some example to make some test?

tnx in advantage, Davide

Hi evon800c,

Yes you can :wink: it goes like this…

//include the cayenne lib
#include <CayenneLPP.h>

// create a lpp object > 255 bytes
CayenneLPP lpp(64);

//prepeare lpp packet function
//----------------------- make lpp packet -------------------------//

void sendYourThing() {

if (gps.location.isValid()) {

lpp.reset();   
lpp.addGenericSensor(0,0);    
lpp.addGPS(1, gps.location.lat(), gps.location.lng(), gps.altitude.meters());
// add more lpp types

     
txPacket();    

}
}

//function to send the packet
//----------------------- send a packet | lpp buffer -------------------------//

void txPacket() {

int state = radio.startTransmit(lpp.getBuffer(), lpp.getSize());

if (state == RADIOLIB_ERR_NONE) {
// the packet was successfully transmitted
Serial.print(F(“TX -> : packet”));

} else if (state == RADIOLIB_ERR_PACKET_TOO_LONG) {
// the supplied packet was longer than 256 bytes
Serial.println(F(“TX-> error -> : packet overload”));

} else if (state == RADIOLIB_ERR_TX_TIMEOUT) {
// timeout occurred while transmitting packet
Serial.println(F(“TX-> error -> : timeout”));

} else {
// some other error occurred
Serial.print(F("TX-> error -> : "));
Serial.println(state);
}
}

good luck…

1 Like