DHT22 sensor error


#1

Getting a lot of signal error for my DHT22 sensors… I have tried running them off 5v with ferrite chokes but still getting random outliers.
Currently using:

    float t = 0;
    for(int i=0;i<10;i++){
        t = dht.getTempCelcius();
        if(t>0 && t < 70) break;
        delay(150);
    };    
    int t1 = t;

this is poor. Looking for some known code to do a running statistical mode calculation and drop values of unrealistic change…
This will create a mode, but not optimized for running sensor data


#2

There are numerous libraries for that sensor - which one are you using?
You should also use the CRC check the libraries usually provide. This way you won’t need to filter by value but can already discard bad readings due to communication errors.


#3

using Adafruit_DHT, perhaps could try Adafruit_DHT_Particle


#4

Try PietteTech_DHT and look at the provided SingleDrop example.
BTW, I guess you are using a Photon?
Mesh devices are not 5V tolerant on any GPIO pin.


#5

Ok cool I’ll try that! Yes photon.
So one of the DHT22 sensors just caught fire. That was interesting


#6

If that’s the entire sketch then you’re reading the DHT22 way too often to get reliable results. DHT22 can be read reliably at most once every 2 seconds or so. I usually sample mine every 5 sec to keep them happy over the long term.


#7

After one of the devices caught fire, I have switched back to my old DHT11 sensors with 3v3 while waiting for a pair of BME280 sensors to arrive… I’ve changed the delay in the for loop to 2000… that may help also…