Go Down

Topic: Class for DHT11, DHT21 and DHT22 (temperature & humidity) (Read 107163 times) previous topic - next topic

robtillaart



The fact that there is no sensor error e.g. CRC error means the sensors make no communication error.

The DHT are not known for their accuracy (for the H part)

I don't know if the sensors are bad, is it possible to swap the 2 groups of sensors?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Wareemba

removed the resistors, no change...

will swap over the sensors next, see what happens...

Wareemba

Thansk Rob,

The fact that there is no sensor error e.g. CRC error means the sensors make no communication error.

The DHT are not known for their accuracy (for the H part)

I don't know if the sensors are bad, is it possible to swap the 2 groups of sensors?

this is the CRC after a whole day:

Code: [Select]
TOT OK CRC TO UNK
13560 13555 4 1 0 0 0 0


i'm just going to swap the sensors (desolder/resolder) now..

is there  a much more reliable sensor for humidity? i am considering the BME280's perhaps?

my ventilation control system relies on accurate dew point for its if/else controls....

or do i just find a set of DHT22's that seem reliable and most closely match my SHT75 handheld readings? as mentioned, this set of sensors are from teh same batch - and are one of the first ones i have experienced such large deviations with...

or can i actually pseudo-calibrate them? like add/subtract a % so they are all on equal readings at the same location?

robtillaart

>> is there  a much more reliable sensor for humidity?

Sensirion is oftenmentioned as stable humidity sensors, but they are in another price segment.

>> or can i actually pseudo-calibrate them?
There is a real-calibration procedure,

- http://www.kandrsmith.org/RJS/Misc/calib_dht22.html

possibly interesting too
- http://forum.arduino.cc/index.php?topic=184356.msg1753894#msg1753894
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Wareemba

thanks for the links, i had read the Smith posting, which was very informative, but i'm not going to go through that!

it turns out the sensors seem to be bad,

i soldered the 'good' ones to the Cat5 cabling and these are the readings:

Code: [Select]
---------
ROOF_DHT22, OK, 79.2, 23.5, 5054
HOUSE_DHT22, OK, 79.3, 23.7, 5102
PLENUM_DHT22, OK, 80.1, 23.4, 5055
---------
ROOF_DHT22, OK, 79.1, 23.5, 5152
HOUSE_DHT22, OK, 79.2, 23.8, 5054
PLENUM_DHT22, OK, 80.1, 23.4, 5055
---------
ROOF_DHT22, OK, 79.3, 23.5, 5150
HOUSE_DHT22, OK, 79.4, 23.8, 5149
PLENUM_DHT22, OK, 80.2, 23.4, 5102
---------
ROOF_DHT22, OK, 79.3, 23.5, 5150
HOUSE_DHT22, OK, 79.3, 23.8, 5102
PLENUM_DHT22, OK, 80.2, 23.4, 5103
---------
ROOF_DHT22, OK, 79.3, 23.5, 5150
HOUSE_DHT22, OK, 79.4, 23.8, 5152
PLENUM_DHT22, OK, 80.2, 23.4, 5099
---------
ROOF_DHT22, OK, 79.3, 23.4, 5061
HOUSE_DHT22, OK, 79.4, 23.8, 5149
PLENUM_DHT22, OK, 80.2, 23.4, 5102
---------
ROOF_DHT22, OK, 79.3, 23.4, 5055

TOT OK CRC TO UNK
280 279 0 1 0 0 0 0


the Sensirion is showing 80.3% and 23.6'C

so we are back in range :)

Rob - if it is working without the resistors, do i actually need them?

i have 4 x DHT22 Cat5 cable runs, 3 x 6m runs (which had 4K7 resistors to VCC) and one 14m run (with a 2K2 resistor to VCC)

also - i am using the 0.1.13 dht library, is there any benefit going to the latest version if im using ESP8266-12E?

thanks!

robtillaart

>> Rob - if it is working without the resistors, do i actually need them?

If it is working, it is working. The resistors will give a better square wave signal making the handshakes more reliable.

>> also - i am using the 0.1.13 dht library, is there any benefit going to the latest version if im using ESP8266-12E?

No, the 0.1.14 and up version are optimized for AVR to support lower clock speeds.

0.1.13 is the stable portable one, it has been used on a ESP2866 (sorry no link)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Wareemba

0.1.13 is the stable portable one, it has been used on a ESP2866 (sorry no link)
ok, thanks again, 0.1.13 has been working fantastic for me.

fyi - i have used 0.1.13 with DHT22's on the following packages:

ESP8266-01
ESP8266-07
ESP8266-12E
ESP8266-12F
NodeMCUv1.0
WeMOS D1


robtillaart

#202
Jan 29, 2016, 07:10 am Last Edit: Jan 29, 2016, 07:10 am by robtillaart
Thank you that is very valuable feedback!  - karma to you :)

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

moreapicguy

I just ran into the same problem (stuck at 99.9% rH) as an earlier poster here, and discovered that for me it was a power supply issue.  I had been running this sensor on a 5V supply that I eventually determined was giving me some grief (inadvertent brownouts and reboots) and so I tried swapping out the power supply.  The new one is a little more robust, measuring at 5.29V on my meter when under load.  On the PRIOR supply, I was getting accurate relative humidity readings, but with the new one, it was stuck on 99.9% - although temperature was correct.  I put a 1N4148 in between my VCC and the sensor's power pin to drop by .7V and all is now well again, with accurate readings.

Just thought I'd post it here in case others were having the same issue.

Steve

robtillaart

@moreapicguy

Thanks for sharing this valuable info
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

duino_nano

I think that the DHT11 should not be connect on +5V in a permanent way. I had it connected on 5V in the past and had humidity data off (low)  by about 10%.
Now I use one of the digital output of the Arduino to supply it with 5V for 1 or 2 seconds every 20 seconds. Results are now more constants and higher by 10% (for 2 units)!
Note: the resistor between pin 1 and 2 is also connect to the output.

jnissen

Running into an issue with a 4MHz setup and trying to use the 0.1.21 version of the library. I get a variety of errors and I have tried 10K pullup, 5.1K pullup, reducing length of wires, ensuring I have 3.25V or better (3.3V system).

I got the code to run fine on a 5V UNO but I am targeting this 4MHz setup from Sparkfun.

Code is here:
https://codebender.cc/sketch:268024

Output:
connected at 9600
DHT Sensor with Badger Stick
LIBRARY VERSION: 0.1.21

Type, status, Humidity (%), Temperature (C) Time (us)
DHT22, Connect error, 0.0, 0.0, 3232
DHT22, Checksum error, 0.3, -76.8, 7168
DHT22, Time out error, 0.0, 0.0, 7408
DHT22, Time out error, 0.0, 0.0, 7056


One other thing... I modified the Badgerstick to eliminate batteries. The diode is now bypassed so the 3.3V is being seen by the whole board and sensor. I understand some of the DHT sensors can be low voltage sensitive.

Update: I looked at the signaling with my Rigol scope and it appears that I am getting fairly good rail to rail swing. The micro initialization delay is about 2.5uS then I go out and measure the appropriate response and data spacing. Ones and zero's are as they are supposed to be. At this point it looks like the data coming back is often all zero's but in the correct format. I ordered a couple new DHT sensors in case this one is wonky at low voltage.

povlhp

I used the latest github version of DHTLib on my new DHT11, and like someone else, only got zero values back, communications error. Got the DHT11 library source, and used that, and now it works as expected.

My weather station 40cm away (10cm from wall) says 1.4 degrees colder, which is likely OK, humidity 38% vs 44% of the DHT11. Same humidity should show lower at the DHT11, so precision is far from perfect.

robtillaart

Please use the version - https://github.com/RobTillaart/Arduino/tree/master/libraries/DHTstable -
This equals the DHTlib 0.1.13 version

as the latest DHTlib version is more experimental to minimize footprint and work at lower clock speeds and is coded with AVR specific code. It will not work on ARM version.

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy