Author Topic: RFM69 general OOK receiver  (Read 2002 times)

largowinch

  • NewMember
  • *
  • Posts: 3
RFM69 general OOK receiver
« on: November 26, 2019, 09:40:05 AM »
Hi,

I want to create a small device to capture (and take some actions) OOK signal coming from various cheap remote controllers working with 433.92MHz.

I've selected the Blue Pill and the RFM69 as hardware for my project. The RFM69 allows me to receive and transmit the signal and can be use to send command to Somfy devices 433.42MHz.  I've migrated some code to the STM32 and succeeded to capture a signal with this configuration (thanks to this article http://members.home.nl/hilcoklaassen/index.html).

Now, I'm trying to decode the captured signal but I've a little issue with this signal. A picture from my logic analyzer is attached below.



On this image, the upper signal (in yellow) comes from the RFM69 and the lower signal (in green) comes from a Super Heterodyne RXB6 device. The rising edge of the RXB6 signal comes earlier than the rising edge of the RFM69 signal. However, the falling edge occurs at the same time. That means that the timing is no more correct and the algorithm can't identify the used protocol. Signal high is about 330µs for RXB6 and 230µs for RFM69.

Any idea about this phenomenon ?

Thanks
« Last Edit: November 26, 2019, 09:59:55 AM by largowinch »

largowinch

  • NewMember
  • *
  • Posts: 3
Re: RFM69 general OOK receiver
« Reply #1 on: November 28, 2019, 04:59:12 PM »
Hi,

I've investigated deeper my issue and I think it's related to the bit rate configuration of the RFM69. By default the bit rate is set to 4.8kb/s which means 208µs per sample. This was too large to capture a signal with 260µ pulse length. I've changed to 32kb/s (31µs) and new I can capture a perfect signal. The signal from the RFM69 is even better than the one from the RXB6 ! In both picture attached, the first picture shows that the first occurrence of the signal for the RXB6 is very bad. That's probably the reason why the signal is repeated 4 times by the remote... On the second picture, you can see that the rising edge of both signals are synchronized. Falling edge are different but it seems that the RFM69 has a better accuracy as the pulse length should be 260µs for the DIO remote control and I get 250µs for the RFM69 against 340µs for the RXB6...

I've also added a calibration step to get the continuous OOK working independently of the environment (noise). In this step, I measure the RSSI during 1 second (it works only if no signal is emitted during this calibration period) and then use the result value to fix the threshold. Here is a fragment of my code:
Code: [Select]
   o_usart.puts("Trying to calibrate RFM69 RSSI\n");
   int i_rssiAverage = 0;
   for (int i_loop = 0; i_loop < 100; i_loop++) {
      i_rssiAverage += o_rfm69.readRSSI(false);
      msleep(10);
   }
   i_rssiAverage /= 100;
   o_usart.printf("Average RSSI=%d\n", i_rssiAverage);

   /* should be average RSSI when no signal + 20dB (~ -80dB in my case) */
   o_rfm69.setFixedThreshold(i_rssiAverage + 20);

With this configuration, I receive a perfect signal without any glitch.
Note I have to modify the setFixedThreshold() method to allow the parameter to be expressed in dB. The method now convert the dB to the RFM69 format as it was done for the setRssiThreshold(). This wasn't described in the datsheet but it seems to work...
« Last Edit: November 29, 2019, 03:52:12 AM by largowinch »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: RFM69 general OOK receiver
« Reply #2 on: November 29, 2019, 10:26:24 AM »
largowinch,
What library are you using in the code snippet you included in your post above?

largowinch

  • NewMember
  • *
  • Posts: 3
Re: RFM69 general OOK receiver
« Reply #3 on: November 30, 2019, 11:10:25 AM »
Hi Felix,

It's a home made library for the STM32 µC based on several sources found on the RFM69.

My objectif is to be able to control several DIO power plugs and my Somfy blades. As the RFM69 can operate at 433,92MHz and 433,42Mhz, it was my favorite choice (instead of changing the oscillator of an existing emitter). But receiving a signal in continuous OOK mode is not so easy: a lot of registers must be configured properly and the datasheets are blurred in this domain.

By the way, is the pulse period fixed by the bit rate ? When I'm trying to capture a signal from my DIO remote, I can see pulses with 242µs, 246µs, 232µs, 237µs... length. As the bit rate was fixed to 32kb/s, I was expected to get pulses length multiple of 31,25µs (i.e. 219µs, 250µs or 281µs). My logic analyzer is configured at 50Mhz which means is able to measure 20ns pulse signal...

If I fix the bit rate to 8kb/s, the observed pulses length vary with values 230µs, 245µs and 250µs.


Update: reading the datasheet about the bit rate, we can see this for register 0x03 and 0x04:
Quote
MSB & LSB of Bit Rate (Chip Rate when Manchester encoding is enabled)

Assuming the continuous OOK mode is used and Manchester encoding is only available in packet mode, the bit rate has no impact on the sampling?
I've read a lot of code using RFM69 continuous OOK, setting the bit rate for optimal reception. Was it useless? Has someone information on this?

Thanks
« Last Edit: December 02, 2019, 04:47:14 AM by largowinch »