RFM69 433Mhz ISM band
I recently started experimenting with MySensors which works great so far.
While checking the code for the RFM69 driver, I noticed that when frequency setting MY_RFM69_FREQUENCY is set to RF69_433MHZ, the driver will initialize the frequency register (RegFrf) to 0x6C4000 which corresponds to exactly 433.00 Mhz (according to the formula in the datasheet).
However, the 433 ISM band is defined as (https://en.wikipedia.org/wiki/ISM_band) 433.05 MHz - 434.79 MHz with 433.92 MHz center frequency. So it looks like the driver sets a frequency just outside of the band. Would it not be better to initialize with the center frequency?
I would appreciate any feedback as I want to make sure to comply with regulations.
@freynder great observation. The MySensors library should definitely help people stay within regulations.
Chester last edited by
Isn't that what the network ID is for though? I thought the network ID was the channel number within the band....or is it more analogous to the SSID in a WiFi type network?
@Chester network id is part of the preamble/sync. It does not affect frequency.
sure that's better to comply regulations.
It's like this because Mysensors still use Lowpowerlab rfm69 lib, but in future Mysensors rfm69 driver that will be available.
For the moment, you can maybe try something like this in your code :
@Chester you can have multiple separated networks (with different id of course) for the same frequency. but sure, changing a little bit the freq is nice alternative too
Thanks for your feedback.
@scalz: I tried adding
#define RF69_EXACT_FREQ 433920ul
to the gateway and 2 nodes, but it did not seem to work. The nodes could not connect to the gateway. I reverted back for the moment and will do some other tests when I have a better dev environment.
@freynder try 433920000ul
@mfalkvidd Thank you, I misread the comment as kHz. Still not working though. I suppose setup is called only after mysensors initialization so nodes fail to connect since they are not set to the correct frequency.
@freynder I am not sure what order things are executed, but see if it helps putting radio.setFrequency in either preHwInit(), before() or presentation().
oki. i didn't check the code.
The radio frequency is initalized between Before() and Setup()
But changing it like this in the sketch, i'm not sure how it would interact with the state machine, and if it may need to reinit the radio (have no time to test this for the moment).
Also, you can't use transportInitialise for overriding your settings.. because it's hard written in the rfm69 driver:
So if you want to experiment, easier to change the 3 lines above in rfm69 driver.
But then, that will be overwritten when new Mysensors release will happen, as there will be a new driver.
So you can experiment if you're in hurry to comply regulations, or you can wait and play with the settings as they are
@freynder The best solution (for the moment) is to change these defines:
#define RF_FRFMSB_433 0x6C #define RF_FRFMID_433 0x7A #define RF_FRFLSB_433 0xE1
for 433.92 Mhz
As @scalz pointed out, the state machine will re-initialize the radio to the original values if using setFrequency() anywhere in the code. And of course, these changes will be overridden with a new release of MySensors.
Thank you all. I changed the register values directly in the RFM69 driver and it all seems to work.
Hopefully a new release will soon include this (as well as the ATC feature). Also, local legislation specifies maximum transmission power as 10mW for the 433 band, so I included the code below in my sketch. It would be good to be able to configure this in the future as well.
#ifdef MY_IS_RFM69HW _radio.setPowerLevel(16); // 10dBm for RFM69HW #else _radio.setPowerLevel(28); // 10dBm for RFM69W #endif