What are the best settings for a LoRa radio

Hi

I am building a high altitude balloon and a LoRa Radio Tracker. (as some guys here might have heard of).

I am using Srnet's guide on LoRa as a rough outline. (a very rough one :slight_smile: ) It has been a great help by the way!

Anyway: I am using this LoRa shield and this library for this purpose.

Now my question is this: What are the optimal settings for this purpose?

These are the parameters you can change in the library:

  • txPower - TX power in dB, defaults to 17
  • spreadingFactor - spreading factor, defaults to 7
  • signalBandwidth - signal bandwidth in Hz, defaults to 125E3
  • codingRateDenominator - denominator of the coding rate, defaults to 5
  • preambleLength - preamble length in symbols, defaults to 8
  • syncWord - byte value to use as the sync word, defaults to 0x34
  • Enable or disable CRC usage, by default a CRC is not used.

In the "Testing and comparing transmitters, receivers and antennas" part of Srnet's guide he mentioned these parameters:

  • 10 mw Power
  • 62.5 kHz bandwith
  • Spreadfactor 12
  • Code rate 4:5

Are those, the sort of settings you would use for high altitude ballooning? If yes i guess I'd just set those settings to those values and leave the rest.

I am very new to radio in general, so I am sorry if my question(s) may be a bit stupid.

Here is a sample code of the library if anyone is interested:

#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);
}

Optimal settings are determined by experiment, with the equipment in the intended environment.

You are (or will be after you build the setup) the very person to do those experiments.

I definetly will be doing experiments. As a matter of fact I'm doing them right now. However it always helps to know the opinion on someone who knows his stuff :wink:

There are no 'best' seettings, it very much depends on what you want to do.

This is a basic introduction to the topic;

Long Distance Tracking and Monitoring with LoRa - Introduction - March 2016

The 62.5Khz, spreading factor 12 settings you mentioned are good long range settings for ground level searching but a bit slow for inflight use and the long range is not really needed, but that rather depends on the antenna systems in use.

There are regulatory issues to do with bandwidth and duty cycle which may prevent the use of the slower modes over long periods, that depends on the part of the world you are in.

Do not expect a simple ABC DIY list of how to put such a setup together, its very much a case of building the hardware writing some code and testing it works.

Its the testing that is the hard part, how do you ensure or simulate, assuming minimal equipment, that your setup is going to work in the real world the way you want it to ?

With a ready built purchased setup thats all done for you but this is DIY territory and it means just that; do it yourself.

1 Like

Wow that article really includes everything I wanted to know. Thanks! It was extremely helpful.

Yeah testing is rather tricky. But I'll follow your guide. However there does not seem to be a way to test that it will actually work on 20 km or so, or am I wrong?

Edit: You say you use guitar wire as an antenna. How come? What is its advantage? Would standard breadboard wire work too?

Yeah testing is rather tricky. But I'll follow your guide. However there does not seem to be a way to test that it will actually work on 20 km or so, or am I wrong?

Your wrong.

Just think, where can you get 20km or longer line of sight for a bit of realistic testing, or maybe you live in a cave ?

I have managed 40km.

And a hint - Google 'Frenzel Zone'

Edit: You say you use guitar wire as an antenna. How come? What is its advantage? Would standard breadboard wire work too?

Dont you think it would be peverse to say use Guitar Wire if standard breadboard wire would work too ?

For a Pico balloon tracker (less than 20g) Guitar wire is thin, light, solderable and self supporting, ever tried to construct a 1/4 wave antenna and radials using floppy wire ?

I suspect you meant "Fresnel Zone".

Just think, where can you get 20km or longer line of sight for a bit of realistic testing, or maybe you live in a cave ?

No, in a city, which means its still rather hard... But I'm working on it :slight_smile:

Dont you think it would be peverse to say use Guitar Wire if standard breadboard wire would work too ?

I'm sorry if it sounded as if I questioned whether there was an advantage or not, I just wondered what the advantage might be.

Anyway, here's an update on my experiments with the receiver:

I tried these settings at a distance of approximately 20 meters:

  • 62.5 kHz bandwith
  • Spreadfactor 12

(together with:

  • 17 dB power (will be using lower though)
  • Code rate 4:5)

However the bandwidth seems to be to narrow, so I switched to 125 kHz.

The spread factor 12 worked fine for short messages, however it seemed to corrupt the incoming data, when a long string was transmitted. Why might this be? At coding rate 10 it all worked fine again.

So, what are your thoughts on this? I will be testing longer distances as soon as I have time.

62.5 kHz bandwith, Spreadfactor 12, However the bandwidth seems to be to narrow, so I switched to 125 kHz.

The 62.5Khz bandwidth has been used for a great many HAB flights now and you changed it because it 'seems' narrow - Why ?

The spread factor 12 worked fine for short messages, however it seemed to corrupt the incoming data, when a long string was transmitted. Why might this be? At coding rate 10 it all worked fine again.

Sounds like a library config error.

The 62.5Khz bandwidth has been used for a great many HAB flights now and you changed it because it 'seems' narrow - Why ?

I tested it and only got corrupted data on that bandwidth. I find it rather strange though...

EDIT: I think I know what the problem might be: I discovered the module has accidentally been running with the antenna disconnected. But it still works and, it does not seem as if the range has suffered. (however I have never tested longer ranges than, say, 50 meters). As LoRa is very low power, is there a chance it might have survived? If something had burnt through I would have thought it should have stopped working completely.

bestanamnetnogonsin:
I tested it and only got corrupted data on that bandwidth. I find it rather strange though...

EDIT: I think I know what the problem might be: I discovered the module has accidentally been running with the antenna disconnected. But it still works and, it does not seem as if the range has suffered. (however I have never tested longer ranges than, say, 50 meters). As LoRa is very low power, is there a chance it might have survived? If something had burnt through I would have thought it should have stopped working completely.

Operating any RF module without an antenna is bad and the more power output you use the greater the chance of causing damage. Whilst testing the prudent keep power output to the minimum, for obvious reasons.

Even if the RF output of the LoRa module is toast, there is normally enough RF power leaking out to cover short distances, tens of metres at least.

If your getting corrupt data, then you need to review the reply I gave in post #8.

Ok here's a quick update: I've tested the module on 17dbm, spreading factor 10, 62.5 kHz bandwidth, CRC on and I suspect the module might be working after all (even though I ran it without an antenna at 17 dbm, which is the library default).

I did a Series of tests, and have not reached the maximum range yet. I came as far as 2.2 km through heavy vegetation (forests etc, no line of sight). I got an RSSI of around 105-110.

So, what do you think? Does that look good? I find it hard to tell...

(Antenna used was just a 17.3 cm wire on both modules)

Here's the code:

Transmit:

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

int counter = 0;

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

  Serial.println("LoRa Sender");

  if (!LoRa.begin(433E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);
  }
   
 LoRa.setSpreadingFactor(10);
  LoRa.setSignalBandwidth(62.5E3);
 LoRa.crc();
}

void loop() {

 
  Serial.print("Sending packet: ");

  
  Serial.println(counter);

  // send packet
  LoRa.beginPacket();
  LoRa.print("$PUBX,00,171105.00,4732.65287,N,00733.54730,E,337.932,NF,5611,3, 989.36, 25.30, 247, 0.10, 24.78, 48.41");
LoRa.print(counter);
 
  LoRa.endPacket();

  counter++;

  delay(3000);
 
}

Receive:

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


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

  Serial.println("LoRa Receiver");

  if (!LoRa.begin(433E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);
  }
 LoRa.setSpreadingFactor(10);
  LoRa.setSignalBandwidth(62.5E3);
  LoRa.crc();
}

void loop() {
  // try to parse packet
  int packetSize = LoRa.parsePacket();
  if (packetSize) {

    // received a packet
    Serial.print("Received packet '");

    // read packet
    while (LoRa.available()) {
      Serial.print((char)LoRa.read());
    }

    // print RSSI of packet
    Serial.print("' with RSSI ");
    Serial.println(LoRa.packetRssi());
  }
}

Using this library

Looks good!

2km through heavy vegitation at ground level on 50mW is not bad on simple wire antennas. FSK systems such as RFM22 and HC12 wont get close to that.

However, and I am sure I have mentioned it before, forget the RSSI reading, it really does not tell you anything useful.

The LoRa devices will report the Signal to Noise Ratio (SNR) of the received signal and that is (in my experience) an accurate indication of the link margin in the particular circumstances.

In other words at spreading factor 10 (SF10) the limit of reception is -15dB SNR so if at say 2km you are getting reception reported as -9dB SNR then since the failure point is another -6dB lower you can expect the failure point to be at 4km distance.

SF12 will give you another 5dB of link margin, so although the packets take 4 times longer to send the failure distance goes up to around twice distance.

I would also recommend you always enable CRC checking on packets, if the packet is corrupt, its corrupt so ignore it.

Quick question: What is the optimal orientation for the antenna? I know many people have the antenna facing straight down (with radials attached to the bottom of the payload). However I want to use a satellite tracker as a backup, which means the tracker should always face the sky. If the antenna were at the bottom, the payload would probably fall over when landing... Would it be bad for reception, if i just put the antenna on a side of the payload instead of the bottom? (meaning the radials would be taped to one side of the payload and the antenna would be horizontal). As the HAB will be bobbing around a lot in the wind, would it even matter in which direction the antenna faces?

Quick question: What is the optimal orientation for the antenna?

For a 1/4 wave wire antenna on a HAB tracker, then straight down.

Or perhaps straight up, but then it could more easily get caught up in the balloon suspension wires etc.

Straight up might work, but then again I was planning on adding radials.

This is just a random Idea, but maybe I could mount it like in the attached picture? I think I would be able to mount it fairly securely like that too...

The question is if the Payload between the Radials and the antenna is too much of an interference? How easily would the signal pass through styrofoam?

Skärmavbild 2017-04-27 kl. 14.53.50.png

Put it on the bottom.

Why, when you have noticed that the antenna is normally placed on the bottom of the payload are you seemingly determined to do it differently ?

And have a think about why the side is a bad place ...............

Well I know my solution is far from the best, but the reason I don't want it on the bottom is that I am using a satellite tracker for backup and test purposes. If the payload lands on the antenna it will probably roll over. The satellite tracker has to face the sky. Thats why I thought about doing it like in the picture I attached. That way the antenna would be facing down anyway, it would just be attached to the side of the payload, with the radials at the top of the payload.

Do you think a simple wire antenna (without radials) would be enough to communicate via LoRa with the balloon? That would make things a lot simpler as I could just have it facing straight up like you said.