After several years of fruitful work, it was decided to bring our first product for climate control in a smart home to the public - a smart thermostat for controlling underfloor heating.
What is this device?
This is a smart thermostat for any electric floor heating up to 3kW. Controlled via application, web page, HTTP, MQTT, therefore it is easily integrated into all smart home systems. We will develop plugins for the most popular ones.
You can control not only electric underfloor heating, but also a thermal head near a water heated floor, a boiler or an electric sauna. Also, with the help of nrf, the thermostat will be able to communicate with various sensors. Nearly all climate-related sensors are currently under development. Since the device is based on ESP, we decided that it would be inappropriate to take away customization options from users. Therefore, we will make sure that the user can put the device into developer mode and install other firmware, for example, with support for HomeKit or third-party projects.
*after installing third-party firmware with HomeKit support or other popular projects, a return to the original one is not possible via OTA (Over-the-Air).
The difficulties we encountered
To say that they were not, it would be foolish. I will try to describe the most difficult problems that appeared and how we solved them.
Enclosure for the device was a challenge. Both in terms of resource costs and time costs (we developed it for about a year).
There were a lot of options on the market. And the most popular is 3D printing. Let's guess:
Classic 3D printing. The quality leaves much to be desired, the speed of production too. We used 3D printing for prototypes, but it didn't work for production.
Photopolymer 3D printer. Here the quality is many times better, but the price effect comes into play. Prototypes printed on a similar printer cost about 4000 rubles, and this is one part of the case out of two. You can buy your own printer, which will reduce the price, but still the price will be cosmic, and the speed will be unsatisfactory.
Casting in silicone. We considered this the best option. The quality was at the level, the price was high, but not critical. Even the first batch of 20 cases for field trials was ordered.
But the case changed everything. One of the evenings, I accidentally published in the internal chat for developers that there is a joint with cases, the price is high. And the next day, a colleague wrote in a personal message that a friend of his friend has an injection molding machine (thermoplastic machine). And you can at the first stage make a mold for it. This post changed everything!
Before that, I considered the use of injection molding machines, but I was not even stopped by the need to order a batch of at least 5000 pieces (although if you try, you can find less through the Chinese). I was stopped by the price of the mold. About $5000. I was not ready to pay this amount at once. The amount for the press form through our newly minted colleague was not cosmic, it varied in the region of $2000-$2500. In addition, he went to meet us and we agreed that the payment would be in installments. So the problem with the hulls was solved.
The second and no less important difficulty that we encountered is iron.
Do not count the number of iron revisions. According to conservative estimates, the presented version is the seventh, not counting the intermediate ones. In it, we tried to solve all the shortcomings identified during the testing process.
So, earlier I thought that there was no need for a hardware “watchdog”. Now, without it, the device will not go into series: due to the capriciousness of the platform we have chosen.
Another analog input to the ESP. Previously, I thought that each ESP pin is universal. But ESP has only one analog pin. I learned this in practice, which led to alteration and reordering of printed circuit boards.
The first version of printed circuit boards
The second version of printed circuit boards
The penultimate version of the printed circuit boards, where we had to urgently solve problems with the analog pin
As for software, there were also a lot of pitfalls.
For example, periodic falling off of ESP. Despite the fact that the ping goes to it, the page does not open. There is only one solution - rewriting the library. There may be others, but all of the ones we have tried have failed.
The second significant problem, oddly enough, is the number of requests to ESP when opening a page. Using GET or ajax, we were faced with the fact that the number of requests became indecently large. Because of this, ESP behaved unpredictably, it could simply reboot or process the request for several seconds. The solution was to switch to web sockets. After that, the number of requests decreased significantly.
The third problem is the web interface. More information about it will be in a separate article that will be published later.
For now, I’ll just say that the best option at the moment is to use VUE.JS.
This framework is the most suitable of all that we have tested.
Interface options can be viewed at the links below.
After overcoming all the difficulties, we came to the following result:
Design
The thermostat consists of three boards (modules):
manager;
Managed;
display board.
Manager - the board on which the ESP12, Hardware "watchdog" and nRF24 are located for working with future sensors. At launch, the device supports the DS18B20 digital sensor. But we provided for the possibility of connecting third-party analog sensors. And in one of the future software updates of the device, we will add the ability to use sensors that come with third-party thermostats.
Managed – power supply and load control board. They placed a 750mA power supply unit, terminals for connecting temperature sensors and a 16A relay for load control.
Display – at the development stage, we chose nextion display 2.4 inches.
You can easily find information about him on the Internet. From myself I will add that it is convenient for almost everyone, except for the price. A 2.4-inch display costs around 1200 rubles, which does not affect the final price in the best way.
So it was decided to make an analogue for our needs, but at a lower price. True, it will have to be programmed in the classical way, and not from the Nextion Editor environment. It's more difficult, but we're ready for it.
An analogue will be a 2.4-inch matrix with a touchscreen and a board with STM32 on board to control it and reduce the load on the ESP12. All control will be similar to Nextion via UART, as well as 32 MB of memory and a full-fledged flash card for recording logs.
The modular design makes it easy to change one of the modules and the output is a completely different device.
For example, there are already options for “board 2” in several versions:
Option 1 - for underfloor heating. Power supply from 220v. The relay controls any load after itself.
Option 2 - for a water heated floor or battery valve. Powered by 24V AC. Valve control for 24v.
Option 3 - powered by 220v. Control of a separate line, for example a boiler or an electric sauna.
Afterword
I am not a professional developer. I managed to unite people with one goal. For the most part, everyone works for an idea; in order to do something really worthwhile; something that will be useful to the end user.
I'm sure someone won't like the case design; for someone - the appearance of the page. It is your right! But we went all this way ourselves, through constant criticism of what we do, and most importantly - why. If there are no such questions as above, we will be happy to talk in the comments.
Constructive criticism is good, and we are grateful for it.
The history of the idea here. For those interested: