📜 ⬆️ ⬇️

Smart home, as I sunk to such. Part 1


A couple of years ago, when there was a question of finishing a new apartment, a seemingly trivial task arose.
Given:

Solution options:

But I am not an electronics engineer, I am a programmer, I never programmed controllers, only full-fledged servers. So the brain must be a server. And once the server is set up, then controlling three light bulbs is from a cannon on sparrows (even a nuclear charge on flies). So you can still add functions.
Then Ostap suffered (s), the capital moves to Vasyuki. Three bulbs with switches turn into a control, monitoring, video surveillance system, etc.

I will not talk about how I chose 1-wire for a long time, they wrote a lot about it before me.
Bribed:

I’ll say right away that I wasn’t going to solder the chips myself, I wanted to buy ready-made and adapt for myself.
But at that time I worked together with BarsMonster and he “put me on the right path”.

When I needed to control 8 sources in one place (a ceiling with LED lights), I could buy four controllers (each with two points could control) 700 rubles already suffocating 700 rubles.
And he suggested: "Let me make you a scheme, because everything is simple there." “Come on,” I said.

Somewhere in a week I received a fee and a set of components (I decided to solder myself, it was interesting). I did, I liked it. Then he himself spread the next board, BarsMonster only erased it, and then he mastered the process of manufacturing printed circuit boards at home and made the following boards himself.
')
Computer layout -> laser printer -> iron -> ferric chloride -> soldering iron. Voila!

The first schemes were similar to those purchased, on a DS2413 chip, providing control of two sources. But then I almost completely switched to DS2408, which gives eight channels. But how to use them (to control or read the sensor) was decided in each case. And of course everyone’s favorite DS18B20 thermometer.

At the moment I have used:


With the DS18B20, everything is quite simple, I connected two legs to the bus and forgot.
image
Although, then it turned out the pitfalls. On the parasitic power supply, the sensor blocks the entire bus for the time of temperature measurement, and the more accurate the measurement, the longer (from 0.3 to 1.5 seconds), which turned out to be critical for polling the sensors responsible for the switches. So, if I did everything from scratch, I would either make power boards for them, or even throw a separate bus at all; there’s no point in asking them themselves more often than once every few minutes.

Why so much? But because it is easy to put;)



DS2413 boards
image
I bought the first three boards, then I made two:


DS2408 Boards
image
The first DS2408 board was used to control all the lighting in the kitchen, since the house is smart, it is no longer interesting to be limited to three sources of lighting, as originally planned. Eight channels? Let there be eight sources. At the moment, four and four are connected in the project (repair is not finished yet).

The second board was entirely for reading sensors. Namely, opening sensors on all windows and the door to the loggia. All the windows face one side of the house, the board is marked out on the loggias, and on the outer wall stretched wires to all the windows. Moreover, at the beginning I thought to pull the wire to each one separately, and then I found a more elegant solution. Twisted pair, from which one pair is gradually moving away to the sensor.

The third board is also entirely for sensors, but on the front door:


As opening sensors, I used unmarked Soviet reed switches dug in the bins of my father-in-law. Plus Neodymium magnets 1x10 mm
image

The sensors on the locks are similar, only I placed the reed switches themselves inside the door frame, and glued the magnets to the bolts of the locks.

Thus, almost all sensors turned out to be hidden.

In the following two boards for DS2408, for the nursery and the bathroom, I made two channels for controlling the lighting, the rest for the sensors:

image
In the backup channels, in the future, I want a story in the bathroom leakage sensors, and in the children's smoke sensor.

By making the latest boards on the DS2408, I, trying to save space, made one mistake that complicates installation and maintenance. I brought to the terminals one contact 5V, 12V, GND. I had to connect several wires to one (for example, the reed switch is connected between 5V and the input contact, the same with the motion sensor, but it still needs 12V and GND), which is inconvenient and unreliable.

With the iron finished, on the software part, I will stop in more detail the next time, but looking ahead, it turned out like this:
Web:
image
Touch screen:
image

UP:
Continued here
Smart home, as I sunk to such. Part 2
Smart home, as I sunk to such. Part 3

Source: https://habr.com/ru/post/158911/


All Articles