DHT22 read errors and retries

Handle checksum failures and timing violations with backoff so one bad read does not blank the feed.

Aosong AM2302 DHT22 temperature and humidity sensor module on a black breakout board
The DHT22 (AM2302) is the digital humidity–temperature sensor used in many DIY space builds. Photo: Suyash Dwivedi. CC BY-SA 4.0

DHT22 reads fail occasionally: timing violations, electrical noise, or a momentary bus contention. Firmware should retry a few times with backoff before marking a probe unhealthy rather than publishing garbage values to JSON.

Retry strategy

  1. On checksum or timeout error, wait at least two seconds and retry.
  2. Cap retries at three to five attempts per poll cycle.
  3. If all fail, omit or hold last good value: document your choice in schema notes.

Hardware fixes first

Verify pull-ups and grounding in data line wiring. Long cables and motor noise from garage door openers aggravate errors. Circuit troubleshooting covers bench checks.

Downstream impact

Bad reads affect averaging and dashboard history. Debugging stale readings on the site helps tell sensor faults from network issues.