-->
Page 1 of 1

Reading errors DHT22

PostPosted: Thu Dec 10, 2015 4:54 pm
by canedje
Hello everybody.

I do have trouble reading DHT22.

I did write code to read DHt22, BMP180 and ds18B20 sensors with a NodeMCU ESP12.
The basic is running fine.
I facing a problem that reading the DHT is not stable.
I read the sensors every 2 seconds.
At this moment the reading of the DHT22 is causing trouble by not reading every time.
Lets say that in avarage (But it is random) that about every 10 readings there is a misreading.

The strange thing is that before the code did run for 100% without misreading, but after adding some code to the sketch (nothing to do with the DHT part of the code) this misreading suddenly appears
It looks like that changing the code the time need to run the code causes misreadings.
I did try to change the code by adding extra delays etc.
Nothing is helping
I know you can change the 3th factor in the command: DHT dht(DHTPIN, DHTTYPE,5); does influence the reading. I changed this factor several times with indeed some changes in misreading but never get rid of it.

Is somebody recognise this?
And more important is there e method to avoid this?

Re: Reading errors DHT22

PostPosted: Fri Dec 11, 2015 5:47 am
by canedje
canedje wrote:Hello everybody.

I do have trouble reading DHT22.

I did write code to read DHt22, BMP180 and ds18B20 sensors with a NodeMCU ESP12.
The basic is running fine.
I facing a problem that reading the DHT is not stable.
I read the sensors every 2 seconds.
At this moment the reading of the DHT22 is causing trouble by not reading every time.
Lets say that in avarage (But it is random) that about every 10 readings there is a misreading.

The strange thing is that before the code did run for 100% without misreading, but after adding some code to the sketch (nothing to do with the DHT part of the code) this misreading suddenly appears
It looks like that changing the code the time need to run the code causes misreadings.
I did try to change the code by adding extra delays etc.
Nothing is helping
I know you can change the 3th factor in the command: DHT dht(DHTPIN, DHTTYPE,5); does influence the reading. I changed this factor several times with indeed some changes in misreading but never get rid of it.

Is somebody recognise this?
And more important is there e method to avoid this?



In the mean time I did found the next different library:
    https://github.com/markruys/arduino-DHT an other library for DHT22:
Running the example sketch is running fine.
Adding the code (By exact copiing) it into my main sketchcode suddenly the humidity is showing a big, strange number.


Is there an explanation for that?