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. Troubleshooting
  3. Air Humidity Sensor can't reach Gateway

Air Humidity Sensor can't reach Gateway

Scheduled Pinned Locked Moved Troubleshooting
8 Posts 4 Posters 2.1k Views 3 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.
  • E Offline
    E Offline
    egfku
    wrote on last edited by
    #1

    Hi folks,

    I'm just getting started and having a hard time getting my Arduino Pro Mini talking to my Raspberry pi running Domoticz. Both client and gateway are using the nRF24L01+ module.

    I have a DHT22 sensor connected to the Arduino and can confirm that it's reading values correctly (using a DHT example). I'm now running the following code, adapted from the Air Humidity examples page:

    /**
     * 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
     * Version 1.1 - 2016-07-20: Converted to MySensors v2.0 and added various improvements - Torben Woltjen (mozzbozz)
     * 
     * DESCRIPTION
     * This sketch provides an example of how to implement a humidity/temperature
     * sensor using a DHT11/DHT-22.
     *  
     * For more information, please visit:
     * http://www.mysensors.org/build/humidity
     * 
     */
    
    // Enable debug prints
    #define MY_DEBUG
    
    #define MY_NODE_ID 255
    #define MY_PARENT_NODE_ID 0
    #define MY_PARENT_NODE_IS_STATIC
    
    // Enable and select radio type attached 
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    //#define MY_RS485
    
    //#define MY_RF24_PA_LEVEL RF24_PA_MAX
    #define MY_RF24_PA_LEVEL RF24_PA_MAX
    #define MY_RF24_DATARATE RF24_2MBPS
     
    #include <SPI.h>
    #include <MySensors.h>  
    #include <DHT.h>
    
    // Set this to the pin you connected the DHT's data pin to
    #define DHT_DATA_PIN 3
    
    // Set this offset if the sensor has a permanent small offset to the real temperatures
    #define SENSOR_TEMP_OFFSET 0
    
    // Sleep time between sensor updates (in milliseconds)
    // Must be >1000ms for DHT22 and >2000ms for DHT11
    static const uint64_t UPDATE_INTERVAL = 5000;
    
    // Force sending an update of the temperature after n sensor reads, so a controller showing the
    // timestamp of the last update doesn't show something like 3 hours in the unlikely case, that
    // the value didn't change since;
    // i.e. the sensor would force sending an update every UPDATE_INTERVAL*FORCE_UPDATE_N_READS [ms]
    static const uint8_t FORCE_UPDATE_N_READS = 10;
    
    #define CHILD_ID_HUM 10
    #define CHILD_ID_TEMP 11
    
    float lastTemp;
    float lastHum;
    uint8_t nNoUpdatesTemp;
    uint8_t nNoUpdatesHum;
    bool metric = true;
    
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    DHT dht;
    
    
    void presentation()  
    { 
    
      // Send the sketch version information to the gateway
      sendSketchInfo("TemperatureAndHumidity", "1.1");
      
      // Register all sensors to gw (they will be created as child devices)
      present(CHILD_ID_HUM, S_HUM);
      present(CHILD_ID_TEMP, S_TEMP);
      
      metric = getControllerConfig().isMetric;
    }
    
    
    void setup()
    {
      dht.setup(DHT_DATA_PIN); // set data pin of DHT sensor
      if (UPDATE_INTERVAL <= dht.getMinimumSamplingPeriod()) {
        Serial.println("Warning: UPDATE_INTERVAL is smaller than supported by the sensor!");
      }
      // Sleep for the time of the minimum sampling period to give the sensor time to power up
      // (otherwise, timeout errors might occure for the first reading)
      sleep(dht.getMinimumSamplingPeriod());
    }
    
    
    void loop()      
    {  
      // Force reading sensor, so it works also after sleep()
      dht.readSensor(true);
      
      // Get temperature from DHT library
      float temperature = dht.getTemperature();
      if (isnan(temperature)) {
        Serial.println("Failed reading temperature from DHT!");
      } else if (temperature != lastTemp || nNoUpdatesTemp == FORCE_UPDATE_N_READS) {
        // Only send temperature if it changed since the last measurement or if we didn't send an update for n times
        lastTemp = temperature;
        if (!metric) {
          temperature = dht.toFahrenheit(temperature);
        }
        // Reset no updates counter
        nNoUpdatesTemp = 0;
        temperature += SENSOR_TEMP_OFFSET;
    
        send(msgTemp.set(temperature, 1));
    
        #ifdef MY_DEBUG
        Serial.print("T: ");
        Serial.println(temperature);
        #endif
      } else {
        // Increase no update counter if the temperature stayed the same
        nNoUpdatesTemp++;
      }
    
      // Get humidity from DHT library
      float humidity = dht.getHumidity();
      if (isnan(humidity)) {
        Serial.println("Failed reading humidity from DHT");
      } else if (humidity != lastHum || nNoUpdatesHum == FORCE_UPDATE_N_READS) {
        // Only send humidity if it changed since the last measurement or if we didn't send an update for n times
        lastHum = humidity;
        // Reset no updates counter
        nNoUpdatesHum = 0;
        send(msgHum.set(humidity, 1));
        
        #ifdef MY_DEBUG
        Serial.print("H: ");
        Serial.println(humidity);
        #endif
      } else {
        // Increase no update counter if the humidity stayed the same
        nNoUpdatesHum++;
      }
    
    
      
      // Sleep for a while to save energy
      sleep(UPDATE_INTERVAL); 
    }
    

    On the Arduino side, I seem to get stuck in a loop where the originating message doesn't get through to my gateway:

    0 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.2.0-beta
    49 TSM:INIT
    51 TSF:WUR:MS=0
    57 TSM:INIT:TSP OK
    59 TSM:INIT:STATID=10
    61 TSF:SID:OK,ID=10
    63 TSM:FPAR
    65 TSM:FPAR:STATP=0
    67 TSM:ID
    67 TSM:ID:OK
    69 TSM:UPL
    98 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1
    2107 TSM:UPL
    2136 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=1,st=NACK:1
    4145 TSM:UPL
    4173 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=2,st=NACK:1
    6184 TSM:UPL
    6213 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=3,st=NACK:1
    8222 !TSM:UPL:FAIL
    8224 TSM:FPAR
    8224 TSM:FPAR:STATP=0
    8226 TSM:ID
    8228 TSM:ID:OK
    8230 TSM:UPL
    8259 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=4,st=NACK:1
    10268 TSM:UPL
    10297 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=5,st=NACK:1
    12306 TSM:UPL
    12335 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=6,st=NACK:1
    14344 TSM:UPL
    14372 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=7,st=NACK:1
    16384 !TSM:UPL:FAIL
    

    Something seems to be getting through to my RPi gateway, though, because Domoticz shows the following:
    0_1496356930318_upload-e38cf963-c71e-44f1-838a-506ca9e1c9d4

    Any suggestions would be very welcome. I've tried adding a capacitor across the power supply as suggested, as well as changing the transmit power levels on the Arduino radio, to no avail.

    Thanks in advance!

    sundberg84S MarikM 2 Replies Last reply
    0
    • E egfku

      Hi folks,

      I'm just getting started and having a hard time getting my Arduino Pro Mini talking to my Raspberry pi running Domoticz. Both client and gateway are using the nRF24L01+ module.

      I have a DHT22 sensor connected to the Arduino and can confirm that it's reading values correctly (using a DHT example). I'm now running the following code, adapted from the Air Humidity examples page:

      /**
       * 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
       * Version 1.1 - 2016-07-20: Converted to MySensors v2.0 and added various improvements - Torben Woltjen (mozzbozz)
       * 
       * DESCRIPTION
       * This sketch provides an example of how to implement a humidity/temperature
       * sensor using a DHT11/DHT-22.
       *  
       * For more information, please visit:
       * http://www.mysensors.org/build/humidity
       * 
       */
      
      // Enable debug prints
      #define MY_DEBUG
      
      #define MY_NODE_ID 255
      #define MY_PARENT_NODE_ID 0
      #define MY_PARENT_NODE_IS_STATIC
      
      // Enable and select radio type attached 
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      //#define MY_RS485
      
      //#define MY_RF24_PA_LEVEL RF24_PA_MAX
      #define MY_RF24_PA_LEVEL RF24_PA_MAX
      #define MY_RF24_DATARATE RF24_2MBPS
       
      #include <SPI.h>
      #include <MySensors.h>  
      #include <DHT.h>
      
      // Set this to the pin you connected the DHT's data pin to
      #define DHT_DATA_PIN 3
      
      // Set this offset if the sensor has a permanent small offset to the real temperatures
      #define SENSOR_TEMP_OFFSET 0
      
      // Sleep time between sensor updates (in milliseconds)
      // Must be >1000ms for DHT22 and >2000ms for DHT11
      static const uint64_t UPDATE_INTERVAL = 5000;
      
      // Force sending an update of the temperature after n sensor reads, so a controller showing the
      // timestamp of the last update doesn't show something like 3 hours in the unlikely case, that
      // the value didn't change since;
      // i.e. the sensor would force sending an update every UPDATE_INTERVAL*FORCE_UPDATE_N_READS [ms]
      static const uint8_t FORCE_UPDATE_N_READS = 10;
      
      #define CHILD_ID_HUM 10
      #define CHILD_ID_TEMP 11
      
      float lastTemp;
      float lastHum;
      uint8_t nNoUpdatesTemp;
      uint8_t nNoUpdatesHum;
      bool metric = true;
      
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      DHT dht;
      
      
      void presentation()  
      { 
      
        // Send the sketch version information to the gateway
        sendSketchInfo("TemperatureAndHumidity", "1.1");
        
        // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID_HUM, S_HUM);
        present(CHILD_ID_TEMP, S_TEMP);
        
        metric = getControllerConfig().isMetric;
      }
      
      
      void setup()
      {
        dht.setup(DHT_DATA_PIN); // set data pin of DHT sensor
        if (UPDATE_INTERVAL <= dht.getMinimumSamplingPeriod()) {
          Serial.println("Warning: UPDATE_INTERVAL is smaller than supported by the sensor!");
        }
        // Sleep for the time of the minimum sampling period to give the sensor time to power up
        // (otherwise, timeout errors might occure for the first reading)
        sleep(dht.getMinimumSamplingPeriod());
      }
      
      
      void loop()      
      {  
        // Force reading sensor, so it works also after sleep()
        dht.readSensor(true);
        
        // Get temperature from DHT library
        float temperature = dht.getTemperature();
        if (isnan(temperature)) {
          Serial.println("Failed reading temperature from DHT!");
        } else if (temperature != lastTemp || nNoUpdatesTemp == FORCE_UPDATE_N_READS) {
          // Only send temperature if it changed since the last measurement or if we didn't send an update for n times
          lastTemp = temperature;
          if (!metric) {
            temperature = dht.toFahrenheit(temperature);
          }
          // Reset no updates counter
          nNoUpdatesTemp = 0;
          temperature += SENSOR_TEMP_OFFSET;
      
          send(msgTemp.set(temperature, 1));
      
          #ifdef MY_DEBUG
          Serial.print("T: ");
          Serial.println(temperature);
          #endif
        } else {
          // Increase no update counter if the temperature stayed the same
          nNoUpdatesTemp++;
        }
      
        // Get humidity from DHT library
        float humidity = dht.getHumidity();
        if (isnan(humidity)) {
          Serial.println("Failed reading humidity from DHT");
        } else if (humidity != lastHum || nNoUpdatesHum == FORCE_UPDATE_N_READS) {
          // Only send humidity if it changed since the last measurement or if we didn't send an update for n times
          lastHum = humidity;
          // Reset no updates counter
          nNoUpdatesHum = 0;
          send(msgHum.set(humidity, 1));
          
          #ifdef MY_DEBUG
          Serial.print("H: ");
          Serial.println(humidity);
          #endif
        } else {
          // Increase no update counter if the humidity stayed the same
          nNoUpdatesHum++;
        }
      
      
        
        // Sleep for a while to save energy
        sleep(UPDATE_INTERVAL); 
      }
      

      On the Arduino side, I seem to get stuck in a loop where the originating message doesn't get through to my gateway:

      0 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.2.0-beta
      49 TSM:INIT
      51 TSF:WUR:MS=0
      57 TSM:INIT:TSP OK
      59 TSM:INIT:STATID=10
      61 TSF:SID:OK,ID=10
      63 TSM:FPAR
      65 TSM:FPAR:STATP=0
      67 TSM:ID
      67 TSM:ID:OK
      69 TSM:UPL
      98 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1
      2107 TSM:UPL
      2136 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=1,st=NACK:1
      4145 TSM:UPL
      4173 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=2,st=NACK:1
      6184 TSM:UPL
      6213 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=3,st=NACK:1
      8222 !TSM:UPL:FAIL
      8224 TSM:FPAR
      8224 TSM:FPAR:STATP=0
      8226 TSM:ID
      8228 TSM:ID:OK
      8230 TSM:UPL
      8259 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=4,st=NACK:1
      10268 TSM:UPL
      10297 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=5,st=NACK:1
      12306 TSM:UPL
      12335 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=6,st=NACK:1
      14344 TSM:UPL
      14372 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=7,st=NACK:1
      16384 !TSM:UPL:FAIL
      

      Something seems to be getting through to my RPi gateway, though, because Domoticz shows the following:
      0_1496356930318_upload-e38cf963-c71e-44f1-838a-506ca9e1c9d4

      Any suggestions would be very welcome. I've tried adding a capacitor across the power supply as suggested, as well as changing the transmit power levels on the Arduino radio, to no avail.

      Thanks in advance!

      sundberg84S Offline
      sundberg84S Offline
      sundberg84
      Hardware Contributor
      wrote on last edited by
      #2

      @egfku - I would say its a range or power issue. I would start here: https://forum.mysensors.org/topic/666/debug-faq-and-how-ask-for-help and go through that. Also you can parse your code into this: https://www.mysensors.org/build/parser and get more info out of it.

      Do you have capacitors on your radios? This is crucial! What distance are we talking about between node and gw? You can try moving they closer (or if they are really close - move them apart). Did you check the radio before using them (since there are alof of fake radios out there which perform really bad).

      You can also try to change the settings on the since you have made that into your code. Might be that the radio is shouting to loud (and/or not getting enough power to do so). How do you power the radios? Its really important and more important if you use the pa/lna version of the radio.

      Controller: Proxmox VM - Home Assistant
      MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
      MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
      RFLink GW - Arduino Mega + RFLink Shield, 433mhz

      1 Reply Last reply
      0
      • E egfku

        Hi folks,

        I'm just getting started and having a hard time getting my Arduino Pro Mini talking to my Raspberry pi running Domoticz. Both client and gateway are using the nRF24L01+ module.

        I have a DHT22 sensor connected to the Arduino and can confirm that it's reading values correctly (using a DHT example). I'm now running the following code, adapted from the Air Humidity examples page:

        /**
         * 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
         * Version 1.1 - 2016-07-20: Converted to MySensors v2.0 and added various improvements - Torben Woltjen (mozzbozz)
         * 
         * DESCRIPTION
         * This sketch provides an example of how to implement a humidity/temperature
         * sensor using a DHT11/DHT-22.
         *  
         * For more information, please visit:
         * http://www.mysensors.org/build/humidity
         * 
         */
        
        // Enable debug prints
        #define MY_DEBUG
        
        #define MY_NODE_ID 255
        #define MY_PARENT_NODE_ID 0
        #define MY_PARENT_NODE_IS_STATIC
        
        // Enable and select radio type attached 
        #define MY_RADIO_NRF24
        //#define MY_RADIO_RFM69
        //#define MY_RS485
        
        //#define MY_RF24_PA_LEVEL RF24_PA_MAX
        #define MY_RF24_PA_LEVEL RF24_PA_MAX
        #define MY_RF24_DATARATE RF24_2MBPS
         
        #include <SPI.h>
        #include <MySensors.h>  
        #include <DHT.h>
        
        // Set this to the pin you connected the DHT's data pin to
        #define DHT_DATA_PIN 3
        
        // Set this offset if the sensor has a permanent small offset to the real temperatures
        #define SENSOR_TEMP_OFFSET 0
        
        // Sleep time between sensor updates (in milliseconds)
        // Must be >1000ms for DHT22 and >2000ms for DHT11
        static const uint64_t UPDATE_INTERVAL = 5000;
        
        // Force sending an update of the temperature after n sensor reads, so a controller showing the
        // timestamp of the last update doesn't show something like 3 hours in the unlikely case, that
        // the value didn't change since;
        // i.e. the sensor would force sending an update every UPDATE_INTERVAL*FORCE_UPDATE_N_READS [ms]
        static const uint8_t FORCE_UPDATE_N_READS = 10;
        
        #define CHILD_ID_HUM 10
        #define CHILD_ID_TEMP 11
        
        float lastTemp;
        float lastHum;
        uint8_t nNoUpdatesTemp;
        uint8_t nNoUpdatesHum;
        bool metric = true;
        
        MyMessage msgHum(CHILD_ID_HUM, V_HUM);
        MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
        DHT dht;
        
        
        void presentation()  
        { 
        
          // Send the sketch version information to the gateway
          sendSketchInfo("TemperatureAndHumidity", "1.1");
          
          // Register all sensors to gw (they will be created as child devices)
          present(CHILD_ID_HUM, S_HUM);
          present(CHILD_ID_TEMP, S_TEMP);
          
          metric = getControllerConfig().isMetric;
        }
        
        
        void setup()
        {
          dht.setup(DHT_DATA_PIN); // set data pin of DHT sensor
          if (UPDATE_INTERVAL <= dht.getMinimumSamplingPeriod()) {
            Serial.println("Warning: UPDATE_INTERVAL is smaller than supported by the sensor!");
          }
          // Sleep for the time of the minimum sampling period to give the sensor time to power up
          // (otherwise, timeout errors might occure for the first reading)
          sleep(dht.getMinimumSamplingPeriod());
        }
        
        
        void loop()      
        {  
          // Force reading sensor, so it works also after sleep()
          dht.readSensor(true);
          
          // Get temperature from DHT library
          float temperature = dht.getTemperature();
          if (isnan(temperature)) {
            Serial.println("Failed reading temperature from DHT!");
          } else if (temperature != lastTemp || nNoUpdatesTemp == FORCE_UPDATE_N_READS) {
            // Only send temperature if it changed since the last measurement or if we didn't send an update for n times
            lastTemp = temperature;
            if (!metric) {
              temperature = dht.toFahrenheit(temperature);
            }
            // Reset no updates counter
            nNoUpdatesTemp = 0;
            temperature += SENSOR_TEMP_OFFSET;
        
            send(msgTemp.set(temperature, 1));
        
            #ifdef MY_DEBUG
            Serial.print("T: ");
            Serial.println(temperature);
            #endif
          } else {
            // Increase no update counter if the temperature stayed the same
            nNoUpdatesTemp++;
          }
        
          // Get humidity from DHT library
          float humidity = dht.getHumidity();
          if (isnan(humidity)) {
            Serial.println("Failed reading humidity from DHT");
          } else if (humidity != lastHum || nNoUpdatesHum == FORCE_UPDATE_N_READS) {
            // Only send humidity if it changed since the last measurement or if we didn't send an update for n times
            lastHum = humidity;
            // Reset no updates counter
            nNoUpdatesHum = 0;
            send(msgHum.set(humidity, 1));
            
            #ifdef MY_DEBUG
            Serial.print("H: ");
            Serial.println(humidity);
            #endif
          } else {
            // Increase no update counter if the humidity stayed the same
            nNoUpdatesHum++;
          }
        
        
          
          // Sleep for a while to save energy
          sleep(UPDATE_INTERVAL); 
        }
        

        On the Arduino side, I seem to get stuck in a loop where the originating message doesn't get through to my gateway:

        0 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.2.0-beta
        49 TSM:INIT
        51 TSF:WUR:MS=0
        57 TSM:INIT:TSP OK
        59 TSM:INIT:STATID=10
        61 TSF:SID:OK,ID=10
        63 TSM:FPAR
        65 TSM:FPAR:STATP=0
        67 TSM:ID
        67 TSM:ID:OK
        69 TSM:UPL
        98 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1
        2107 TSM:UPL
        2136 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=1,st=NACK:1
        4145 TSM:UPL
        4173 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=2,st=NACK:1
        6184 TSM:UPL
        6213 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=3,st=NACK:1
        8222 !TSM:UPL:FAIL
        8224 TSM:FPAR
        8224 TSM:FPAR:STATP=0
        8226 TSM:ID
        8228 TSM:ID:OK
        8230 TSM:UPL
        8259 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=4,st=NACK:1
        10268 TSM:UPL
        10297 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=5,st=NACK:1
        12306 TSM:UPL
        12335 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=6,st=NACK:1
        14344 TSM:UPL
        14372 !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=7,st=NACK:1
        16384 !TSM:UPL:FAIL
        

        Something seems to be getting through to my RPi gateway, though, because Domoticz shows the following:
        0_1496356930318_upload-e38cf963-c71e-44f1-838a-506ca9e1c9d4

        Any suggestions would be very welcome. I've tried adding a capacitor across the power supply as suggested, as well as changing the transmit power levels on the Arduino radio, to no avail.

        Thanks in advance!

        MarikM Offline
        MarikM Offline
        Marik
        wrote on last edited by
        #3

        @egfku I'm a bit new at this stuff too so I could be off base, but isn't node ID 255 reserved for broadcast? Try setting the MY_NODE_ID to something between 1 and 254.

        MySensors 2.1.1 - UNO R3 & W5100 Shield
        Domoticz v3.7686 - Ubuntu 16.04.1 on Hyper-V

        Nca78N 1 Reply Last reply
        1
        • MarikM Marik

          @egfku I'm a bit new at this stuff too so I could be off base, but isn't node ID 255 reserved for broadcast? Try setting the MY_NODE_ID to something between 1 and 254.

          Nca78N Offline
          Nca78N Offline
          Nca78
          Hardware Contributor
          wrote on last edited by
          #4

          @Marik is right !

          sundberg84S 1 Reply Last reply
          0
          • Nca78N Nca78

            @Marik is right !

            sundberg84S Offline
            sundberg84S Offline
            sundberg84
            Hardware Contributor
            wrote on last edited by
            #5

            @Nca78 - Jupp! Well spottet @Marik !

            Controller: Proxmox VM - Home Assistant
            MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
            MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
            RFLink GW - Arduino Mega + RFLink Shield, 433mhz

            1 Reply Last reply
            0
            • E Offline
              E Offline
              egfku
              wrote on last edited by
              #6

              Hi everyone,

              Thank you for your replies! I think @sundberg84 is probably right that there's something wrong with the radio attached to my Arduino. I did try adding a 10uF capacitor, changing the power source, as well as swapping out a different radio, but that didn't seem to help. I've ordered some MCP1702 voltage regulators that hopefully will improve things.

              I did also try to directly specify the node ID, which is seen by my gateway, but it looks like the Arduino can't hear the gateway's response:

              
              pi@rpi:~ $ sudo mysgw -d
              mysgw: Starting gateway...
              mysgw: Protocol version - 2.1.1
              mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.1.1
              mysgw: TSF:LRT:OK
              mysgw: TSM:INIT
              mysgw: TSF:WUR:MS=0
              mysgw: TSM:INIT:TSP OK
              mysgw: TSM:INIT:GW MODE
              mysgw: TSM:READY:ID=0,PAR=0,DIS=0
              mysgw: MCO:REG:NOT NEEDED
              mysgw: Listening for connections on 0.0.0.0:5003
              mysgw: MCO:BGN:STP
              mysgw: MCO:BGN:INIT OK,TSP=1
              mysgw: TSF:MSG:READ,128-128-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
              mysgw: TSF:MSG:BC
              mysgw: TSF:MSG:FPAR REQ,ID=128
              mysgw: TSF:CKU:OK,FCTRL
              mysgw: TSF:MSG:GWL OK
              mysgw: !TSF:MSG:SEND,0-0-128-128,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
              mysgw: TSF:MSG:READ,128-128-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
              mysgw: TSF:MSG:BC
              mysgw: TSF:MSG:FPAR REQ,ID=128
              mysgw: TSF:CKU:OK,FCTRL
              mysgw: TSF:MSG:GWL OK
              mysgw: !TSF:MSG:SEND,0-0-128-128,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
              

              The parser says the gateway isn't getting acknowledged:

              TSF:MSG:SEND,0-0-128-128,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0

              Sent Message
              Sender: 0
              Last Node: 0
              Next Node: 128
              Destination: 128
              Sensor Id: 255
              Command: INTERNAL
              Message Type:I_FIND_PARENT_RESPONSE
              Payload Type: P_BYTE
              Payload Length: 1
              Signing: 0
              Failed uplink counter: 0
              Status: NACK (OK=success, NACK=no radio ACK received)
              Payload: 0

              Will keep testing and update if I get any joy!

              Nca78N 1 Reply Last reply
              0
              • E egfku

                Hi everyone,

                Thank you for your replies! I think @sundberg84 is probably right that there's something wrong with the radio attached to my Arduino. I did try adding a 10uF capacitor, changing the power source, as well as swapping out a different radio, but that didn't seem to help. I've ordered some MCP1702 voltage regulators that hopefully will improve things.

                I did also try to directly specify the node ID, which is seen by my gateway, but it looks like the Arduino can't hear the gateway's response:

                
                pi@rpi:~ $ sudo mysgw -d
                mysgw: Starting gateway...
                mysgw: Protocol version - 2.1.1
                mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.1.1
                mysgw: TSF:LRT:OK
                mysgw: TSM:INIT
                mysgw: TSF:WUR:MS=0
                mysgw: TSM:INIT:TSP OK
                mysgw: TSM:INIT:GW MODE
                mysgw: TSM:READY:ID=0,PAR=0,DIS=0
                mysgw: MCO:REG:NOT NEEDED
                mysgw: Listening for connections on 0.0.0.0:5003
                mysgw: MCO:BGN:STP
                mysgw: MCO:BGN:INIT OK,TSP=1
                mysgw: TSF:MSG:READ,128-128-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
                mysgw: TSF:MSG:BC
                mysgw: TSF:MSG:FPAR REQ,ID=128
                mysgw: TSF:CKU:OK,FCTRL
                mysgw: TSF:MSG:GWL OK
                mysgw: !TSF:MSG:SEND,0-0-128-128,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
                mysgw: TSF:MSG:READ,128-128-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
                mysgw: TSF:MSG:BC
                mysgw: TSF:MSG:FPAR REQ,ID=128
                mysgw: TSF:CKU:OK,FCTRL
                mysgw: TSF:MSG:GWL OK
                mysgw: !TSF:MSG:SEND,0-0-128-128,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
                

                The parser says the gateway isn't getting acknowledged:

                TSF:MSG:SEND,0-0-128-128,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0

                Sent Message
                Sender: 0
                Last Node: 0
                Next Node: 128
                Destination: 128
                Sensor Id: 255
                Command: INTERNAL
                Message Type:I_FIND_PARENT_RESPONSE
                Payload Type: P_BYTE
                Payload Length: 1
                Signing: 0
                Failed uplink counter: 0
                Status: NACK (OK=success, NACK=no radio ACK received)
                Payload: 0

                Will keep testing and update if I get any joy!

                Nca78N Offline
                Nca78N Offline
                Nca78
                Hardware Contributor
                wrote on last edited by
                #7

                @egfku said in Air Humidity Sensor can't reach Gateway:

                Sensor Id: 255

                It cannot work like that. Node ID 255 is for broadcast, and for broadcast ACK will never be sent back.

                You should first reset the eprom config that is now written in your arduino.for that, in Arduino menu open File/Examples/MySensors/ClearEpromConfig example sketch and run it.
                Then put a sketch with the lines below commented :

                #define MY_NODE_ID 255
                #define MY_PARENT_NODE_ID 0
                #define MY_PARENT_NODE_IS_STATIC
                

                Also it doesn't seem to be a good idea to set data rate of NRF24 to 2MPS when you believe you have a radio communication/range problem. Keep the default value of 250K so you will have better range, for that comment the line below.
                (Of course you must have the same config on your gateway)

                #define MY_RF24_DATARATE RF24_2MBPS
                
                1 Reply Last reply
                1
                • E Offline
                  E Offline
                  egfku
                  wrote on last edited by
                  #8

                  Thanks for the note, @Nca78 . It seems like my systems defaults to an ID of 255, though. I swapped out another Pro Mini and another radio (debugged the Arduino side using the RF24 library), and now I'm seeing more traffic between the Arduino and the RPi, though it seems to fall over at receiving an ID.

                  Note that I ran the ClearEpromConfig example immediately before pushing the MotionSensor example (no changes, did not define MY_NODE_ID).

                  Arduino:

                  0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
                  4 TSM:INIT
                  4 TSF:WUR:MS=0
                  12 TSM:INIT:TSP OK
                  14 TSM:FPAR
                  16 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                  2025 !TSM:FPAR:NO REPLY
                  2027 TSM:FPAR
                  2029 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                  2037 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
                  2043 TSF:MSG:FPAR OK,ID=0,D=1
                  4038 TSM:FPAR:OK
                  4038 TSM:ID
                  4040 TSM:ID:REQ
                  4044 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
                  6051 TSM:ID
                  6051 TSM:ID:REQ
                  6055 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
                  8065 TSM:ID
                  8065 TSM:ID:REQ
                  8069 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
                  10076 TSM:ID
                  10076 TSM:ID:REQ
                  10080 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
                  12089 !TSM:ID:FAIL
                  12091 TSM:FAIL:CNT=1
                  12093 TSM:FAIL:PDT
                  22097 TSM:FAIL:RE-INIT
                  22099 TSM:INIT
                  22106 TSM:INIT:TSP OK
                  22110 TSM:FPAR
                  22112 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                  24121 !TSM:FPAR:NO REPLY
                  24123 TSM:FPAR
                  24125 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                  26134 !TSM:FPAR:NO REPLY
                  26136 TSM:FPAR
                  26138 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                  28147 !TSM:FPAR:NO REPLY
                  28149 TSM:FPAR
                  28151 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                  30162 !TSM:FPAR:FAIL
                  30164 TSM:FAIL:CNT=2
                  30167 TSM:FAIL:PDT
                  40171 TSM:FAIL:RE-INIT
                  40173 TSM:INIT
                  40179 TSM:INIT:TSP OK
                  40183 TSM:FPAR
                  40185 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                  42196 !TSM:FPAR:NO REPLY
                  42199 TSM:FPAR
                  42201 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                  42209 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
                  42215 TSF:MSG:FPAR OK,ID=0,D=1
                  44210 TSM:FPAR:OK
                  44212 TSM:ID
                  44212 TSM:ID:REQ
                  44216 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
                  

                  RPi:

                  
                  pi@rpi:~/projects/RF24/rf24libs/RF24/examples_linux $ sudo mysgw -d
                  mysgw: Starting gateway...
                  mysgw: Protocol version - 2.1.1
                  mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.1.1
                  mysgw: TSF:LRT:OK
                  mysgw: TSM:INIT
                  mysgw: TSF:WUR:MS=0
                  mysgw: TSM:INIT:TSP OK
                  mysgw: TSM:INIT:GW MODE
                  mysgw: TSM:READY:ID=0,PAR=0,DIS=0
                  mysgw: MCO:REG:NOT NEEDED
                  mysgw: Listening for connections on 0.0.0.0:5003
                  mysgw: MCO:BGN:STP
                  mysgw: MCO:BGN:INIT OK,TSP=1
                  mysgw: New connection from 192.168.11.31
                  mysgw: Client 0 connected
                  mysgw: Client 0: 0;0;3;0;2;
                  mysgw: Client 0: 0;0;3;0;18;PING
                  mysgw: Client 0: 0;0;3;0;2;Get Version
                  mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
                  mysgw: TSF:MSG:BC
                  mysgw: TSF:MSG:FPAR REQ,ID=255
                  mysgw: TSF:PNG:SEND,TO=0
                  mysgw: TSF:CKU:OK
                  mysgw: TSF:MSG:GWL OK
                  mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
                  mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
                  mysgw: TSF:MSG:BC
                  mysgw: TSF:MSG:FPAR REQ,ID=255
                  mysgw: TSF:CKU:OK,FCTRL
                  mysgw: TSF:MSG:GWL OK
                  mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
                  mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
                  mysgw: Client 0: 255;255;3;0;4;1
                  mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=4,pt=0,l=1,sg=0,ft=0,st=OK:1
                  mysgw: Client 0: 0;0;3;0;18;PING
                  mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
                  mysgw: Client 0: 255;255;3;0;4;1
                  mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=4,pt=0,l=1,sg=0,ft=0,st=OK:1
                  mysgw: Client 0: 0;0;3;0;18;PING
                  mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
                  mysgw: TSF:MSG:BC
                  mysgw: TSF:MSG:FPAR REQ,ID=255
                  mysgw: TSF:PNG:SEND,TO=0
                  mysgw: TSF:CKU:OK
                  mysgw: TSF:MSG:GWL OK
                  mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
                  mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
                  mysgw: TSF:MSG:BC
                  mysgw: TSF:MSG:FPAR REQ,ID=255
                  mysgw: TSF:CKU:OK,FCTRL
                  mysgw: TSF:MSG:GWL OK
                  mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
                  mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
                  mysgw: TSF:MSG:BC
                  mysgw: TSF:MSG:FPAR REQ,ID=255
                  mysgw: TSF:CKU:OK,FCTRL
                  mysgw: TSF:MSG:GWL OK
                  mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
                  mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
                  mysgw: TSF:MSG:BC
                  mysgw: TSF:MSG:FPAR REQ,ID=255
                  mysgw: TSF:CKU:OK,FCTRL
                  mysgw: TSF:MSG:GWL OK
                  mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
                  mysgw: Client 0: 0;0;3;0;18;PING
                  mysgw: Client 0: 0;0;3;0;18;PING
                  mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
                  mysgw: TSF:MSG:BC
                  mysgw: TSF:MSG:FPAR REQ,ID=255
                  mysgw: TSF:PNG:SEND,TO=0
                  mysgw: TSF:CKU:OK
                  mysgw: TSF:MSG:GWL OK
                  mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
                  mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
                  mysgw: TSF:MSG:BC
                  mysgw: TSF:MSG:FPAR REQ,ID=255
                  mysgw: TSF:CKU:OK,FCTRL
                  mysgw: TSF:MSG:GWL OK
                  

                  Am I missing a step? I am running "sudo mysgw -d" on the RPI, followed by "sudo service domocoticz.sh restart", then pushing the MotionSensor example to my Pro Mini.

                  Thanks again for everyone's help!

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  20

                  Online

                  11.7k

                  Users

                  11.2k

                  Topics

                  113.1k

                  Posts


                  Copyright 2025 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