Prologue
With the advent of the electronically controlled gas boiler at home, living, as it were, becomes more pleasant. Having improved this moment with a simple thermostat with two buttons and a seven-segment, it seemed that everything was alright. But it was decided to develop this idea.

Definitely, the
NEST project is the leader in home temperature control.
So it was decided to create a similar device, but adding the right one and removing what rarely comes in handy.
Decision
Our device should be able to:
1) Show the temperature at home and outdoors
2) Turn on the heating when the temperature of the house drops below the set
3) Accordingly, we will set the temperature schedule (for example, at 6 am we need 22 degrees, when everyone went to work, you can and 18, etc.)
Of the buns
4) The graph of outdoor temperature for the day
5) Hours (turned out in passing)
')
Iron
For greater clarity, it was decided to use the LCD TFT display on the ILI9320 controller. This display comes with different diagonals (2.2-3.2 inches). Resolution 240x320. There is a resistive touchscreen touchscreen. In principle, you can use almost any display with the same resolution. You only need to change the initialization procedure. In the attachment there is a list of supported controllers for which there are examples of initialization, thanks
Noi .

The text was originally only 8x8, and for small inscriptions it was enough, it was also possible to display this font with a double scale. The font was generated by the LCD Font Generator program and stored in flash. But for large numbers this was obviously not enough. Another 128x128 font was created in the same program. You can choose any font. But 10 numbers and 3 characters occupied 200kB of memory. I was too lazy to invent a format for compression, and I added external memory eeprom 24c256. It stores large numbers and a couple of icons.
Scheme

Attempting to fit the entire device in a cramped enclosure led to two boards connected by MGTF wire.


The first board serves for decoupling a fairly small display pitch, the second one is occupied by the Atmega32 (the code takes 47% flash, so the Atmega16 is suitable), the EEPROM and the 3.3V linear regulator.

The display is powered by 3.3 volts, and the input is not tolerant to 5 volts, so I powered the MC from 3.3V so that the level matching would not be added. As temperature sensors used DS18B20

What would the boiler understand that it is time to turn on it is necessary to apply 220V to a special input. For switching, a relay was added, which was placed inside the boiler on a separate board along with a 12V power supply and a 5V stabilizer. Also added another relay, its winding is connected to 220 directly. A common contact goes to the ground, and normally closed at the input of the MK. Now for what you need. With the loss of electricity, this relay first of all falls off, thus a zero appears at a certain input of the MK. Immediately turns off the display. Now Atmega works only at the expense of charged capacitors in the power supply and consumes 7ma. This is enough for 2-3 seconds of work; during this time, all the necessary information (home temperature setting schedule, settings) is rewritten into non-volatile memory.

In order for the clock to continue to go while there is no electricity, the DS1307 real-time clock chip has been added. Since the idea with this microcircuit came after the prototype was made, I added it on a separate shawl, bought from the Chinese for $ 2.

First start

Prototype ready

Soft
The display has 5 touch buttons, we will use them to select the mode.
Above it always shows the temperature of the house and on the street, the temperature setting at a given time, delta and time.
Pressing the buttons selects the appropriate modes:
House temperature

(You may notice a lot of service information, which is displayed on the display. It was needed for debugging, but already removed from the firmware)
Outdoor temperature

Temperature graph for the day (implemented auto scaling graph)

Schedule for setting the temperature of the house

In this mode, we can see the previous schedule of the task (yellow) and the new one that I just asked (green).

After 10 seconds, the old one will be removed and the green will be redrawn yellow.
Clock. There is nothing to say

Settings while minimalist.

In the upper part of the display you can see a drawing of a light, it is drawn all in the same LFG program. With the generation of fonts, drawings and other characters there is not any problems. The big numbers were a bit wide when they timed out, so they compressed programmatically by 75%. The pictographs of the house and the street were converted into an array using the LCD Assistant program.

Well, that's all, for someone, this article can podvodvinet to create this, and maybe help to create a device on a similar display.
Source code on
github.com