Advanced Member level 4
This mini thermostat with group regulation is based on Attiny13. The design is very small and what more important, it is equipped with group regulation. Unlike the use of one operational amplifier, presented here thermostat not only provides these functionalities, but also ensures maintaining temperature stability. Another advantage of the microcontroller used is the fact that Attiny13 is simple and cheap one. You will also need an accurate thermometer if you want to know the exact temperature, because it is only stabilized by the thermostat.
The stabilization of temperature can be carried out by means of simple NTC thermistor. It can heat when it is cold or cool when it is too hot. Output for the heater is implemented on a triac, while cooling – on a simple relay which can switch on the fan. Of course, you can resign from that function and use only heating. When you want to enter the temperature for stabilization by using the function button, the longer pressing of which (2s) stores the current temperature that will be maintained (even after turning off it will be stored in the EEPROM). Saving the temperature is indicated by green diode blink for 0,5s. In the stabilization mode, that diode lights all the time. When the system heats up – only the yellow diode lights, when it cools – the red diode. If temperature is the same as the saved one – the green diode lights. Short pressing the button causes switching to the manual mode (the green diode turns off) and cyclical switching between the constant heating (the yellow diode lights), constant cooling (the red diode lights) and auto mode (only the green diode lights). This simple function can be very useful when determining the temperature.
The measurement is implemented on internal analog-digital converter of the microcontroller. In order to gain the most accurate measurement, the average of 64 measurements is calculated, what makes it possible to reduce significantly noise. Cooling is enabled when the measured temperature exceeds the set temperature by a unit of 1024 units, what is the saved temperature + 1, and it is disabled when temperatures are equal. To eliminate intermediate states, enabling/disabling the relay is carried out with 0,5s delay.
The most important function of this thermostat is heating. The algorithm is carried out in a way that the heater's power is reduced in proportion to the temperature grow, what means the closer to the saved temperature, the less power is given by the triac.
Control is based on 10-point group regulation with increase by every 2 units (out of 1024 units), or it starts 20 units before the saved temperature and proportionally every 2 units it decreases the power until zero. Values on the schematic allow for stabilization of temperature from 25 to 100 degrees Celsius.
The circuit is powered from the mains and does not have synchronization with it. This treatment is rarely used, but it is recommended here in order to simplify the circuit. You have to use optotriac with switching on in zero, what provides the full period of voltage, and the set frequency of interrupts in the microcontroller is enough to synchronize.
Note that this design involves high voltage that can be dangerous to your health and life! Pay attention when running!
Link to original thread (useful attachment) - ATTINY13 mini Termostat z regulacją grupową