Blynk and While (Alternatives)

I think I found the culprit for the high latency! Since the sensors are very popular and widely used, others may find this to be of interest. If you Google DHT22, chances are you’ll end up at Adafruit’s homepage and consequently pick their library.

In the DHT.cpp from their library you find this:

 `pinMode(_pin, INPUT_PULLUP);`

and

  // Go into high impedence state to let pull-up raise data line level and
  // start the reading process.
  digitalWrite(_pin, HIGH);
  delay(250);

This doesn’t make any sense! It’s an open drain bus and at idle it should already be HIGH, which is (normally) accomplished by using an external pull-up resistor. This is also how Adafruit wire the board on their online example. For this reason, the 250 ms delay is a complete waste of time as far as I can tell.

Also, the line should never actively be driven high when using open drain.

Just thinking out loud…

1 Like