Project

General

Profile

Lowering data rate

Added by o_cee almost 6 years ago

I was thinking about lowering the data rate on the RFM12B in order to get some better range out of my nodes. Does the rate has to be set the same for all nodes, as well as the receiving JeeLink?

In the datasheet for the RFM12B on page 37 it says that receiver baseband bandwidth (BW) and transmitter deviation frequency needs to be altered for different data rates, does that apply to both the RX and TX?

What other optimizations are recommended for the RFM12B registers?


Replies (7)

RE: Lowering data rate - Added by martynj almost 6 years ago

@ocee, when any particular pair of transmitter/receiver are talking, the data rate needs to match at both ends. This is because the raw bit modulation of the carrier does not contain enough timing information to extract a data clock along with the data values. The RFM12B is very agile in responding to control register changes, so it is possible to change this data rate between packets if there is some higher level scheme for managing these transitions.

For simple frequency shift keying (FSK), the relationship between carrier deviation, data rate and required bandwidth is quite complex. In general, the faster the carrier is waggled, the broader the frequency will spread at the transmitter, so the receiver needs a wider bandwidth setting to avoid missing information contained in this spread (or ‘sidebands’). But the wider the bandwidth, the more general noise is collected, interfering with the all-important signal-to-noise ratio.

Rather than getting to caught up in the theory, a good short cut is to use the suggested values from the RFM12B spec sheet you reference. The table extracted shows the transmitter deviation and receiver bandwidth optimised (within the granularity of settings available) for various data rates. The graphic shows how the bit error rate (BER) is influenced by the data rate.

Aiming for a BER of better than 1 in a 100, drawing a horizontal line there on the graphic shows how much weaker the received signal can be at the lower data rates (and also diminishing improvements at the very low rates).

A note of caution though - with small receiver bandwidths, the agreement between receiver master clock and transmitter master clock needs to be higher - it may require some fine tuning of the receiver crystal capacitor bank setting to bring the agreement close enough for the AFC to operate correctly.

RE: Lowering data rate - Added by o_cee almost 6 years ago

Thanks. Seems like I’m on the right track then :)

How would the recommended way be to add these control commands to RF12demo, for the JeeLink? Would be neat if you could store extra control commands together with the regular configuration, to avoid special code.

RE: Lowering data rate - Added by dabbishaw almost 6 years ago

o_cee - I had a similar issue, with the default radio settings I couldn’t get 10 meters of range, when I dropped the bandwidth down to about 5 kbps I found 180 meters +. All nodes had to be the same if you wanted them to talk to each other.

The was a huge downside though which I’m still fighting to some degree and that’s the interrupt handling. I found at 5 kbps that every time the roomnode sketch sent a report it also caused a false trigger which made it appear that the PIR had detected motion.

With some experimentation increasing the bandwidth to about 16 kbps made this issue mostly go away, instead of a false interrupt every-time it would take a few hours before it would occur. In the end I had to code around it.

You can add the following to your own setup routine to change the bandwidth -

rf12_control(0xC614);  // 614 = 16.42 kbps bandwitdh (R=20)

See the RFM12b tools to calculate the changed value in the data rate section - http://tools.jeelabs.org/rfm12b.html

RE: Lowering data rate - Added by o_cee almost 6 years ago

This seems to work really well, and increasing the range by a lot it seems.

I added the following according to the spec sheet:

rf12_control(0xC623); //Data Rate = 9.579kbps
rf12_control(0x94C2); //RX Bandwidth 67kHz
rf12_control(0x9820); //Deviation 45kHz

The problem I’m having now, is that showHelp() in RF12demo seems to overwrite these settings when it calls rf12_config().. What would be a good way to add these settings permanently? Calling them in loop() seems excessive, but rf12_config() is called at four different places and these control commands would need to be added after each of them?

RE: Lowering data rate - Added by o_cee almost 6 years ago

It would be quite nice with the possibility to attach to a hook at the end of rf12_initialize(), so that you could add your own function being executed post-init of RFM12b, but I’m not sure if that’s possible with Arduino code?

RE: Lowering data rate - Added by jcw almost 6 years ago

Adding them inside is the same as calling them at the end (unless you change registers which the RF12 driver adjusts while operating).

I’d either add 4 calls after each rf12_config(), or replace them by my_rf12_config() calls with the code inside.

Hooks can be used, but add size overhead (check & call hook) to every use of the RF12 driver, which is undesirable on the ATtiny.

RE: Lowering data rate - Added by o_cee almost 6 years ago

The problem I see is that I now end up with a customised version of RF12demo, which needs to be maintained and updated eventually. Maybe the rate could be configurable in RF12demo, just like node/group/band?

    (1-7/7)