Smart home, I still made you
A smart house, quite a hackneyed topic in our time and in this publication I will not tell you about new technologies, manufacturers and current trends of this topic, everything is written to me once a hundred. I will try to briefly describe the process of creating a smart home (hereinafter UD) without deep technical narratives. If this topic will be interesting to readers, I will lay out completely all the listings of programs, MK firmware, diagrams and everything necessary to make this miracle the heart of your home.
The main concepts in the development of a DD are the complete absence of a “collective farm”, in other words, the electronic stuffing should not stand out aesthetically (ordinary sockets, switches, light bulbs) and not burden users (duplicating the main functionality in usual ways: any light source can be turned on either from the switch and from the phone, and not as with smart lamps, who is in the subject, he will understand). I will even apply the picture for clarity:
Last supplement and finish with lyrics. I could buy a ready-made smart home system, but in the recent past I was well versed in circuit engineering, electronics, programming, and I had a car of time, and at that time I started building a country house, which I really wanted to endow with a brain. In general, this is how to ask the fisherman why you fish if you can go buy it! For the pleasure of the guys, for the pleasure, the understanding that you can automate your home, and put your soul, your ideas, your logic in it, really makes your home somehow alive. Let's go!
First of all, I defined the DD functional, which is really needed:
- Control of all light sources, both from the switch and from the application
- Lamp brightness control
- Various lighting modes: automatic shutdown, presence mode, light in the night - this mode I thought up when you turn it on, it lights your way at night to the toilet. You do not iron your hands on the wall in search of a switch, you can think of something else.
- Control of certain sockets where the iron, curling iron, hair dryer, hob, etc. is connected The ideology is as follows: left, forgot turned it off or not, turned it off through the application.
- From the preceding paragraph it follows the need to control the house from anywhere in the world and the lightteness remains: -temperature
and humidity in the house, on the street and in the basement
-temperature and pressure in the heating system (private house, nowhere without it)
-protection against leaks, smoke , more precisely, not protection, but notification.
From words to deeds
Divided the system into three blocks:
- Блок управления освещением и силовой нагрузкой
- Блок мониторинга (различные датчики)
- Мини компьютер(Основной мозг, OS server core, .Net)
9-channel control unit for lighting and power load
Basis MK from Atmel atmega1284 no arduino, only hardcode, only C, ethernet ENC28J60 was selected as the communication channel with the brain (UART is boring, limiting the length of the wire, even hangs from fume), a few words About the ENC28J60 module, in fact, a dubious microcircuit: errata is no longer datashit, but for the month of work it has never hung up, so for now I have no complaints about it. He promised without technical narratives, but this is not floor cleaning, completely without terminology, nowhere. 7 switches and 7 lighting devices are connected to the unit, two channels go to contactors of 25A each, one to the outlet where the wife strokes my trousers for work, and the second to the nursery, there are two for parallel sockets. First I collected everything on my knee in my laboratory.
Trawl board by LUT method
After the board was tested for operability, I ordered several copies of the circuit boards in Novosibirsk
I assembled two copies of the control unit, one for testing the loads of the second already for installation in a country house. It is terrible to install equipment in which I am not sure of the house. Each channel in theory withstands a current of 12 amperes, but 2-3A is enough to illuminate or control the contactors. No matter how I tried to burn the test board, I did not succeed, I even connected a 3 kW heat gun, the triacs warmed up almost to red, but none of them failed. Summarize the board passed the test as well as possible.
The microcontrollers on the board were programmed and installed in the house, the light could already be turned on through the switches, but the smart house still did not smell.
Mini-computer
At work, I discovered a thin client with 1GB RAM and 8GB ROM, on Amazon, the price for it is slightly more than 100 bucks. I chose Server Core as the OS, because I am a C # oriented person). I don’t know how to write native software for android and apple and for a long time I decided for myself that my bot on the Pashka Durov platform would manage the smart home (Telegram who didn’t understand) for a week I sat behind the laptop under spaten and the bot is ready. It's nice to work with smart people, this is about telegrams, the bot was written in one breath, clear documentation, working libraries, no glitches. One well-known sad moment: the Roskomnadzor wants to block the cart with all its might, and it works on smartphones as it worked, but with the bots the situation is slightly different, they connect to the servers one time and in order not to tempt fate I picked up on AWS (Amazon Web Services) openvpn server (and for free, In Amazon, there is a payment for traffic, and traffic through the bot is minimal). After downloading, the thin client connects to the vpn server and, already bypassing all Roscomnadzor blocking, quietly processed requests.
Total
The system works for a month in real conditions without a single glitch. In the telegrams on the android there is a bun that you can bring the bot directly to the desktop and open as a separate application. Yes, I am far from being a creative person and called the bot Jarvis
Very pleased with the bot and there is simply no need to write native software for mobile devices
Some information from the monitoring unit
Ask questions, I repeat, if the topic is interesting, then I’ll post all project sources on github as well as all the schemes so that you can, like KIT, put in all the firmware and work with a bang without much knowledge of programming and circuit design.
Ps. There are flaws in the circuit board (too small gaps between power paths, contacts, there are tracks divorced at right angles). I will pay a fee, the benefit of making a new one is worth a penny. Thanks to everyone who pointed out these errors.