The generic heating / cooling controller (hcctl) is a flexible bang-bang thermostat controller based on an ATTiny25.
The project has been expanded to accept a Dallas / Maxim DS18B20 1-Wire temperature sensor. The DS18B20 produces a digital output (signed sixteenths of a degree) has a range of -85° to 125°, accuracy of about 0.5°, and costs a dollar for bare chips, a few dollars for an encapsulated probe.
Above is a development prototype with the DS18B20 being heated by a small incandescent dial lamp to test function.
The DS18B20 is a three wire device, and as used by hcctl requires ground, 5V and the 1-Wire data wire. The device is attached to the standard external sensor pin of hcctl, and requires a 4.7kΩ pull up resistor to +5V.
The DS18B20 is used in 10bit mode and must be powered. Direct power is necessary for the full temperature range of the device, so options have not been provided to use parasitic power with hcctl. The DS18B20 is read four times a second to 10bit resolution (0.25°). 0x800 is added to the value read to produce an unsigned 12bit binary value with range -128 to +127° which is then right shifted two bits to obtain an unsigned 10bit value to represent the range -128 to +127°.
Above is a logic trace of the initialisation of the DS18B20 to put it in 10bit mode.
Above is a logic trace of the read of the DS18B20. Both transactions then initiate a conversion which takes just under 200ms at 10bit resolution.
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 setpoint and alarm temperatures are specified as 512+temperature*4. For example, for a setpoint of 37.5°, program 512+37.5*4=662. Differential is of course simply degrees times 4.
hcctl v2.03 supports the DS18B20, full documentation at Generic heating / cooling controller.