0

I am fairly new to IoT and to all kinds of Arduino chips/sensors etc.. I am trying to understand the mechanism of LoRa device communication. With the help of the official Arduino web page I found the following code:

void setup() {
  Serial.begin(9600);
  while(!Serial);

  Serial.println("LoRa Sender");

  if (!LoRa.begin(868E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);
  }
}

As far as I understand LoRa.begin(868E6) sets the frequency of transmission of the device. The code continues with the loop function:

void loop() {
  Serial.print("Sending packet: ");
  Serial.println(counter);

  // send the data to all 
  // possible consumers ? 
  LoRa.beginPacket();
  LoRa.print("hello ");
  LoRa.print(counter);
  LoRa.endPacket();

  counter++;

  delay(5000);
}

Now if I am not mistaken every other LoRa device within the range of the signal that is also set up to the same frequency (868E6) can receive the data produced by the transmission device. Is my understanding correct? And if yes then how can we prevent unwanted devices to interfere with our system/setup? Should we use some kind of encryption? Maybe certificates?

Thanks in advance to anyone that can help!

1 Answer 1

3

LoRa is the "raw" radio modulation. You create a packet, it sends it as is, with only the LoRa modulation, no additional data (addresses, encryption, etc.).

Most people will use LoRaWAN rather than just raw LoRa. LoRaWAN uses the LoRa modulation, but adds quite a few things on top of that, including addressing, encryption, optional acknowledgments and confirmed packets, join requests, handling on multiple channels and data rates (including changes to those), etc.

LoRaWAN however relies on a "hub and spoke" or "star" topology: there's a gateway (or there could be several), and devices talk to the gateway, but not to each other. Gateways are connected to an LNS (LoRa Network Server), which in turn talks to servers on the Internet (usually the goal of LoRa devices is to report data to a server somewhere on the Internet, and sometimes receive a little bit of information like configuration from the same).

LoRaWAN gateways are more complex than end-devices because they have to listen on multiple channels and multiple data rates at the same time, and then need to communicate with an LNS.

One option if you are covered is to use an existing LoRaWAN network (the most ubiquitous is The Things Network, but there are others). Then you register your LoRaWAN end device and your application server on that network, and you can set up your device to join the network and then whatever it sends should end up on your server. Note that you will use different APIs, as you need a LoRaWAN implementation, not just raw LoRa.

Alternatively, you can have your own gateway, and register it on an existing network. Or have you own gateway and your own LNS.

If you don't want LoRaWAN for whatever reason but want to stick to pure device-to-device communication and you need more, then you will need to implement those additional features yourself.

There have also been implementation of mesh protocols over LoRa, though I'm not familiar with the details.

3
  • Great explanation! I would like to know if my understanding for 'raw' LoRa is correct. The 'producer' of the data is spreading it on a specific frequency and everyone else (devices set up on the same frequency) can receive the data? Is my statement correct?
    – dimitar.d
    Commented Aug 30, 2023 at 17:13
  • Thanks for the explanation! Is my understanding correct - "Now if I am not mistaken every other LoRa device within the range of the signal that is also set up to the same frequency (868E6) can receive the data produced by the transmission device.".
    – dimitar.d
    Commented Aug 30, 2023 at 17:37
  • 1
    @dimitar.d Same frequency, bandwidth, data rate, possibly also coding rate. But yes, with the right settings, anybody can receive that data if you don’t take additional measures to protect it.
    – jcaron
    Commented Aug 30, 2023 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.