Author Topic: Long Range parameters for RFM69HW (868 / 915 MHz)  (Read 18300 times)

fgomes

  • Jr. Member
  • **
  • Posts: 65
Long Range parameters for RFM69HW (868 / 915 MHz)
« on: July 18, 2016, 05:32:14 AM »
Hi,

I need to use the moteinos (868 or 915 MHz) in a long range configuration (longest link with about 1km, near line-of-site, in a rural area). I saw many posts with recommended settings, namely these from hdphilip (https://lowpowerlab.com/forum/rf-range-antennas-rfm69-library/rfm69hw-range-test!/15/):

 radio.writeReg(0x03,0x68);   //RegBitrateMsb 1200 bitrate
 radio.writeReg(0x04,0x2b);   //RegBitrateMsb
 radio.writeReg(0x05,0x00);   //RegFdevMsb     2000
 radio.writeReg(0x06,0x21);   //RegFdevLsb
 radio.writeReg(0x19,0x56);   //RegRxBw

 radio.writeReg(0x18,0x88); //RegLna register

and these from Steinarrr (https://lowpowerlab.com/forum/moteino/multistorey-indoor-range-performance-1-75km-range-(solution)/msg3189/#msg3189):

 radio.writeReg(0x03,0x68);      //RegBitrateMsb 1200 bitrate
 radio.writeReg(0x04,0x2B);      //RegBitrateLsb 1200 bitrate
 radio.writeReg(0x05,0x00);      //RegFdevMsb     2000
 radio.writeReg(0x06,0x52);      //RegFdevLsb     2000
 radio.writeReg(0x19,0x40|0x10|0x05);      //RegRxBw  DccFreq:010, RxBw_Mant:24, RxBw_Exp:5
 radio.writeReg(0x18,0x00|0x00|0x01);      //RegLna  LnaZin:50ohm, LowPower:Off, CurrentGain:MAX

I've tried with the first values from hdphilip, but had stability problems, it worked in my house but when intalling the gateway at the final destination, even with the sensors around it (less than 1 meter), most of the messages failed.

Any recommended values for 868 or 915 Moteinos? Temperature compensation is necessary for these parameters?

Thanks!

Fernando


fgomes

  • Jr. Member
  • **
  • Posts: 65
Re: Long Range parameters for RFM69HW (868 / 915 MHz)
« Reply #1 on: July 18, 2016, 07:14:21 PM »
Using the code from the first example (from hdphilip), running in 3 different nodes, using an RTL-SDR radio and SDR#, I observed activity in the following frequencies:

Node 1: 867,945 - 867,949
Node 2: 867,936 - 867,940
Node 3: 867,940 - 867,944

They are all at the same temperature (about 20ÂșC), side by side. This was the reason why they don't communicate between them (but they communicate using the RFM69 default parameters).

So what is the way to make them work together? it could be to activate the AFC in one of the nodes, use it as a receiver and get the frequency error (FEI Value) with each of the other transmitting, and then correct the frequency in the transmitter nodes based on the FEI calculated by the receiver nodes? And on top of this 'offset' calibration, is it still necessary to compensate the frequency based on the temperature?

Is there a reason for not having the AFC activated in the RFM69 library? Wouldn't it minimize this problem?

Thanks!

Fernando

fgomes

  • Jr. Member
  • **
  • Posts: 65
Re: Long Range parameters for RFM69HW (868 / 915 MHz)
« Reply #2 on: July 19, 2016, 07:32:16 PM »
I made some additional tests. First I have used the procedure described here for measuring the frequency error for each node:

https://ukhas.net/wiki/ideas:rfm69_frequency_trimming

I have introduced an adjusted frequency in each node (using the radio.setFrequency method), and made some additional fine tunning observing the signal using sdr#. Using that approach I was able to have successful transmissions between nodes (but some of the messages only succeed on the first or second retry)

I then changed one of the nodes to the freezer, and then we can observe near 2.5kHz frequency drift in a few minutes (cold image)

So my main questions are:

Do you use temperature compensation when using low bit rate / bandwidth? Do you have a temperature compensation table or do i need to make my own, measuring the frequency drift with the temperature?

Are the non default parameters I have used ok? It seems strange that even making some fine adjustment to each node frequency and having confirmed that the frequencies are aligned, it still has some retries when the nodes are side by side. The parameters that i'm using are the following:

 radio.writeReg(0x03,0x68);   //RegBitrateMsb 1200 bitrate
 radio.writeReg(0x04,0x2b);   //RegBitrateMsb
 radio.writeReg(0x05,0x00);   //RegFdevMsb    2000 Hz deviation
 radio.writeReg(0x06,0x21);   //RegFdevLsb
 radio.writeReg(0x19,0x56);   //RegRxBw         5200 Hz RxBw

 radio.writeReg(0x18,0x88); //RegLna register


Best regards

Fernando

emjay

  • Full Member
  • ***
  • Posts: 119
  • Country: nl
Re: Long Range parameters for RFM69HW (868 / 915 MHz)
« Reply #3 on: July 20, 2016, 08:54:20 AM »
@Fernando,

If you use the narrowest RxBw settings, then a static adjustment of the crystal error is not enough if you are expecting wide temperature changes.  Some good material here https://lowpowerlab.com/forum/moteino/freq-vs-temperature-update/

When benchtesting, be aware that the over-strong signal can confuse the Rx section - curling up or removing the ANT wire can help.  BTW, what does your payload format look like?


fgomes

  • Jr. Member
  • **
  • Posts: 65
Re: Long Range parameters for RFM69HW (868 / 915 MHz)
« Reply #4 on: July 20, 2016, 10:26:43 AM »
@emjay

Thanks for your reply! Ok, I'll add temperature compensation, but even with the nodes all at the same temperature and with frequency adjusted as I described I have many messages that only succeed with retries. Without narrowing the band, using the default parameters of the LowPowerLab lib, it works without adjusting the frequency and without using retries. I was expecting that narrowing the band will have the impact of the need of frequency calibration (and eventual temperature calibration) but that will have the same communication reliability, this high retry number with nodes side by side worries me. I'll try to increase the distance between nodes to see if it could be a saturation problem, but this doesn't occur with the default configuration.

The payload is mainly the value of several sensors, a total of about 20 bytes.

Fernando

fgomes

  • Jr. Member
  • **
  • Posts: 65
Re: Long Range parameters for RFM69HW (868 / 915 MHz)
« Reply #5 on: July 21, 2016, 03:05:00 AM »
I did some additional tests, always using the same nodes. I have removed the retries, and count all the failures. This is what I have observed :

Using the default settings, without frequency calibration, the failure rate is between 1% and 2%
Adding frequency adjustment / calibration the results were similar
With the default settings but changing the bitrate to 1200 and frequency calibration , the failure rate is 7%
Using a bitrate of 1200, rxbw of 10khz, 2kHz fdev and frequency calibration I got also about 7% failure rate.

So the failure rate seems to depend mainly of the bitrate ( only changing the bitrate to 1200 and even using frequency calibration the failure rate raises from 2% to 7%). Any idea why changing the bitrate from the standard 55555bps to 1200bps might increase the failure rate even using the default large rx bandwidth and fdev?

Fernando

emjay

  • Full Member
  • ***
  • Posts: 119
  • Country: nl
Re: Long Range parameters for RFM69HW (868 / 915 MHz)
« Reply #6 on: July 21, 2016, 06:44:49 AM »
@Fernando,

The payload is mainly the value of several sensors, a total of about 20 bytes.

You have some real data in there?   Empty packets can be troublesome.

I suggest you estimate the noise floor at your testbench (the RSSI level of the occasional bad packet) then set the RegRssiThresh (0x29) value a few dB above this.
« Last Edit: July 21, 2016, 06:46:30 AM by emjay »

fgomes

  • Jr. Member
  • **
  • Posts: 65
Re: Long Range parameters for RFM69HW (868 / 915 MHz)
« Reply #7 on: July 21, 2016, 10:23:40 AM »
@emjay

Thank you again! The packets are not empty, but didn't check exactly their content, the values are almost only floats, and are being used, so I think it would be an almost random sequence of bits.

About estimating the noise floor on my test bench, can you give me some additional clues about the process you are proposing? I am using the default lib RSSI threshold (220, corresponding to 110 dBm). All the packets that the receiver sees are at about -50dBm, and then there are some packets that the receiver don't see... Even if i put the nodes close together, the RSSI goes to about -22dBm, but it didn't receive some of the packets. When using the default parameters (BR=55555, Fdev=50000, RxBw=125kHz) I can receive correctly signals with RSSI lower than -90dBm.

So I'm not understanding the cause of the higher failure rate, unless the frequency didn't match (lower bandwidth will be much more sensitive to that, but I have tuned the nodes using RTL-SDR and SDR# otherwie they don't communicate) or disturbances in the same frequency (turning the nodes off I don't see any activity in the frequency I'm using, 868.000 MHz). Worse than that, even not reducing the bandwidth, but  reducing only the bitrate, I get the same high failure rate!

  • BR=55555, Fdev=50000, RxBw=125kHz: Failure rate <2% (with frequency calibrated or uncalibrated)
  • BR=1200, Fdev=50000, RxBw=125kHz: Failure rate ~7% (with frequency calibrated)
  • BR=1200, Fdev=2000, RxBw=10kHz: Failure rate ~7%(with frequency calibrated)

Any ideas?

Best regards

Fernando


 

emjay

  • Full Member
  • ***
  • Posts: 119
  • Country: nl
Re: Long Range parameters for RFM69HW (868 / 915 MHz)
« Reply #8 on: July 21, 2016, 01:54:29 PM »
@Fernando,

Ok, we have some clues to the local noise floor level:

I can receive correctly signals with RSSI lower than -90dBm.

Try changing the default RegRssiThresh (0x29) to -95dBm  - the weak packets will still get through.

fgomes

  • Jr. Member
  • **
  • Posts: 65
Re: Long Range parameters for RFM69HW (868 / 915 MHz)
« Reply #9 on: July 21, 2016, 04:14:48 PM »
@emjay, thanks again for your support. I understand that the noise floor should be around that level (the weakest messages received) but since the threshold is now at -110dBm and I don't receive the messages that for sure have a much stronger signal, I don't understand what will be the benefit of raising the RSSI threshold, what is the impact of using an higher RSSI threshold, isn't it only used to automatically discard messages with signal below it?

Nevertheless I'll try it! :-)

Best regards

Fernando

fgomes

  • Jr. Member
  • **
  • Posts: 65
Re: Long Range parameters for RFM69HW (868 / 915 MHz)
« Reply #10 on: July 21, 2016, 08:18:56 PM »
The problem of loosing acks seems to be related to the canSend() function continue to say that the RSSI is high for a long time after the RF signal has disappeared (it takes a second and exits by timeout - RF69_CSMA_LIMIT_MS, but during this second there is no RF activity, observed on SDR#). This only happens at 1200bps, not at 55555bps (lib default). In that situation, the gateway sends the acks to late. I've changed the sendWithRetry timeout processing in order to be able to have more than 1 second timeout, and it is working with 0 failures with the same setup, with BR=1200, RxBw=5000Hz, FDev=2000.

Why could the RSSI level get stucked when working at 1200bps with no RF activity present? Could this be an HW problem with some nodes? I've changed the gateway to other node and the results are similar, now more than 400 messages have been transmitted with this second setup without any failure, but always with the ack delayed a second (RF69_CSMA_LIMIT_MS timeout, RSSI during this second was constant and equal to the received message RSSI).

It seems that might be related to this post, but I don't want to remove the CSMA feature: https://lowpowerlab.com/forum/moteino/moteino-rfm69-ack-delay/msg10348/#msg10348

Best regards

Fernando
« Last Edit: July 21, 2016, 09:11:22 PM by fgomes »

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: Long Range parameters for RFM69HW (868 / 915 MHz)
« Reply #11 on: July 21, 2016, 09:08:54 PM »
I'm not convinced that the RSSI reading function works as intended, I had major problems with it. I also had problems receiving packets when transitioning from STANDBY to RX mode (which is supposed to reset the receiver), however transitioning from SLEEP to RX works. I think there is a bug in the silicon. Some more info here:
https://lowpowerlab.com/forum/moteino/communication-only-works-one-way-regardless-of-device/45/
Mark.

fgomes

  • Jr. Member
  • **
  • Posts: 65
Re: Long Range parameters for RFM69HW (868 / 915 MHz)
« Reply #12 on: July 23, 2016, 07:58:43 AM »
Thanks for your reply. I just removed the readRSSI call from canSend, and the nodes have transmitted now more than 2000 messages without any lost message or acknowledge (code below).

Of course there are only two nodes, the CSMA is not a critical function and that is why this patch didn't have secondary effects, if it was a more complex network there could be collision problems.

As I posted before, I'm observing that without this patch the readRSSI reports always the RSSI of the received message and the ACK only goes out by timeout. This only occurs when I reduce the bitrate to 1200 (BR=1200, Fdev=2000, RxBw=5kHz). I've also noticed that with the standard configuration (BR=55555, Fdev=50000, RxBw=125kHz) I had a failure rate between 1 and 2%, now removing the RSSI reading from the canSend function the failure rate is also zero (no failed messages in thousands of transmitted messages).

My "conclusion" with these test results are that the readRSSI gets frequently stuck RSSI levels, that will cause the failing to transmit the ack on time because the node thinks the network is still busy, and that this problem is much worse with a low bit rate (1200bps) but still occurs sometimes with the default bitrate (55555bps).

About the use of sleep instead of standby patch in order to get a correct rssi reading, I've seen several references to it done in different ways, is there any recommendation for it for the stuck RSSI level before the ack transmission?

Thanks in advance!

Fernando

Code: [Select]
bool RFM69::canSend()
{
  if (_mode == RF69_MODE_RX && PAYLOADLEN == 0 /* && readRSSI() < CSMA_LIMIT */) // if signal stronger than -100dBm is detected assume channel activity
  {
    setMode(RF69_MODE_STANDBY);
    return true;
  }
  Serial.println(readRSSI());
  return false;
}

fgomes

  • Jr. Member
  • **
  • Posts: 65
Re: Long Range parameters for RFM69HW (868 / 915 MHz)
« Reply #13 on: July 23, 2016, 09:24:05 AM »
In order to try the sleep vs standby patch I introduced the change in the beginning of the receiveBegin function, as @kolaf stated here:

https://lowpowerlab.com/forum/moteino/communication-only-works-one-way-regardless-of-device/msg13193/#msg13193

The receiveBegin code is the following:

Code: [Select]
void RFM69::receiveBegin() {

  // As sugested in https://lowpowerlab.com/forum/moteino/communication-only-works-one-way-regardless-of-device/msg13193/#msg13193
  setMode(RF69_MODE_SLEEP);
  setMode(RF69_MODE_STANDBY);

  DATALEN = 0;
  SENDERID = 0;
  TARGETID = 0;
  PAYLOADLEN = 0;
  ACK_REQUESTED = 0;
  ACK_RECEIVED = 0;
  RSSI = 0;
  if (readReg(REG_IRQFLAGS2) & RF_IRQFLAGS2_PAYLOADREADY)
    writeReg(REG_PACKETCONFIG2, (readReg(REG_PACKETCONFIG2) & 0xFB) | RF_PACKET2_RXRESTART); // avoid RX deadlocks
  writeReg(REG_DIOMAPPING1, RF_DIOMAPPING1_DIO0_01); // set DIO0 to "PAYLOADREADY" in receive mode
  setMode(RF69_MODE_RX);
}

With this change the RSSI stuck problem seems to disappear. Statistically it seems a bit worst than the dirty patch I made before (transmitting ignoring the RSSI level) but the failure rate is really low, so only with a long observation time it might have some meaning (I have now one failure in 400 messages, ignoring the RSSI I had 0 failures in more than 4000 messages, but of course there could be some radio interference or any other issue).

Then I have removed the setMode(RF69_MODE_STANDBY), as sugested by @perky to @kalaf, the test is running and it seems to give the same results (for now 0 failures with more than 400 messages transmitted)

So for now I'll keep this implementations and will keep an eye on the failures to see if there are no secondary effects or long term stability issues. This is the receiveBegin code I'm currently using:

Code: [Select]
void RFM69::receiveBegin() {

  // As sugested in https://lowpowerlab.com/forum/moteino/communication-only-works-one-way-regardless-of-device/msg13193/#msg13193
  setMode(RF69_MODE_SLEEP);

  DATALEN = 0;
  SENDERID = 0;
  TARGETID = 0;
  PAYLOADLEN = 0;
  ACK_REQUESTED = 0;
  ACK_RECEIVED = 0;
  RSSI = 0;
  if (readReg(REG_IRQFLAGS2) & RF_IRQFLAGS2_PAYLOADREADY)
    writeReg(REG_PACKETCONFIG2, (readReg(REG_PACKETCONFIG2) & 0xFB) | RF_PACKET2_RXRESTART); // avoid RX deadlocks
  writeReg(REG_DIOMAPPING1, RF_DIOMAPPING1_DIO0_01); // set DIO0 to "PAYLOADREADY" in receive mode
  setMode(RF69_MODE_RX);
}

If I noticed any issue I'll let you know. And if anyone wants that I make any specific test related with this issue please let me know :-)

Best regards

Fernando

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: Long Range parameters for RFM69HW (868 / 915 MHz)
« Reply #14 on: July 23, 2016, 10:54:34 AM »
Well done. There definitely seems to be an issue with this STANDBY to RX not fully resetting the receiver. Glad you got it going.
Mark.