Go Down

Topic: DHT22 sensor experiment - not reading all bytes => Fast Humidity sensor (Read 1 time) previous topic - next topic

robtillaart

Last week I updated my DHTlib and I got the following idea. The data of the DHT exists of 5 bytes (2 humidity, 2 temperature and 1 CRC). What if I not read all 5 bytes? would that be usable?

A quick experiment (patching my lib - http://playground.arduino.cc/Main/DHTLib - ) gave the following results:
Code: [Select]

5 bytes - normal library
----------------------------------------
Type, status, Humidity (%), Temperature (C) Time (us)
DHT22, OK, 63.0, 22.3, 5196
DHT22, OK, 63.0, 22.3, 5092

4 bytes - skipping CRC byte (last byte) // removed CRC error msg)
----------------------------------------
DHT22, OK, 62.6, 22.2, 4220
DHT22, OK, 62.7, 22.3, 4324

3 bytes - humidity + only high temperature)
----------------------------------------
DHT22, Checksum error, 62.2, 0.0, 3372
DHT22, Checksum error, 62.2, 0.0, 3372
==> makes no sense as temperature is then in steps of 25.6C

2 bytes - only reading humidity
----------------------------------------
Type, status, Humidity (%), Temperature (C) Time (us)
DHT22, Checksum error, 63.1, 0.0, 2808
DHT22, Checksum error, 62.9, 0.0, 2760

1 byte - only reading high humidity
----------------------------------------
DHT22, Checksum error, 51.2, 0.0, 1896
DHT22, Checksum error, 51.2, 0.0, 1904
==> big error in humidity

It is clear that reading less bytes decreases the reading time and there are only 2 interesting options.
1) skipping the CRC improves the speed by almost 0.8 millisec ~~16%
2) if you only need humidity and no CRC check you can even win 2.3 millisec ~~45%

So yes, not reading all bytes can be useful, especially if you are in a real need for fast humidity (without CRC!)
And no, this will not become part of the DHTlibrary.  :)

Note that for the DHT11 which has a wakeup delay of 20 millis these gains are substantially less
Rob Tillaart

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

terryking228

I think Rob will be getting a letter from the Wet Administratiefrechtelijke Handhaving Verkeersvoorschriften.
Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

robtillaart

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