Go Down

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


robtillaart

the internal ones might be of the wrong 'size'... but the proof is in the pudding test.
The longer the wires the smaller the pull up.
Rob Tillaart

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

Stocky

Hi Rob - I have been using your DHT22 Library with a weather warning device I'm working on ad have had it all working fine on a Duemilanove but have had to move to a Mega1280 for extra space & RAM to add some more features inc logging

Hardware wise I have an anemometer on Digital 2 and the DHT22 on Digital 3 and this worked fine on the Duemilanove but on the MEGA1280 the DHT22 readings go crazy as soon as the anemometer moves!

As far as I can see the interrupts are the same on Digital 2 & 3 on a Mega328 and a Mega1280 based board so I'm not sure whats going on - any pointers?

robtillaart

#138
Nov 05, 2014, 07:21 pm Last Edit: Nov 05, 2014, 07:23 pm by robtillaart
You do not tell which version you use.  The interrupts seem to disrupt the communication between the DHT and the board.  The last 0.1.17 version is probably less interrupt resistant as it uses relative timing.

Version 0.1.15 uses absolute timing with micros() and is better "resistant" for interrupts.

Attached here - http://forum.arduino.cc/index.php?topic=58531.msg1912859#msg1912859 -

Hope this helps.
Rob Tillaart

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

Stocky

Sorry was using latest version - I ended up moving the anemometer to another interrupt and that fixed it - weird!

robtillaart

Rob Tillaart

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

danbi

Great library! Keep up the good work.

I have few issues however:

- Why would you make the 'invalid value' 0? How do you measure an 0 degrees temperature then? (it's less of a issue with humidity)

- Do you have an idea why some sensors might be way off. For example, using v14 of the lib (as the current one fails at DHT11), and 2xDHT22 + 3xDHT11 sensors, sitting on the same breadboard, I get:

DHT21, OK, 67.5, 22.7
DHT22, OK, 65.6, 22.7
DHT11, OK, 59.0, 22.0
DHT12, OK, 50.0, 23.0
DHT13, OK, 60.0, 22.0

(sensors names starting with 2 are DHT22, those with 1 are DHT11). Why would they be too far off on humidity, especially one of them? Could this be just a bad sensor that needs to get in trash or should I consider applying some offset correction? Temperature error seems tolerable.
After reading http://www.kandrsmith.org/RJS/Misc/calib_dht22.html I am ... very confused what to think of it all :)

- My application will use long cables (10-30m). What are the risks associated with this? Could the induced noise eventually damage the Arduino or the sensors? At which end is best to put the pull up resistor? At the controller or at the sensor?

robtillaart

#142
Nov 09, 2014, 08:09 pm Last Edit: Nov 09, 2014, 08:11 pm by robtillaart
Quote
Why would you make the 'invalid value' 0? How do you measure an 0 degrees temperature then? (it's less of a issue with humidity)
The invalid value in 0.1.14 = DHTLIB_INVALID_VALUE = -999

in version 0.1.17 the DHTLIB_INVALID_VALUE is removed as sometimes the values are good and there is only a bit-error in the CRC. So the return value of the read() functions must be checked.

Also note that DHT11 use only integer values. That gives rounding errors by definition:)

Quote
Do you have an idea why some sensors might be way off.
Check the datasheets, the DHT sensors are not that accurate (esp the DHT11).
See detailed tests here - http://playground.boxtec.ch/doku.php/sensors/temp-hum_sensors_compared -

Quote
My application will use long cables (10-30m). What are the risks associated with this?
The signal is digital so it either fails or succeeds, it will not drift. You might need to use a smaller pull up resistor. I always put them near Arduino as there 5Volt == 5Volt.
Rob Tillaart

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

Stocky

Question for Rob - have you had any experience with the DHT series sensors and very low RH values?
I seem to have an issue with RH values less than 15% being very very inaccurate and just looking to see what other users have found!

robtillaart

I've used the DHT's mostly at room temperature (say 5-40 degrees) and humidity between 35-75 %
Once I did use it in a room about 60-70 degrees but I do not recall what humidity was.

never did look at the humidity extremes.
Rob Tillaart

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

Stocky

Thanks Rob - down here in Australia Summer daytime RH can get down to 5% (or less!) and I'm having trouble being able to measure it which is an issue for my application :-/

Anyone out there got any experience with the DHT sensors at these ultra low RH values?

robtillaart


I have finally found time to work on a fix for the DHT11 sensor in the DHTlib.
A beta version of the 0.1.18 lib is attached.
 
Could anyone with a DHT11 on UNO/MEGA confirm it works?
Note It won't work on any ARM/DUE.



Rob Tillaart

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

robtillaart

Finally got my new DHT11 and some time to test the 0.1.18(beta) version to see if the fix works.
And I'm happy to announce it does :)

So I pushed the 0.1.18 version to - https://github.com/RobTillaart/Arduino/tree/master/libraries/DHTlib -


Please note that 0.1.18 does not work on ARM processors (e.g. Due),  please use the 0.1.13 version.
Rob Tillaart

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

Go Up