DHT22 sensor stops sending data for no reason

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
veuchez
Posts: 5
Joined: 25 Jan 2017 17:11

DHT22 sensor stops sending data for no reason

Post by veuchez »

Hi everyone,
I have a problem that I cannot solve.
I have configured z-uno with a DHT22 sensor and a data reading every 20 seconds.
This is my code but I don't think that's the problem.

Code: Select all

// add library
#include "ZUNO_DHT.h"
// pin connection
#define DHTPIN 9  // first sensor

DHT dht(DHTPIN, DHT22);  

int temperatura; // here we will store the temperature
int umidita; // here we will store the humidity

// set up channel
ZUNO_SETUP_CHANNELS(
   ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_TEMPERATURE, 
                          SENSOR_MULTILEVEL_SCALE_CELSIUS, 
                          SENSOR_MULTILEVEL_SIZE_TWO_BYTES, 
                          SENSOR_MULTILEVEL_PRECISION_TWO_DECIMALS,
                          getterTemp),
                          
   ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_RELATIVE_HUMIDITY, 
                          SENSOR_MULTILEVEL_SCALE_PERCENTAGE_VALUE, 
                          SENSOR_MULTILEVEL_SIZE_TWO_BYTES, 
                          SENSOR_MULTILEVEL_PRECISION_TWO_DECIMALS,
                          getterUmid)                          
);

void setup() {
    Serial.begin();
    Serial.println("start");
}

void loop() {
    // obtaining readings from the sensor DHT22
    float temp = dht.readTemperature();
    // make scaled word value for report
    temperatura=int(temp*100);

    float umid = dht.readHumidity();
    // make scaled word value for report
    umidita=int(umid*100);
    
    // send data to channel
    zunoSendReport(1); 
    zunoSendReport(2);   
       
    // send every 20 second
    delay(20000);
}

word getterTemp() {
    return temperatura;
}

word getterUmid() {
    return umidita;
}
At home it had been working for a week without any problems.
As soon as I moved it to the greenhouse where I want to put it, here's the problem.
After an indefinite period of time, it can be minutes or hours, the sensor stops sending data.
The only way to get it back to work is to unplug and plug it back in.
I have changed 6 sensors, I have shortened the wires that separate the sensor from the Z-uno, I have changed 3 power supplies, I have even tried with 2 different Fibaro Smart Implants instead of the Z-uno but the situation does not change.
In the house, where I use the jumper wires to connect the sensor goes, in the greenhouse no.
The only thing that I haven't changed in the greenhouse is the wires that connect the sensor to the Z-uno.
I used the classic 2.5 mm² electric current wires.
Are they too big and maybe they cause dispersion?
What else could it be?
Thank you!

Post Reply