Strange data sent from sensors



  • Hi,

    Occasionally I receive strange data from my sensors. This can sometimes happen several times a week and sometimes longer time can pass before it happens again. On average once a week for each sensor I would say. This is messing up my graphs and also don't feel very reliable.

    I've noticed that they all go through my repeater node (106). The repeater node itself has a temperature and humidity sensor.

    Some examples from my controller:

    2015-12-12T14:58:45.8881610+01:00       DEBUG   MySensors                               Read: 106-106-0 s=0,c=1,t=1,pt=5,l=5:1108344832
    2015-12-12T14:58:45.8886540+01:00       INFO    MySensors       N106S0  Sensor.Humidity 1108344832  
    
    2015-12-12T14:49:07.3811900+01:00       DEBUG   MySensors                               Read: 106-106-0 s=1,c=1,t=0,pt=5,l=5:1103626240
    2015-12-12T14:49:07.3816670+01:00       INFO    MySensors       N106S1  Sensor.Temperature      1103626240      -
    
    2015-12-13T18:25:08.2651820+01:00       DEBUG   MySensors                               Read: 105-106-0 s=0,c=1,t=0,pt=5,l=5:2941013193
    2015-12-13T18:25:08.2686200+01:00       INFO    MySensors       N105S0  Sensor.Temperature      2941013193      -
    
    2015-12-12T15:15:21.8491830+01:00       DEBUG   MySensors                               Read: 12-106-0 s=2,c=1,t=0,pt=5,l=5:897581056
    2015-12-12T15:15:21.8496750+01:00       INFO    MySensors       N12S2   Sensor.Temperature      897581056       -
    

    I also don't understand why all sensors seem to go through my repeater node. 1 of the sensors (12) is in the same room as the controller but still go through the repeater node which is in a different room past the controller.

    The repeater node has a 4.7 capacitor on the radio, I have also tried to replace the radio which made no difference.
    Any ideas?


  • Admin

    @Aloha Please upload the sketch of your repeater.



  • Here it is:

    #include <SPI.h>
    #include <MySensor.h>  
    #include <DHT.h>  
    
    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    #define HUMIDITY_SENSOR_DIGITAL_PIN 3
    unsigned long SLEEP_TIME = 15000; // Sleep time between reads (in milliseconds)
    
    MySensor gw;
    DHT dht;
    float lastTemp;
    float lastHum;
    boolean metric = true; 
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    
    
    void setup()  
    { 
      gw.begin(NULL, 106, true);
      dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
    
      // Send the Sketch Version Information to the Gateway
      gw.sendSketchInfo("Humidity", "1.0");
    
      // Register all sensors to gw (they will be created as child devices)
      gw.present(CHILD_ID_HUM, S_HUM);
      gw.present(CHILD_ID_TEMP, S_TEMP);
      
      metric = gw.getConfig().isMetric;
    }
    
    void loop()      
    {  
      delay(dht.getMinimumSamplingPeriod());
    
      float temperature = dht.getTemperature();
      if (isnan(temperature)) {
          Serial.println("Failed reading temperature from DHT");
      } else if (temperature != lastTemp) {
        lastTemp = temperature;
        if (!metric) {
          temperature = dht.toFahrenheit(temperature);
        }
        gw.send(msgTemp.set(temperature, 1));
        Serial.print("T: ");
        Serial.println(temperature);
      }
      
      float humidity = dht.getHumidity();
      if (isnan(humidity)) {
          Serial.println("Failed reading humidity from DHT");
      } else if (humidity != lastHum) {
          lastHum = humidity;
          gw.send(msgHum.set(humidity, 1));
          Serial.print("H: ");
          Serial.println(humidity);
      }
      gw.process();
      gw.wait(SLEEP_TIME); //sleep a bit
    }
    

  • Admin

    You cannot sleep a repeater node.

    My guess is that the DHT sensor is the source of the garbage.



  • Hmm strange.. I must have pasted the wrong sketch, sorry about that. It's not sleeping, it looks like this.

    #include <SPI.h>
    #include <MySensor.h>  
    #include <DHT.h>  
    
    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    #define HUMIDITY_SENSOR_DIGITAL_PIN 3
    unsigned long SLEEP_TIME = 15000; // Sleep time between reads (in milliseconds)
    
    MySensor gw;
    DHT dht;
    float lastTemp;
    float lastHum;
    boolean metric = true; 
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    
    
    void setup()  
    { 
      gw.begin(NULL, 106, true);
      dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
    
      // Send the Sketch Version Information to the Gateway
      gw.sendSketchInfo("Humidity", "1.0");
    
      // Register all sensors to gw (they will be created as child devices)
      gw.present(CHILD_ID_HUM, S_HUM);
      gw.present(CHILD_ID_TEMP, S_TEMP);
      
      metric = gw.getConfig().isMetric;
    }
    
    void loop()      
    {  
      delay(dht.getMinimumSamplingPeriod());
    
      float temperature = dht.getTemperature();
      if (isnan(temperature)) {
          Serial.println("Failed reading temperature from DHT");
      } else if (temperature != lastTemp) {
        lastTemp = temperature;
        if (!metric) {
          temperature = dht.toFahrenheit(temperature);
        }
        gw.send(msgTemp.set(temperature, 1));
        Serial.print("T: ");
        Serial.println(temperature);
      }
      
      float humidity = dht.getHumidity();
      if (isnan(humidity)) {
          Serial.println("Failed reading humidity from DHT");
      } else if (humidity != lastHum) {
          lastHum = humidity;
          gw.send(msgHum.set(humidity, 1));
          Serial.print("H: ");
          Serial.println(humidity);
      }
      gw.process();
      gw.wait(SLEEP_TIME); //sleep a bit
    }
    

    hek, I'm using the DHTII module. I have a second mysensor network (on a different channel and other controller) which also have the same type of sensor and it's working fine. Are these known to be causing issues?

    Also, why would the data from other nodes gets affected by the DHT sensor on the 106 node? 105 for instance is using a dallas temperature sensor.


  • Admin

    It's the same sketch 🙂



  • Well, in that case it's probably just me going crazy. 😊

    It is the correct sketch. But it's not sleeping, it's just waiting?
    gw.wait(SLEEP_TIME); //sleep a bit

    I guess the comment might be a bit missleading and that I should update it, but gw.wait should work with repeaters. Right?


  • Admin

    Yes, wait is totally fine.


Log in to reply
 

Suggested Topics

  • 3
  • 6
  • 1
  • 2
  • 5
  • 1

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts