Skip to content

Commit

Permalink
DHT22 pulldown/up timing to 2000 / 30
Browse files Browse the repository at this point in the history
DHT22 pulldown/up timing to 2000 / 30 according datasheet.
Which tells: 
Pulll low: "more than 1ms --> 2000us is ok (1100 gives errors)
Pulll high: 20 - 40 us --> 30 is ok (was 55 which is out of specs but gave no errors)
  • Loading branch information
ehorvat1 authored Jan 26, 2025
1 parent 07092b2 commit 22ff571
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/driver/drv_dht_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ dht_t *DHT_Create(byte pin, byte type) {
ret->_pin = pin;
ret->_type = type;
ret->_maxcycles = 10000;

DHT_begin(ret, 55); //Pull up delay acc. datasheet 20 to 40ms ... ret,30 (was 55)

// http://www.adafruit.com/datasheets/Digital%20humidity%20and%20temperature%20sensor%20AM2302.pdf
DHT_begin(ret, 30); //Pull up delay according DHT22 datasheet 20 to 40ms --> DHT_begin(ret, 30) (was 55)

return ret;
}
Expand Down Expand Up @@ -313,7 +314,7 @@ bool DHT_read(dht_t *dht, bool force) {
switch (dht->_type) {
case DHT22:
case DHT21:
usleep2(2000); // data sheet says "at least 1ms" //Like Tasmota 13.x now 2000 (was 1100)
usleep2(2000); // data sheet says "at least 1ms" --> usleep2(2000) (was 1100 which may cause read errors)
break;
case DHT11:
default:
Expand Down

0 comments on commit 22ff571

Please sign in to comment.