ESP32 LoRa V3 Tx and Rx address

Hi,
I am able to run the “LoRa Sender” and “LoRa Receiver” programs provided in the “Heltec-Example”.

Is there a way to insert the addresses in the programs for the “LoRa Sender” and “LoRa Receiver” so that only that 2 LoRa devices can view each other’s information?

Thank you in advance for any advice.

Rdgs,
Paul

LoRa is effectively a MAC level broadcast—you can add address information to your data to signal your intentions, or even encrypt the content, and on that basis you may choose what received data you want to process, but you can’t stop anyone from receiving it. That sort of stuff is handled by the WAN part of LoRaWAN.

If you just want to ‘separate’ transmissions, you could just use different frequencies etc. for different LoRa devices that you want separated.

there is another example - https://github.com/HelTecAutomation/Heltec_ESP32/blob/master/examples/LoRa/LoRaMultipleCommunication/LoRaMultipleCommunication.ino

and if I understand it correctly - seems it can be used in this case with some modifications - just need modify broadcast address to the address of second node…
need to check.
Am I wrong?

Well, the communication is still broadcast, it’s just that the message contains an address field. Every device still receives the message but the software running on a receiving node checks the address field in the message and only processes the message, or acts on its content, if the address matches its own.

To make communications end-to-end ‘private’, you would need some method of message encoding that depended on something like a key that was only known to the sender and intended recipient. Once again, the message would be broadcast, anyone operating on the relevant frequency could receive it, but only a device with an appropriate key could actually make sense of the message.

Off course there are many more sophisticated methods for ensuring privacy in wireless communications, but the discussion here is just in relation to simple, single frequency LoRa communications.

1 Like

Thank you for explanation!

But as far I understand, I dont need “private communications” in my LoRa network.
My question for my project is described in these two topics:


and

And as far I understand RadioHead’s library examples in my question (based on RHDatagram module) use exactly this way to work.
I just need to receive and process message with address field.
Im not sure if the author of this topic wants to have another type of work with addresses, but for me - it would be enough… at least I need to check this.
So I suppose I can just modify broadcast address of second node and use that example for communication two nodes. And each node will receive and process data packets only with corresponding address - after filtering this address data in the packet…
Right?

I’m not familiar with the RadioHead library but, yes, you should be able to do what you want by simply setting and checking some element of a message, like and an address field.

1 Like

but how to do it for CubeCell device?

Im still cant modify this example from ESP32 device to use it with CubeCell device…

I understand that I need first prepare LoRa packet with addresses, like in example,

but for CubeCell there no such methods in modules…

All that sequence of LoRa.writes is doing is writing individual elements, one at a time. You can do exactly the same thing by writing the individual elements to an array or record then just writing that single data element in a single write. Both LoRa and Radio libraries support this approach.

In my own applications, the LoRa code (used for pre-V3 ESP32 modules and RFM95W configurations) looks like this:

LoRa.beginPacket(); // Start packet
LoRa.write((uint8_t *)packet.byteStream(), packet.packetByteCount()); // Load the output buffer
LoRa.endPacket(); // Send it

and the corresponding Radio code (used for CubeCell and ESP V3 modules) looks like this:

Radio.Send(packet.byteStream(), packet.packetByteCount());

In my case, ‘packet’ is a record structure that contains various elements, including source and destination addresses. If you’re interested, full details are available on my project website.

thank you for answer!

but unfortunately I cant find this class in the CubeCell library… there no such files - LoRa.h and LoRa.cpp…
and I think it means that it is not possible to use this approach for CubeCell devices

But for ESP32 based devices with SX1262 - this files is present in repository.
So seems this approach can be used only for ESP32 based devices…

Im “parsing” your website almost 3 days) I see that you created your own libraries for handling packets and nodes… but at lest now I want to use the native libraries without any modification…

As far as Heltec-supplied libraries are concerned, the LoRa library is only applicable for pre-V3 ESP32 modules (i.e. the SX1276 LoRa chip). For modules that use the SX1262 LoRa chip (CubeCell and ESP32 V3 modules) you need to use the Radio library. You can, of course, use any other [3rd party] library that supports the relevant processor and LoRa chip.

I do use my own libraries to assemble packets but all these do is assemble an array of bytes (uint8_t) in a structured way. If you just want to mimic the LoRa process of sequential writes, all you need to do is to write the individual elements to a char array (use the sprintf function as in the factory test sketch) then send that array via the Radio.send function. Reading the packet is just the same in reverse.

1 Like