Lora : exact frequency

Hello,

I'm using lora peer-to-peer communication, with a ESP32 with lora shield (DFRobot firebeetle shield) on the receiver end and an Arduino MKR 1310 on the sender end. Being in Europe, the defaut frequency is 868 Mhz, as set on the receiver end.

For unknown reasons to me, the communication does work only if I adjust the emission frequency to 868.5 MHz on the lora initialization for the MKR. While this work, I would like to understand why is there a need for this 500 kHZ frequency shift. I'm trying to increase the range and need to understand (I'll post other questions related to distance on another post).

Any ideas for this 868 Mhz versus 868.5 Mhz?

To be complete, I should add that I 'm using a 250 kHz bandwidth.

For two LoRa nodes to communicate, the frequency used by the transmitter has to be within 25% of bandwidth (so 62.5khz in this case) of the frequency used by the receiver.

So its possible the base frequency of one module is out a bit.

You would need to measure the transmission frequency of each module with a frequency counter to see if this is a problem. I dont have a frequency counter is hardly a valid statement. Although a low cost SDR can be used to compare two transmission frequencies.

And as a trouble shooting step use the TX and RX modules with the same LoRa library to be sure there is no issue there.

Thanks for your answer. I'm using the sandeepmistry lora library for the MKR and the DFRobot Lora library for the receiver.

I tried using the sandeepmistry withe the DFRobot device but stumbled upon some incompatibility issues. Could the use of two different libraries explains the differences in required set frequencies?

Incidently a frequency variation of circa +- 5khz @ 434Mhz is normal for the non TCXO SX127x modules, which is most of them.

So a frequency variation of 10khz @ 868mhz would be expected.

Unlikely.

The base frequency for an SX127x is dependant on the value of 3 registers, fairly standard calculation to work them out.

Really, such as ?

If I'm correct both my modules are using SX1276. But 500 kHz is much more than 10 kHz...

That frequency number is the LOW end of the band and will never be used because if it was 1/2 the transmitted emissions would be outside of the allow frequency band.

Hello,

Thank you both for your answers.

To conclude this topic:

  • as hinted by Srnet, the two libraries were both compatible with my modules. But I was not able to communicate using the "Lora/Sandeepmistry" library on the DERobot lora receiver. This might be because of improper program from my side, but anyway, I did not need this.
  • The conclusion is that I needed to set different frequencies (868 MHz on one device, 868.5 MHz device on the other) to be able to communicate. This is a fairly large difference and I could not understand if this was due to the different libraries or to different hardware. Anyway, this is working great now (either bandwidth 125 or 250 kHz). I think it is important to remember that using different hardware and libraries might require initializing different frequencies.
  • Finally my last advice is to use as much as possible similar devices. Unfortunately, this is not always possible (e.g. when one need a Wifi communication on one side and a low power on the other side as is my case).

What that would suggest is that one or both of the libraries are setting the frequency incorrectly, and that ought to be fixed.

Before issueing such a generalistaion you really should measure the actual output frequency of transmissions produced by each library.

Your problem seems far far more likley to be a differance between or a fault in one of the modules, and unlikley to be a issue with the library compatibility.

Assuming you are using SX127X LoRa devices, can you add this code to the transmitter and receiver programs you are using, it will tell you what the particular LoRa library is setting the frequncy to;

/*******************************************************************************************************
  This code will prints out the set frequency of a SX127X. Add the code to a sketch for LoRa that is
  already working. You need to be sure the pin number for NSS matches your board.
*******************************************************************************************************/

#define NSS 10                             //LoRa device select

//code to add to loop()
uint32_t frequency = getFreqInt();
Serial.print(F("Frequency "));
Serial.println(frequency);


//required functions to add
uint32_t getFreqInt()
{
  //get the current set LoRa device frequency, return as long integer
  uint8_t Msb, Mid, Lsb;
  uint32_t uinttemp;
  float floattemp;
  Msb = readRegister(0x06);
  Mid = readRegister(0x07);
  Lsb = readRegister(0x08);
  floattemp = ((Msb * 0x10000ul) + (Mid * 0x100ul) + Lsb);
  floattemp = ((floattemp * 61.03515625) / 1000000ul);
  uinttemp = (uint32_t)(floattemp * 1000000);
  return uinttemp;
}


uint8_t readRegister(uint8_t address)
{
  uint8_t regdata;
  digitalWrite(NSS, LOW);                    //set NSS low
  SPI.transfer(address & 0x7F);              //mask address for read
  regdata = SPI.transfer(0);                 //read the byte
  digitalWrite(NSS, HIGH);                   //set NSS high
  return regdata;
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.