Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Feature Requests
  3. RFM69 RSSI value report

RFM69 RSSI value report

Scheduled Pinned Locked Moved Feature Requests
41 Posts 11 Posters 15.8k Views 12 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lafleur
    wrote on last edited by
    #6

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

    scalzS 1 Reply Last reply
    0
    • L lafleur

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

      scalzS Offline
      scalzS Offline
      scalz
      Hardware Contributor
      wrote on last edited by
      #7

      @lafleur said:

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

      Like which features?

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lafleur
        wrote on last edited by
        #8

        RSSI......

        1 Reply Last reply
        0
        • rmtuckerR Offline
          rmtuckerR Offline
          rmtucker
          wrote on last edited by
          #9

          Has Rssi been added to mysensors 2.1 ?

          M J 2 Replies Last reply
          0
          • rmtuckerR rmtucker

            Has Rssi been added to mysensors 2.1 ?

            M Offline
            M Offline
            mihai.aldea
            wrote on last edited by
            #10

            @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".

            1 Reply Last reply
            0
            • scalzS Offline
              scalzS Offline
              scalz
              Hardware Contributor
              wrote on last edited by
              #11

              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.

              1 Reply Last reply
              2
              • rmtuckerR Offline
                rmtuckerR Offline
                rmtucker
                wrote on last edited by
                #12

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

                1 Reply Last reply
                0
                • scalzS Offline
                  scalzS Offline
                  scalz
                  Hardware Contributor
                  wrote on last edited by scalz
                  #13

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

                  M 1 Reply Last reply
                  0
                  • scalzS scalz

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

                    M Offline
                    M Offline
                    mihai.aldea
                    wrote on last edited by
                    #14

                    @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?

                    1 Reply Last reply
                    0
                    • hekH Offline
                      hekH Offline
                      hek
                      Admin
                      wrote on last edited by
                      #15

                      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.

                      M 1 Reply Last reply
                      0
                      • hekH hek

                        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.

                        M Offline
                        M Offline
                        mihai.aldea
                        wrote on last edited by
                        #16

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

                        mfalkviddM 1 Reply Last reply
                        0
                        • M mihai.aldea

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

                          mfalkviddM Offline
                          mfalkviddM Offline
                          mfalkvidd
                          Mod
                          wrote on last edited by
                          #17

                          @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.

                          1 Reply Last reply
                          0
                          • M Offline
                            M Offline
                            mihai.aldea
                            wrote on last edited by
                            #18

                            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.

                            1 Reply Last reply
                            1
                            • rmtuckerR rmtucker

                              Has Rssi been added to mysensors 2.1 ?

                              J Offline
                              J Offline
                              jpaulin
                              wrote on last edited by jpaulin
                              #19

                              @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.

                              rmtuckerR 1 Reply Last reply
                              2
                              • J jpaulin

                                @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.

                                rmtuckerR Offline
                                rmtuckerR Offline
                                rmtucker
                                wrote on last edited by
                                #20

                                @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?

                                J 2 Replies Last reply
                                0
                                • rmtuckerR rmtucker

                                  @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?

                                  J Offline
                                  J Offline
                                  jpaulin
                                  wrote on last edited by jpaulin
                                  #21

                                  @rmtucker Here's the complete sketch. It's a DHT22 temp/humidity battery powered sensor node with an RFM69 radio.

                                  /**
                                   * The MySensors Arduino library handles the wireless radio link and protocol
                                   * between your home built sensors/actuators and HA controller of choice.
                                   * The sensors forms a self healing radio network with optional repeaters. Each
                                   * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                                   * network topology allowing messages to be routed to nodes.
                                   *
                                   * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                                   * Copyright (C) 2013-2015 Sensnology AB
                                   * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                                   *
                                   * Documentation: http://www.mysensors.org
                                   * Support Forum: http://forum.mysensors.org
                                   *
                                   * This program is free software; you can redistribute it and/or
                                   * modify it under the terms of the GNU General Public License
                                   * version 2 as published by the Free Software Foundation.
                                   *
                                   *******************************
                                   *
                                   * REVISION HISTORY
                                   * Version 1.0 - Henrik EKblad
                                   * 
                                   * DESCRIPTION
                                   * This sketch provides an example how to implement a humidity/temperature
                                   * sensor using DHT11/DHT-22 
                                   * http://www.mysensors.org/build/humidity
                                   */
                                  
                                  // Enable debug prints
                                  #define MY_DEBUG
                                  
                                  // Enable and select radio type attached
                                  //#define MY_RADIO_NRF24
                                  #define MY_RADIO_RFM69
                                  
                                  #define MY_RFM69_FREQUENCY   RF69_433MHZ
                                  
                                  #define MY_NODE_ID 13                        // Identity for temp/hum sensor
                                  
                                  // Set blinking period
                                  #define MY_DEFAULT_LED_BLINK_PERIOD 50
                                  
                                  // Flash leds on rx/tx/err
                                  //#define MY_DEFAULT_ERR_LED_PIN 7           // Error led pin  red
                                  //#define MY_DEFAULT_RX_LED_PIN  6           // Receive led pin  yellow
                                  #define MY_DEFAULT_TX_LED_PIN  9             // Transmit led pin  green
                                  
                                  #define MY_WITH_LEDS_BLINKING_INVERSE
                                  
                                  const byte BATT_ADC = 1;                     // ADC Pin to measure battery level
                                  
                                  #include <MySensors.h>
                                  #include <DHT.h>
                                  
                                  
                                  unsigned long SLEEP_TIME = 300000;           // Sleep time between reads (in milliseconds)
                                  
                                  
                                  
                                  #define CHILD_ID_HUM 0
                                  #define CHILD_ID_TEMP 1
                                  #define DHTPIN 18                            // Input pin from DHT22
                                  #define DHT22_PWR 6                          // Vdc pin DHT22 to get it to sleep
                                  #define DHTTYPE DHT22
                                  
                                  DHT dht(DHTPIN, DHTTYPE);
                                  
                                  
                                  #define CHILD_ID_RSSI_HIGH  7                // RSSI received signal level
                                  #define CHILD_ID_RSSI_LOW   8                // RSSI background noise level
                                  #define CHILD_ID_TEMP2      9                // internal temperature RFM69 chip
                                  
                                  int rssi;                                    // RSSI RFM69 chip
                                  int temp2;                                   // Internal temperature RFM69 chip
                                  
                                  int batteryLevel;                            // measured battery level
                                  int batteryPcnt;                             // measured battery level in percentage
                                  
                                  MyMessage msgHum(CHILD_ID_HUM, V_HUM);
                                  MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
                                  
                                  MyMessage msgRSSI1(CHILD_ID_RSSI_HIGH, V_VAR1);
                                  MyMessage msgRSSI2(CHILD_ID_RSSI_LOW, V_VAR1);
                                  MyMessage msgTemp2(CHILD_ID_TEMP2, V_TEMP);
                                  
                                  
                                  void setup()  
                                  { 
                                    pinMode(DHT22_PWR,OUTPUT);
                                    digitalWrite(DHT22_PWR,HIGH);              // power-on dht22
                                    wait(2000);
                                  
                                    dht.begin();                               // Start-up DHT22 sensor Temperature/Humidity
                                  }
                                  
                                  void presentation() 
                                  {
                                    // Send the sketch version information to the gateway and Controller
                                    sendSketchInfo("Temp_Hum", "1.0");
                                  
                                    // Register all sensors to gw (they will be created as child devices)
                                    present(CHILD_ID_HUM, S_HUM);
                                    present(CHILD_ID_TEMP, S_TEMP);
                                  
                                    present(CHILD_ID_RSSI_HIGH, S_CUSTOM);
                                    present(CHILD_ID_RSSI_LOW, S_CUSTOM);
                                    present(CHILD_ID_TEMP2, S_TEMP);
                                  }
                                  
                                  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
                                      wait(200);
                                    }
                                  
                                    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
                                    
                                    rssi = _radio.readRSSI();                  // read RSSI in RFM69. Measure reception signal from gw
                                    send(msgRSSI1.set(rssi));                  // send RSSI level
                                    wait(500);                                 // wait to get idle
                                    
                                    rssi = _radio.readRSSI();                  // read RSSI in RFM69. Wait and measure background noise
                                    send(msgRSSI2.set(rssi));                  // send RSSI level
                                    wait(200);                                 // wait for next send
                                    
                                    temp2 = _radio.readTemperature(1);         // read temperature in RFM69
                                    send(msgTemp2.set(temp2));                 // send temperature
                                  
                                    batteryLevel = analogRead(BATT_ADC);       //  (* 0.0032225806)
                                    batteryPcnt = batteryLevel / 10;           // battery percentage
                                    
                                    sendBatteryLevel(batteryPcnt);             // send battery level in percentage to controller
                                  
                                    // if (oldBatteryPcnt != batteryPcnt) {    // use if not to send every cycle
                                    //     sendBatteryLevel(batteryPcnt);
                                    //     oldBatteryPcnt = batteryPcnt;
                                    // }
                                  
                                    
                                    sleep(SLEEP_TIME);                         // sleep a bit
                                    digitalWrite(DHT22_PWR,HIGH);              // wake up DHT sensor
                                    wait(2000);                                // warm up DHT sensor
                                  }
                                  
                                  void receive(const MyMessage &message) {
                                    // We only expect one type of message from controller. But we better check anyway.
                                    Serial.println("something came in");
                                    
                                    if (message.type==V_VAR1) {                // reception to change SLEEP_TIME.
                                       SLEEP_TIME = message.getULong();        // send topic: eg. my_RFM69_gw1-in/3/1/1/0/24 30000 (payload in ms)
                                     }                                         // MQTT_publish_topic_prefix/Node_Id/Sensor_Id/Cmd_Type/Ack_flag/type(V_VAR1=24) payload
                                  }
                                  
                                  

                                  readRSSI(); is an internal function in the RFM69.h / RFM69.cpp library that I'm calling in the sketch to get the RSSI and background noise level.

                                  rmtuckerR zboblamontZ 2 Replies Last reply
                                  3
                                  • rmtuckerR rmtucker

                                    @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?

                                    J Offline
                                    J Offline
                                    jpaulin
                                    wrote on last edited by jpaulin
                                    #22

                                    @rmtucker Another feature I'm using in the sketch, by calling directly the RFM69 library, is reading the temperature sensor in the RFM69.

                                    temp2 = _radio.readTemperature(1);         // read temperature in RFM69
                                    

                                    The value (1) sent in the call above to the RFM69 library is a calibration in Centigrades (e.g. 1 = +1 °C). Added here to show the possibility to adjust the measured temperature. The temperature sensor on the chip is not as accurate as for example a dht22 and needs sometimes some manual adjustment.

                                    1 Reply Last reply
                                    1
                                    • M Offline
                                      M Offline
                                      mihai.aldea
                                      wrote on last edited by
                                      #23

                                      The onboard temperature sensor is not a cool freebie. It's meant to be a way to check the approximate environmental temperature for the outdoor or industrial devices (not only sensor nodes) using RFM69.

                                      1 Reply Last reply
                                      1
                                      • J jpaulin

                                        @rmtucker Here's the complete sketch. It's a DHT22 temp/humidity battery powered sensor node with an RFM69 radio.

                                        /**
                                         * The MySensors Arduino library handles the wireless radio link and protocol
                                         * between your home built sensors/actuators and HA controller of choice.
                                         * The sensors forms a self healing radio network with optional repeaters. Each
                                         * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                                         * network topology allowing messages to be routed to nodes.
                                         *
                                         * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                                         * Copyright (C) 2013-2015 Sensnology AB
                                         * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                                         *
                                         * Documentation: http://www.mysensors.org
                                         * Support Forum: http://forum.mysensors.org
                                         *
                                         * This program is free software; you can redistribute it and/or
                                         * modify it under the terms of the GNU General Public License
                                         * version 2 as published by the Free Software Foundation.
                                         *
                                         *******************************
                                         *
                                         * REVISION HISTORY
                                         * Version 1.0 - Henrik EKblad
                                         * 
                                         * DESCRIPTION
                                         * This sketch provides an example how to implement a humidity/temperature
                                         * sensor using DHT11/DHT-22 
                                         * http://www.mysensors.org/build/humidity
                                         */
                                        
                                        // Enable debug prints
                                        #define MY_DEBUG
                                        
                                        // Enable and select radio type attached
                                        //#define MY_RADIO_NRF24
                                        #define MY_RADIO_RFM69
                                        
                                        #define MY_RFM69_FREQUENCY   RF69_433MHZ
                                        
                                        #define MY_NODE_ID 13                        // Identity for temp/hum sensor
                                        
                                        // Set blinking period
                                        #define MY_DEFAULT_LED_BLINK_PERIOD 50
                                        
                                        // Flash leds on rx/tx/err
                                        //#define MY_DEFAULT_ERR_LED_PIN 7           // Error led pin  red
                                        //#define MY_DEFAULT_RX_LED_PIN  6           // Receive led pin  yellow
                                        #define MY_DEFAULT_TX_LED_PIN  9             // Transmit led pin  green
                                        
                                        #define MY_WITH_LEDS_BLINKING_INVERSE
                                        
                                        const byte BATT_ADC = 1;                     // ADC Pin to measure battery level
                                        
                                        #include <MySensors.h>
                                        #include <DHT.h>
                                        
                                        
                                        unsigned long SLEEP_TIME = 300000;           // Sleep time between reads (in milliseconds)
                                        
                                        
                                        
                                        #define CHILD_ID_HUM 0
                                        #define CHILD_ID_TEMP 1
                                        #define DHTPIN 18                            // Input pin from DHT22
                                        #define DHT22_PWR 6                          // Vdc pin DHT22 to get it to sleep
                                        #define DHTTYPE DHT22
                                        
                                        DHT dht(DHTPIN, DHTTYPE);
                                        
                                        
                                        #define CHILD_ID_RSSI_HIGH  7                // RSSI received signal level
                                        #define CHILD_ID_RSSI_LOW   8                // RSSI background noise level
                                        #define CHILD_ID_TEMP2      9                // internal temperature RFM69 chip
                                        
                                        int rssi;                                    // RSSI RFM69 chip
                                        int temp2;                                   // Internal temperature RFM69 chip
                                        
                                        int batteryLevel;                            // measured battery level
                                        int batteryPcnt;                             // measured battery level in percentage
                                        
                                        MyMessage msgHum(CHILD_ID_HUM, V_HUM);
                                        MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
                                        
                                        MyMessage msgRSSI1(CHILD_ID_RSSI_HIGH, V_VAR1);
                                        MyMessage msgRSSI2(CHILD_ID_RSSI_LOW, V_VAR1);
                                        MyMessage msgTemp2(CHILD_ID_TEMP2, V_TEMP);
                                        
                                        
                                        void setup()  
                                        { 
                                          pinMode(DHT22_PWR,OUTPUT);
                                          digitalWrite(DHT22_PWR,HIGH);              // power-on dht22
                                          wait(2000);
                                        
                                          dht.begin();                               // Start-up DHT22 sensor Temperature/Humidity
                                        }
                                        
                                        void presentation() 
                                        {
                                          // Send the sketch version information to the gateway and Controller
                                          sendSketchInfo("Temp_Hum", "1.0");
                                        
                                          // Register all sensors to gw (they will be created as child devices)
                                          present(CHILD_ID_HUM, S_HUM);
                                          present(CHILD_ID_TEMP, S_TEMP);
                                        
                                          present(CHILD_ID_RSSI_HIGH, S_CUSTOM);
                                          present(CHILD_ID_RSSI_LOW, S_CUSTOM);
                                          present(CHILD_ID_TEMP2, S_TEMP);
                                        }
                                        
                                        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
                                            wait(200);
                                          }
                                        
                                          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
                                          
                                          rssi = _radio.readRSSI();                  // read RSSI in RFM69. Measure reception signal from gw
                                          send(msgRSSI1.set(rssi));                  // send RSSI level
                                          wait(500);                                 // wait to get idle
                                          
                                          rssi = _radio.readRSSI();                  // read RSSI in RFM69. Wait and measure background noise
                                          send(msgRSSI2.set(rssi));                  // send RSSI level
                                          wait(200);                                 // wait for next send
                                          
                                          temp2 = _radio.readTemperature(1);         // read temperature in RFM69
                                          send(msgTemp2.set(temp2));                 // send temperature
                                        
                                          batteryLevel = analogRead(BATT_ADC);       //  (* 0.0032225806)
                                          batteryPcnt = batteryLevel / 10;           // battery percentage
                                          
                                          sendBatteryLevel(batteryPcnt);             // send battery level in percentage to controller
                                        
                                          // if (oldBatteryPcnt != batteryPcnt) {    // use if not to send every cycle
                                          //     sendBatteryLevel(batteryPcnt);
                                          //     oldBatteryPcnt = batteryPcnt;
                                          // }
                                        
                                          
                                          sleep(SLEEP_TIME);                         // sleep a bit
                                          digitalWrite(DHT22_PWR,HIGH);              // wake up DHT sensor
                                          wait(2000);                                // warm up DHT sensor
                                        }
                                        
                                        void receive(const MyMessage &message) {
                                          // We only expect one type of message from controller. But we better check anyway.
                                          Serial.println("something came in");
                                          
                                          if (message.type==V_VAR1) {                // reception to change SLEEP_TIME.
                                             SLEEP_TIME = message.getULong();        // send topic: eg. my_RFM69_gw1-in/3/1/1/0/24 30000 (payload in ms)
                                           }                                         // MQTT_publish_topic_prefix/Node_Id/Sensor_Id/Cmd_Type/Ack_flag/type(V_VAR1=24) payload
                                        }
                                        
                                        

                                        readRSSI(); is an internal function in the RFM69.h / RFM69.cpp library that I'm calling in the sketch to get the RSSI and background noise level.

                                        rmtuckerR Offline
                                        rmtuckerR Offline
                                        rmtucker
                                        wrote on last edited by
                                        #24

                                        @jpaulin
                                        Just wanted to thank you for taking the time to post your example for rssi.
                                        I have just finished putting my new rfm69 gateway together and about to start assembling a new node to try everything out.
                                        I will let you know how i get on.

                                        1 Reply Last reply
                                        0
                                        • G Offline
                                          G Offline
                                          gieemek
                                          wrote on last edited by gieemek
                                          #25

                                          In the 2.2 version of MySensors (development branch) the new driver for RFM69 is built. It has new command for reading RSSI value: RFM69_getSendingRSSI() and RFM69_getReceivingRSSI(), so now is very easy to get RSSI value.
                                          You can get some more information from ATC Signal Report which are useful - look at RFM69_RFM95_ATC_SignalReport example.

                                          G gohanG 2 Replies Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          9

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular