Author Topic: RFM69 868MHz in a temperature different environments  (Read 1445 times)

creagel

  • Newbie
  • *
  • Posts: 6
RFM69 868MHz in a temperature different environments
« on: February 16, 2018, 02:40:15 PM »
Hello,

 I am testing RFM69 (868MHz) on nodes, some of these nodes are located indoor (environment temperature 22C) and some are located outdoor (environment temperature -5C).

 The problem is, that so different temperatures causes significant problem with wireless communication.

 I know it's a problem with an internal oscillator. In the library are 2 functions: readTemperature() and rcCalibration(). But what is the correct use of callibration in the program? I have been looking for some examples, but I can not find anything. I was reading this: https://lowpowerlab.com/forum/moteino/extended-rfm69-lib-functions-added/msg313/#msg313    But I'm not wise enough.

I was trying something like this (with or without re-initialization of radio):

Code: [Select]
// run this function every 10s (environmental temperatures are changed quickly -  node is moved from inside to outside)
void radioCalibration() {
    radio.rcCalibration();
    delay(5);
    radio.initialize(WIRELESS_FREQUENCY, WIRELESS_NODE_ID, WIRELESS_NET_ID);
    radio.encrypt(WIRELESS_ENCRYPTKEY);
}

If the module is warming up (eg between fingers) it works much better /outside/ :) What is the right calibration procedure?

Thanks
« Last Edit: February 16, 2018, 05:24:45 PM by Felix »

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: RFM69 868MHz in a temperature different environments
« Reply #1 on: February 16, 2018, 08:01:30 PM »
The calibration is for the RC oscillator, see this particular post from john k20x on that thread. The problem will be the 32MHz crystal, which although is +/-10ppm absolute has a +/-20ppm temperature drift, and so the transmit and receive frequencies are shifting relative to each other causing the receiver to no longer receive properly:
https://lowpowerlab.com/forum/moteino/extended-rfm69-lib-functions-added/msg429/#msg429

The easiest solution to this is to widen the bandwidth of the receiver and spread the two modulation frequencies apart at the transmitter by increasing FDEV so that this frequency offset is not a problem for the receiver, however the receivers don't really like the two frequencies being too asymmetrical about the receiver's centre frequency so you might need to widen them substantially. Also widening the bandwidth decreases the signal to noise ratio at the receiver and reduces transmission distances. So you really need to use AFC if you want to use narrow band to keep the bandwidths down for distance. You can then in theory use a temperature compensation curve to compensate for the temperature drift, and reduce the absolute offset by calibrating to a tight tolerance transmission frequency. See this post for a little more info:

https://lowpowerlab.com/forum/rf-range-antennas-rfm69-library/definition-of-rxbw-with-rfm69/msg20535/#msg20535

Mark.


creagel

  • Newbie
  • *
  • Posts: 6
Re: RFM69 868MHz in a temperature different environments
« Reply #2 on: February 17, 2018, 01:08:02 PM »
I found this thread:

https://lowpowerlab.com/forum/moteino/freq-vs-temperature-update/msg9787/#msg9787

I'm sure it should be enough to measure the temperature of the environment (currently I have DS18B20), calculate frequency and set?

Somethink like:

Code: [Select]
void radioCalibration() {
   byte temp = getTemp();
   float adjFreq = ((0.1007*pow(temp,3))-(8.0022*pow(temp,2))-(100.06*temp)+5540.2);
   long newFreq = round((868000000 - adjFreq);
   radio.setFrequency(newFreq);
}

But I tried it, and sadly without success (indoor unit with outdoor does not communicate at 15m).




I am trying to make the longest possible connection (RegBitrateMsb: 1200, RegFdevMsb: 2000)
« Last Edit: February 17, 2018, 01:12:14 PM by creagel »

LukaQ

  • Sr. Member
  • ****
  • Posts: 283
  • Country: si
Re: RFM69 868MHz in a temperature different environments
« Reply #3 on: February 17, 2018, 01:41:31 PM »
I am trying to make the longest possible connection (RegBitrateMsb: 1200, RegFdevMsb: 2000)
Go the other way first, 55kb and 50kHz

creagel

  • Newbie
  • *
  • Posts: 6
Re: RFM69 868MHz in a temperature different environments
« Reply #4 on: February 17, 2018, 02:36:43 PM »
Go the other way first, 55kb and 50kHz

But the frequency problem will be similar.

LukaQ

  • Sr. Member
  • ****
  • Posts: 283
  • Country: si
Re: RFM69 868MHz in a temperature different environments
« Reply #5 on: February 17, 2018, 03:14:48 PM »
With wider Fdev, you should be able to get signal with its drift into band. I can tell you this, that I wasn't able to get any connection at all one node next to other with 1200 and 2000. Only at 4.8k and higher I was able to get signal through. This wasn't long range test at all, but... What is you temp (in/out) difference? I could check on my, if I have one node in, one out and have about 20k difference

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: RFM69 868MHz in a temperature different environments
« Reply #6 on: February 17, 2018, 03:37:58 PM »
You'll not be able to get such narrow band to work properly without AFC, and you'll need to set RxBwAfc wide enough to capture the signal.

The crystal you have is unlikely to match that polynomial curve exactly, so there'll still be errors due to temperature. The absolute frequency difference might also be too big to get reliable communications without AFC either. So enable AFC (which might mean you need more bytes of preamble, there's a formula in the datasheet to calculate that but it could be up to 5 bytes). Also increase RxBwAfc.

Mark.

creagel

  • Newbie
  • *
  • Posts: 6
Re: RFM69 868MHz in a temperature different environments
« Reply #7 on: February 17, 2018, 05:13:10 PM »
As I wrote:

temperature inside: temperature 22C (71.6 F)
temperature outside: temperature -5C (23 F)

Temperature difference: 27C (48.6F).

The RF69 module is configured by the RF69 library to always use AFC. It's not so? I am looking into the RFM69 datasheet, but I do not know what to look for :(

Ad)  RxBwAfc - default value is 0x80. So "wide enough" It can be in my case eg. "0xE0" (max), but at the expense of lower sensitivity? Preamble size is by default 3 (at address 0x2d)?

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: RFM69 868MHz in a temperature different environments
« Reply #8 on: February 18, 2018, 04:37:50 PM »
The RF69 module is configured by the RF69 library to always use AFC. It's not so? I am looking into the RFM69 datasheet, but I do not know what to look for :(

Ad)  RxBwAfc - default value is 0x80. So "wide enough" It can be in my case eg. "0xE0" (max), but at the expense of lower sensitivity? Preamble size is by default 3 (at address 0x2d)?

I'm confused by this, the default power up 'built-in' value of the sx1231h for RxBwAfc is 0b10001011 (0x8B), with a recommended default value of 0b10001010 (0x8A). Also the LowPowerLab doesn't set this RxBwAfc register that I can see, so presumably is still the built-in power up of 0x8B.

Also LowPowerLab library doesn't appear to set the AfcAutoOn or AfcAutoclearOn bits of the the REG_AFCFEI register either (register 0x1e) which are usually needed to enable AFC, so AFC is by default disabled (is this correct Felix? Is it done somewhere else?)

I assume you've changed the values for BR and FDEV as well from the LowPowerLab library defaults, and have also changed RxBwAfc too. If 0x80 is in this register it has set the RxBwAfc to 500kHz, which is way bigger than your narrow band signal and is likely to pick up a load of other noise from outside your signal bandwidth, and if you haven't set the AfcAutoOn and AfcAutoclearOn bits in REG_AFCFEI then AFC is not enabled (I'm assuming in all this you don't use the AfcStart bit in that register which is difficult to use).

So to fix your problem I'd suggest the following register settings to start with. The local oscillator offset is the combination of absolute, temperature and say 2 year ageing drifts of the crystal and is about (10+20+4)*2 PPM worst case if both were at the oppoosite ends of the drift, i.e. 60kHz at 868MHz. If the gateway is normally close to room temperature that could be reduced to (10+10+4)*2 PPM or about 42kHz.

turn on AFC:
1) Set REF_AFCFEI (register 0x1E) to 0x0C to set the AfcAutoOn and AfcAutoclearOn bits to turn on AFC

set 2000Hz for FDEV:
2) Set REG_FDEVMSB (register 0x05) to 0x00
3) Set REG_FDEVLSB (register 0x06) to 0x20

set 1200Hz bit rate:
4) Set REG_BITRATEMSB (register 0x03) to 0x68
5) Set REG_BITRATELSB (register 0x04) to 0x2A

Set RxBw to 3100Hz: (> (FDVEV +BR/2)):
6) set REG_RXBW (register 0x19) to 0x4F

Set RxBwAfc to 50kHz: (> (FDVEV +BR/2 + 42000)):
7) Set REG_RXBWAFC (register 0x1A) to 0x4B

It's an interesting question about the effect of a wider RxBwAfc on sensitivity. I think this can reliably do an AFC with signal to noise levels significantly below that needed to actually demodulate data with an acceptable bit error rate, because it is effectively trying to find the centre frequency between the two modulation frequencies by successively averaging over 3 bytes of known preamble pattern. This isn't quantified in the specifications, but I suspect this is why AFC is actually used.

Edit: You should check by calculating the required preamble length from the formula in the datasheet. It may be that the default of 3 is not enough for such narrow band signals.

Mark.
« Last Edit: February 18, 2018, 06:22:55 PM by perky »

LukaQ

  • Sr. Member
  • ****
  • Posts: 283
  • Country: si
Re: RFM69 868MHz in a temperature different environments
« Reply #9 on: February 19, 2018, 03:37:40 AM »
Also on standary settings, 0C out, ~23C in and it works just ok

creagel

  • Newbie
  • *
  • Posts: 6
Re: RFM69 868MHz in a temperature different environments
« Reply #10 on: February 19, 2018, 06:18:33 PM »
Today I did a new tests:

1) Default settings on 868mhz (without ATC and ACK).
a) 2m distance between nodes, the same temperatures (22C, rssi -30)
    - works fine

b) 3m distance between nodes, temperature difference 27C /-5C +22C / ( rssi -55)
    - works fine

c) 15m distance between nodes, temperature difference 27C /-5C +22C / ( rssi -85)
    - works fine

d) 80m distance between nodes, temperature difference 27C /-5C +22C / ( rssi -92)
    - weakly working (received just every 5th packet)


2) Recommended settings by "perky" on 868mhz: default preamble size and with 5B preamble size (results are the same) - without ATC and ACK:

a) 2m distance between nodes, the same temperatures (22C, rssi -30)
    - not working (only 1 packet received) /????/

b) 3m distance between nodes, temperature difference 27C /-5C +22C / ( rssi -55)
    - worked, but rather than with default settings (received just every 2nd or 3rd packet)

c) 15m distance between nodes, temperature difference 27C /-5C +22C / ( rssi ??)
    - not working (0 packets received)

d) 80m distance between nodes, temperature difference 27C /-5C +22C / ( rssi ??)
    - not tested

I am using 1/4 wavelength antenna (straight Cu wire).

I expected that the adjusted setting (especially the lowest bitrate) would bring the longest connection, but the opposite is true. I missed something?

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: RFM69 868MHz in a temperature different environments
« Reply #11 on: February 19, 2018, 07:33:07 PM »
With AFC you should set the RSSI threshold register above the noise floor as it will trigger the AFC when it sees an incoming packet above the threshold. Try setting REG_RSSITHRESH (register 0x29) to something smaller than the library default of 220  (-110dB), try for example 160 (-80dB). It's possible the receiver is triggering on noise.

BTW personally I would turn data whitening on, which means replacing RF_PACKET1_DCFREE_OFF with RF_PACKET1_DCFREE_WHITENING in REG_PACKETCONFIG1 (register 0x37). That'll make it possible to send lots of 0's or 1's in the data payload.

Here is an excellent application note for Freescale chips that use the same silicon as the RFM69, there's lots of useful information in here:
http://cache.freescale.com/files/rf_if/doc/app_note/AN4983.pdf

Mark.


« Last Edit: February 19, 2018, 08:15:58 PM by perky »

LukaQ

  • Sr. Member
  • ****
  • Posts: 283
  • Country: si
Re: RFM69 868MHz in a temperature different environments
« Reply #12 on: February 20, 2018, 04:02:07 AM »
With your settings for sender and gateway, I don't get anything through.
And the only thing I'm sure is that sender has 32.0003MHz clock, gateway has 32.0000MHz.
With low bitrates and how Fdev, and bandwidth, I never get packets through. At a bit higher, 9.6kb/s and 10-20k for fdev, I get packets, but ACK doesn't go back to sender

creagel

  • Newbie
  • *
  • Posts: 6
Re: RFM69 868MHz in a temperature different environments
« Reply #13 on: February 25, 2018, 01:22:23 PM »
Today I have tried another combination of settings. Indoor temperature is the same 22C, but outdoor temperature drops to -11C.
With default settings (only with encryption and without ATC) I am able to create faultless connection up to 400m (direct line of sight).
But just behind the horizon the connection will be lost.

I've also experienced connections at 1200bps. Indoor connection is not problem (when I changed REG_RSSITHRESH to 160). But Indoor <--> Outdoor connection is possible only for very short time (probably than the crystal cools enough) (tested only few meters from indoor unit).

I start doubting, that is impossible connection at low speeds under these conditions :/ My goal was 500m without direct line of sight (quiet at low speed), but it's probably impossible :(

juan3211

  • Newbie
  • *
  • Posts: 15
Re: RFM69 868MHz in a temperature different environments
« Reply #14 on: September 14, 2018, 10:07:10 AM »
Hi, I am interested also in this post. Any more news ?

Thanks