1
\$\begingroup\$

I'm trying to implement a LoRa communication between two devices (master and slave). I studied two modules that seem to be interesting RFM96WE and SX1276. From the code provided as an example (below), I saw that the message is sent by the LoRa.print() function; To send a character this function seems to work very well. My problem is that I need to send 500kBytes of data and I don't know how to do that. This data will come from a temperature sensor, should I create a vector to store this and then send? How could it send so much data through this function?

#include <SPI.h>
#include <LoRa.h>

int counter = 0;

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

  Serial.println("LoRa Sender");

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

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

  // send packet
  LoRa.beginPacket();
  LoRa.print("hello ");
  LoRa.print(counter);
  LoRa.endPacket();

  counter++;

  delay(5000);
}
\$\endgroup\$
1
  • 2
    \$\begingroup\$ 500 kB is simply not an amount of data you should be sending over LoRa. Its datarate and your legal requirement to not occupy unlicensed spectrum continuesly mean that you simply cannot do that in sensible time. \$\endgroup\$ Apr 4, 2022 at 12:57

1 Answer 1

1
\$\begingroup\$

You can calculate the data rate of your LoRa modem using an online calculator like this one: https://www.rfwireless-world.com/calculators/LoRa-Data-Rate-Calculator.html

Remember to divide by 8 to go from bps (bits per second) to Bps (bytes per second).

At SF7, CR4 and BW500, you will see that you can transmit at 1.708kBps. That's going to take 292.74s for all your data to transfer. That assumes a very strong LoRa link which is not always practically realizable in the field.

If an extremely long transmission time is not a problem for you, I would try dividing the message into chunks and transmitting each chunk individually using a loop. Keep in mind that the maximum size of your LoRa packets is limited by the LoRa standard and you will experience an even lower data rate in the field due to the extra bytes used by the LoRa protocol. Also remember that you LoRa messages is limited in size by the LoRa protocol depending on your region and could be as low as 51 bytes per message. Also note that due to the LoRa fair usage policy your time on air will also be limited.

All things considered I would recommend that you use a different technology like LTE or GPRS which support much larger data sizes. You can also attempt compressing your data but that may be a complex road with limited success.

\$\endgroup\$
3
  • \$\begingroup\$ Thank you for your reply. Yes, I can handle a long time to send the data. I thought about using LoRa because I need to transmit data over more than 100m of open-air gap. \$\endgroup\$ Apr 4, 2022 at 13:35
  • \$\begingroup\$ You can also use some of the LoRa modules like RFM95/6 or SX1276 based modules in FSK mode to achieve much higher bitrates. BUT this would mean that you will have to dabble in low level firmware yourself and you will also most likely violate spectrum regulations and you will have to implement a lot of LoRa features like encryption, data verification and retransmission in case of transmission failure or link degradation yourself. \$\endgroup\$
    – Curzii
    Apr 7, 2022 at 6:48
  • \$\begingroup\$ RFM95 max bitrate 300kbps or 37.5kBps in FSK mode. \$\endgroup\$
    – Curzii
    Apr 7, 2022 at 7:10

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.