DHT22 (AM2302) input for the generic heating / cooling controller

The generic heating / cooling controller (hcctl) is a flexible bang-bang thermostat controller based on an ATTiny25.

The project has been expanded to accept the Aosong DHT22 temperature and humidity sensor. The DHT22 produces a digital output (signed tenths of a degree) has a range of -40° to 80°, accuracy of about 0.5°, and 0-99.9% RH and costs a few dollars. hcctl can be configured for either temperature or humidity sensing (not both simultaneously).

Above is a development prototype with the DHT22 being heated by a small incandescent dial lamp to test function.


The DHT22 is a three wire device, and as used by hcctl requires ground, 5V and the one data wire. The device is attached to the standard external sensor pin of hcctl.

Above is a logic trace of the read of the DHT22. (The start pulse is not compatible with the DHT11 which is a much poorer device.)

The concept of hcctl is flexible common code based with application constants stored in EEPROM. Above is a screenshot of the EEPROM structure for the enhanced code.

The DHT22 setpoint and alarm temperatures are specified as signed temperature*10. For example, for a setpoint of 37.5°, program 375, =10.5° as -105 (0xff97). Differential is of course simply degrees times 10. Likewise for humidity.

hcctl v2.04 supports the DHT22 and like, full documentation at Generic heating / cooling controller.