winlinvip / SimpleDHT

Simple, Stable and Fast Arduino Temp & Humidity Sensors for DHT11 and DHT22. http://learn.adafruit.com/dht
MIT License
144 stars 61 forks source link

Stat the sampling success rate #11

Closed winlinvip closed 7 years ago

winlinvip commented 7 years ago

It seems DHT11 is more stable than DHT22. DHT22 may sample failed for 101 or 105 sometimes. Let me write examples to stat the success rate.

winlinvip commented 7 years ago

Refine the wait time for DHT22, wait more time according to the protocol.

winlinvip commented 7 years ago

I tested the v1.0.6.

For DHT11, using examples/DHT11ErrCount, it works well:

DHT11, 28 *C, 30 H, total: 100, err: 0, success rate: 100.00%
DHT11, 28 *C, 30 H, total: 200, err: 0, success rate: 100.00%
DHT11, 28 *C, 30 H, total: 300, err: 0, success rate: 100.00%
DHT11, 28 *C, 30 H, total: 400, err: 0, success rate: 100.00%
DHT11, 28 *C, 30 H, total: 500, err: 0, success rate: 100.00%
DHT11, 29 *C, 29 H, total: 600, err: 0, success rate: 100.00%
DHT11, 28 *C, 30 H, total: 700, err: 0, success rate: 100.00%
DHT11, 28 *C, 30 H, total: 800, err: 0, success rate: 100.00%
DHT11, 29 *C, 29 H, total: 900, err: 0, success rate: 100.00%
DHT11, 29 *C, 29 H, total: 1000, err: 0, success rate: 100.00%
DHT11, 28 *C, 30 H, total: 2000, err: 0, success rate: 100.00%
DHT11, 28 *C, 30 H, total: 3000, err: 0, success rate: 100.00%
DHT11, 23 *C, 21 H, total: 9841, err: 11, success rate: 99.89%
DHT11, 24 *C, 30 H, total: 10351, err: 11, success rate: 99.89%

For DHT22, using examples/DHT22ErrCount, it works well:

DHT22, 28.50 *C, 66.70 RH%, total: 100, err: 0, success rate: 100.00%
DHT22, 27.60 *C, 73.70 RH%, total: 200, err: 0, success rate: 100.00%
DHT22, 28.30 *C, 71.70 RH%, total: 300, err: 0, success rate: 100.00%
DHT22, 27.60 *C, 69.10 RH%, total: 400, err: 0, success rate: 100.00%
DHT22, 27.90 *C, 76.60 RH%, total: 500, err: 0, success rate: 100.00%
DHT22, 28.00 *C, 68.80 RH%, total: 600, err: 0, success rate: 100.00%
DHT22, 27.80 *C, 75.30 RH%, total: 700, err: 0, success rate: 100.00%
DHT22, 28.20 *C, 69.70 RH%, total: 800, err: 0, success rate: 100.00%
DHT22, 27.80 *C, 72.60 RH%, total: 900, err: 0, success rate: 100.00%
DHT22, 28.50 *C, 69.70 RH%, total: 1000, err: 0, success rate: 100.00%
DHT22, 28.30 *C, 66.60 RH%, total: 2000, err: 0, success rate: 100.00%
DHT22, 28.40 *C, 73.60 RH%, total: 3000, err: 0, success rate: 100.00%
DHT22, 28.00 *C, 67.90 RH%, total: 4000, err: 0, success rate: 100.00%
DHT22, 28.20 *C, 66.40 RH%, total: 4990, err: 0, success rate: 100.00%