RFM69 RSSI value report



  • Is there any way for a gateway to read the RSSI value of the remote RFM69 based sensors? RSSI reporting is already available in the driver library, however I can only see RSSI reports when using the libraries Struct_send/Struct_receive example sketches. I tried to trick the sketch to report it, yet unsuccessfull. There are some tweaks for the RF24 networks yet they're not actually RSSI reports but rather transport reliability metrics counting failed against sent packets. But since RFM69 natively supports RSSI and the functions are already there, I believe that it's very simple for someone who knows the arhitecture inside out to add some #define MY_RFM69_RSSI option available to the gateway sketch.
    But meanwhile I wouldn't mind any suggestion as to how could I access the RFM69 library RFM69::readRSSI function and get the values in any form. It would help me a great deal to test various antennas, bitrates, range and penetration for the RFM69 modules.
    RSSI reports of the ACK packets sent back from the gateway would be great too in order to have a clear picture of the two-way communication but let's take it one step at a time :grin:


  • Mod



  • @mfalkvidd Thank you for pointing me to those resources, I finally got them working.
    @scalz Absolutely awesome work :smile:

    Here's a full sketch example using the Si7021 Temp/RH sensor:

    #define MY_NODE_ID 2
    #define MY_DEBUG
    #define MY_RADIO_RFM69
    #define MY_RFM69_FREQUENCY RFM69_433MHZ
    #define MY_IS_RFM69HW 
    #define MY_RFM69_NETWORKID 100
    
    #include <MySensors.h>  
    #include <SPI.h>
    #include <Wire.h>
    #include "Adafruit_Si7021.h"
    unsigned long SLEEP_TIME = 1000;
    Adafruit_Si7021 sensor = Adafruit_Si7021();
    MyMessage msgTemp(1, V_TEMP);
    MyMessage msgRh(2, V_HUM);
    MyMessage msgRSSI(3,V_VAR5);
    float temp;
    float rh;
    boolean requestACK = false;
    int16_t rssiVal
    char rssiStr[10];
    
    void setup()  
    {  
      delay(100);
      sendSketchInfo("Temperature/RH Sensor N2 RFM69", "1.1");
      sensor.begin();
      present(1, S_TEMP);
      present(2, S_HUM);
    }
    
    void loop() {
      rssiVal = transportGetRSSI();
      rh = sensor.readHumidity();
      temp = sensor.readTemperature();
      snprintf(rssiStr,10,"rssi: %d%",rssiVal);
      send(msgTemp.set(temp,2));
      send(msgRh.set(rh,2));
      send(msgRSSI.set(rssiStr));
      sleep(SLEEP_TIME);
    }
    
    

    However, please note that this only works on:
    https://github.com/scalz/Mysensors/tree/rfm69_update2
    and
    http://forum.mycontroller.org/topic/58/download-snapshot-build
    Just drop a reply here and I will happily assist you using the above versions until they will be fully commited.


  • Mod

    Awesome @mihai-aldea
    Great work!


  • Hardware Contributor

    and Kudo to @tekka too ! and @marceloaqno who is also working on the linux part ;)

    that said @mihai-aldea cool you have it working. of course we are interested by feedbacks :)
    There are some defines which may need some adjustements (timeouts) depending on the clock of the mcu (especially for gw). for the moment the latest rev is still local but it does not differ a lot.

    Important note:

    This new version breaks old packet structure. Because there are new values in the packet header : version, sequence number and Rssi.

    Which means if people want to use these new features, it needs all nodes and GW updated.
    As the next release isn't a major one, there will be a switch define, with these new features default disabled. for compatibility with older nodes.



  • Great work, would like to see this added to RFM95 radio code...


  • Hardware Contributor

    @lafleur said:

    Great work, would like to see this added to RFM95 radio code...

    Like which features?



  • RSSI......



  • Has Rssi been added to mysensors 2.1 ?



  • @rmtucker said:

    Has Rssi been added to mysensors 2.1 ?

    Yes. You can pull it using transportGetRSSI(). From there on, use it just as it is or shape it more nicely with a map() function, it's up to you. But please note that 2.1.0 brings some slight changes so if your sketch throws some errors, just read them and change your sketch accordingly. Eg. #define MY_RF69_FREQUENCY RFM69_433MHZ is replaced by #define MY_RFM69_FREQUENCY RFM69_433MHZ, notice the extra "M".


  • Hardware Contributor

    Well, finally we have decided to wait for releasing the new rfm69 drivers.
    Because

    • there was already so much changes/improvements in Mysensors to release.
    • to keep a better history, and the new rfm69 driver has lot of improvements.

    That said, for w5100 users, we have tested the new driver (not the one on my repo) and it works ok with w5100 and rfm69 in hardware spi mode, on same bus, without changing the w5100 lib.

    So Mysensors 2.1 still use the old driver. The new rfm69 driver is planned for 2.2. No eta as far as i know, but with luck, let's see when it will release.



  • I am totally confused now?
    So Rssi data is not available?


  • Hardware Contributor

    @rmtucker no it is not available in 2.1. this will be for 2.2



  • @scalz Just to make it clear. The RFM69 RSSI value is not available in the official MySensors 2.1.0 release but it is available in your GitHub fork here: https://github.com/scalz/Mysensors/tree/rfm69_update2. Is that correct?


  • Admin

    Yes RSSI is a work in progress available in @scalz fork. We didn't have time to test it enough to include it in the 2.1 release.



  • @hek I confirm that the RSSI support works perfect in scalz's fork.


  • Mod

    @mihai.aldea it is not just about verifying RSSI. It is about verifying that the changes don't break anything else for existing users. Unfortunately, the new driver does break things and most users would dislike an upgrade that breaks their existing system.



  • This is perfectly understandable but I merely wanted to give a raw input on the feature status.
    I consider the RSSI values to be paramount when testing MySensors along with new hardware (antennas, wall penetration, registry tweaks etc.) as the simple online/offline node status would not help very much with these scenarios. That's why for the time being I will stick to scalz's rfm69_update2.



  • @rmtucker In my RFM69 sensors using ver2.1 I'm doing as follows to check RSSI and, as well, how to check the background noise level. I have them implemented as two sensor values being reported every 5 minutes in the loop() to the gateway and controller.

    void loop()      
    {
      float humidity = dht.readHumidity();       // get dht22 humidity
      if (isnan(humidity)) {
        Serial.println("Failed reading humidity from DHT");
      } else {
        send(msgHum.set(humidity, 1));           // send dht22 humidity
      }
    
      float temperature = dht.readTemperature(); // get dht22 temperature
      if (isnan(temperature)) {
        Serial.println("Failed reading temperature from DHT");
      } else {
        send(msgTemp.set(temperature, 1));       // send dht22 temperature
      }
      digitalWrite(DHT22_PWR,LOW);               // save some power. Turn off dht22 module.
      
      rssi = _radio.readRSSI();                  // read RSSI in RFM69. Measure reception signal level from gw
      send(msgRSSI1.set(rssi));                  // send RSSI, signal level to gateway
    
      wait(500);                                 // wait to get idle
      rssi = _radio.readRSSI();                  // read RSSI in RFM69. Measure background noise
      send(msgRSSI2.set(rssi));                  // send RSSI, noise level to gateway
      
      sleep(SLEEP_TIME);                         // sleep a bit
      digitalWrite(DHT22_PWR,HIGH);              // wake up dht22 module
      wait(2000);                                // warm up dht22 module
    }
    

    To get the RSSI value it's read in the sketch ( int rssi = _radio.readRSSI(); ) immediately after sending something, in this case the dht22 temperature. To check the background noise the RSSI level is read again 500ms after being kept idle (probably a shorter waiting period would work as well, but haven't studied it as it's not a critical issue for me). Normally the background noise-floor should be something around -95dBm and -115dBm. If you have some external interference, it could be easily detected with this method.



  • @jpaulin
    Thank you so much for the info that rssi can be extracted in V2.1.0.
    Would you be able to post your full sketch as it would be easier for me to extract the bits i need.?
    I just can not understand why before your answer i was being told it is not possible in V2.1.0 to do this?
    Or does this need another version of the Rfm69 library?


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.