How I automated the dacha by 90%

    A country electrician is a well-known problem; If there is an opportunity to connect something wrong and not there - this, of course, will be done.

    When my wife and I began to build a new cottage instead of the old one (where the electrician was laid by many generations and was a terrible jumble of wires and wiring boxes), we first of all decided that the electrician would be competent, and the country house would be smart.

    A note from the Wiren Board marketer: the author of the article is a previously ordinary Wiren Board user, and now an engineer in our team. He automated his own dacha before joining our team. All text is written by the author, except for the notes at the end.

    In the photo on the right: contact science - practical implications.

    The first guinea pig became the hozblok. Upon completion of its electrification, it became approximately clear how much work was waiting in a residential building, how to lay cables, how to solve other problems. All but one - automation.

    I spent a lot of winter evenings preparing the cartchoosing a system on which the entire management of the future “smart cottage” will be based. I looked at Siemens, at Aries, at Raspberry, but eventually settled on the Wiren Board. Is there Linux on it? For a real “single” it’s just a balm for the soul!

    The first training instance was Wiren Board version 4. There were many problems with it, and its programming was not as obvious as it seemed at first. But all the pitfalls were studied thoroughly, each moray sitting in the crevices was named, and by the time the 5th version appeared, I was sure that the controller would cope with my tasks.

    What I wanted: first, as much as possible to automate all the processes that in the old house had to be done manually - for example, water supply to the house from the well, which we share with our neighbors. Secondly, automatically manage the climate. Thirdly, to control the house remotely and be able to monitor everything and everyone. Fourth, make the lighting comfortable and really smart.
    I also wanted an uninterrupted power supply, reliable grounding and human Internet.

    Cable laying

    Smart home means hundreds of meters of cables coming out of the switchboard and diverging in all the most remote places.
    The house is wooden (frame), and the installation of harnesses of even fifteen to twenty cables in such a house is a real problem. When hidden wiring in ceilings and walls, cables can be laid only in thick-walled metal pipes. And if several dozens of them leave the shield? And if somewhere something does not contact? And if you need to lay another couple of unspecified cables?
    In short, it was decided to use cable channels. After consulting, my wife and I chose a Legrand DLP 80 mm with Mosaic installation products. Sneaking suspicions that the cottage will be a bit like an office, but they did not materialize. DLP channels look very aesthetically pleasing, it is convenient to install them, it is convenient to lay cables in them, and most importantly, it is convenient to lay many cables in them!

    Cable channel Legrand DLP with installed outlets, switches and cable output series Mosaic

    Shield selection

    ABB TwinLine wardrobe with EDF profiles and assembled EDF modules before connecting.

    Shields are not large. Especially if they are mounted automation of the whole house. And if you suddenly thought that the shield is too big, and your friends laugh: “Do you feed the entire dacha village ?!” - boldly take the shield one and a half times more! If you think that ten cables will be enough for you, lay five more. Ten outlets on the room - bust? Just as much just does not hurt. If for the second floor it is more convenient to mount a second shield, then so be it!

    What was required for automation

    Of course, the Wiren Board 5 controller itself (see note 1 at the end) . The main actuators are relay modules with which the controller communicates via RS-485. The communication cable was chosen specialized, with thick conductors and a screen - Belden RS-232 / RS-485 2x2x28 (see note 2 at the end) , since it was to be laid in different places, including near the power cables. The screen is grounded in the switchboard, on the input I made the grounding of the TN-CS with a buried metal welded ground loop next to the house as a grounding conductor and re-grounding the incoming neutral in the input shield. Grounding resistance is measured with a special tester UNI-T UT521, which is bought on the occasion at a discount.

    Introductory plate before sealing


    The switchboards used relay modules WB-MR14 and WB-MR11 , powerful consumers connected via ABB modular contactors (see note 3 at the end) .

    Relay modules and contactors

    Groups of two or three Ledare LED lamps from IKEA are switched through the WB-MR14 relay.
    Connecting almost every light source to its entrance made it possible to realize the wildest desires. Together with WB-MD2 dimmersthe lighting is getting quite clever. Through the rules engine, I implemented an astronomical relay - the spotlight on the pole at the entrance turns on when twilight sets in. Lamps in the same room can be switched on separately, with the necessary brightness. Programmed “escort light” (accompanying light mode, the function “we all leave”): outdoor and garden lighting in the evening goes out after some time after all inhabitants leave the cottage - you can close, check, close and check again :)

    Instead of the usual switches, buttons without latching are installed everywhere in the house: they provide more options, allowing you to process a long press: for example, the same button is used to turn on the accompanying backlight mode, which turns on the light on the porch of the house, but when pressed, the accompanying light turns on . This is done by the following rule with two timers (one determines a long press, the second one turns off the light):
    rule for “escort light” (function “we all leave”)
    var fronton_timer_1_timeout_ms = 2000;
    var fronton_timer_1_id = null;
    var fronton_timer_2_timeout_ms = 60000;
    var fronton_timer_2_id = null;
    var lightmode = 0;
    defineRule("frontonButtonPressed", {
        whenChanged: "wb-mr14_143/Input 13",
        then: function(newValue, devName, cellName) {
            if (newValue) {
                log("The fronton button is on")
                if (dev["wb-mr14_143"]["K13"] == false) {
                    fronton_timer_1_id = setTimeout(function() {
                            log("fronton timer 1 complete");
                            lightmode = 1;
                            dev["wb-mr14_143"]["K13"] = true;
                            dev["wb-mr14_143"]["K14"] = true;
                            dev["wb-mr14_141"]["K8"] = true;
                    fronton_timer_2_id = setTimeout(function() {
                        dev["wb-mr14_143"]["K13"] = false;
                        dev["wb-mr14_141"]["K8"] = false;
                        dev["wb-mr14_143"]["K14"] = false;
                        log("fronton timer 2 complete");
                    }, fronton_timer_2_timeout_ms)

    The RS-485 bus speed by default - 9600 bps - turned out to be too slow to control the lighting in scenarios like “if this lamp is turned on, then we turn on the other two as well.” Relay modules had to be transferred to the speed of 115200 bps, and slow devices were connected to the unused RS-485 port. And it helped - the delay of the inclusion of the rules was about half a second. At the same time, contrary to expectations, the increase in speed did not degrade the quality of data exchange on the bus.

    Remote control and uninterrupted power

    Backup power - Mikroart MAP battery inverter with four 200 Ah * 12 V batteries

    Remote control and uninterrupted power make home automation available anywhere and anytime. I struggled with a local provider for a fiber-optic cable for a long time (mobile communication, especially in summer with the influx of summer residents, leaves much to be desired, despite any tricks with antennas), and with the advent of optics it became easy and simple to control the house. At the same time, backup channels in the form of 4G and SMS remained. 4G comes to the dedicated Mikrotik RB750UP router (physically located directly in the antenna). A limited set of SMS commands, when there is no Internet at all, accepts Wiren Board via the integrated GPRS module and gammu-smsd. It was decided not to process it through the rules engine, but through Perl scripts (hello, Linux!). Each phone number has its own rights and can execute commands that are described by scripts (for example, “Pingpong text” will respond with “text”, “reboot” will reboot the device, “relay 21 K2 on” will close the desired contact of the desired relay). Of course, the safety of such a decision should be carefully monitored, but the hands have not reached it yet.
    Remote control of the controller is available from everywhere: VPNs are thrown between the local networks of the dacha and the house, mobile devices of family members are connected via VPN, respectively, everyone has access to the controller's web interface.

    Backup 4G channel. Mikrotik RB750UP router is located inside the antenna.

    Communication cabinet (Mikrotik RB2011UiAS + GPON router) and video surveillance server.


    The heating of the house was fundamentally chosen by electric, largely because of the convenience of control, including remote. Gathering to the country in cool weather, you can turn on the heating at night, the next day the house is warm.

    Noirot Spot Convector The Noirot

    convectors installed do not support control protocols compatible with Wiren Board, but the 1-wire DS18B20 temperature sensors connected to the WB-M1W2 allowed the temperature to be regulated by means of the controller itself (turning on / off the heating according to the set temperature). And in the bathroom, not only the temperature is controlled, but also the humidity by the WB-MS (TH) module .

    DS18B20 sensor in the housing, mounted in the cable channel

    WB-MS sensor in the bathroom (this is the end of the RS-485 line, a 120 Ohm terminator is installed)

    Heated floor in the bathroom. The bathroom is the only room where the floor has a concrete base and is laid with ceramic tiles over the Devi heating mat. Heated floor turns on automatically at 23:00 and turns off at 7:00, consuming electricity only at the night rate. This is enough to warm and comfortable in the bathroom in the morning. Siemens HVAC controller communicates with the Wiren Board via Modbus.

    Siemens RVF HVAC controller with Modbus control

    Water supply and sewage

    Water is pumped into the house from the well through an intermediate tank, pressure in the water pipe is pumped by the pumping station and held by the expansion tank, and the sewage system drains into the septic tank. As it turned out, this part is most capricious and requires automation like none of the subsystems.
    The operability of the well pump is controlled by a meter with a pulse output (I plan to change it to meters with RS-485). Pulses are counted by the WB-MCM16 counter . We applied voltage - and the water does not flow? Crash. All off and go to understand. Cumulative capacity empty? Turning off the pumping station, fill capacity.

    Counter with pulse output (one pulse per liter)

    Wiren Board monitors ELKO HRH-5 water level sensors with stainless steel rods. The septic tank must merge in time, and if the pumping pump does not work, we will again learn about the accident. The sensor in the septic tank - float with dry contact. The septic tank was aerated, and if the compressor started feeding too little (something was beating) or too much (something was torn) of air into the septic tank - this urgently requires intervention, otherwise all bacteria will die, and the flora will have to be restored for a long time. The control of the flow rate is performed by Wiren Board itself via common input A1, programmed to the pulse count.

    Gas meter with pulse output measures the volume of air supply to the septic tank

    The septic tank has a limited capacity - if you get involved in taking a shower on a hot day, the quality of wastewater treatment will noticeably (everyone noticeably :)) worsen ... The amount of water consumed per day is also taken into account by a pulse counter and a WB-MCM16 module.
    Two hot-water electric water heaters AEG (connected through a relay module + contactor) provide hot water to the house, and upon arrival at the dacha hot water is right there! Remote control, as already said, is carried out from the web interface of the controller itself via VPN.

    Interesting features

    At the same time there is a huge space for experiments. We connect a long-range Chinese radio control to the WBIO-DI-DR-14 side contact dry contact module to control everything (though it’s better not to connect anything critical to the console). In the rules engine, the console is described as a virtual device.

    Chinese console in the web interface

    Managing Wiren Board via the Telegram channel (but is it somehow unavailable lately?) Done via ioBroker and MQTT on the Raspberry Pi. In Wiren Board 6, to which I have not yet transferred the dacha, I hope to do it without “raspberries”. In the extreme case, the controller accepts SMS with commands (how to do it ALL securely with regard to SS7 vulnerabilities, I haven’t yet come up with: one-time passwords?).

    All this is enough for a comfortable stay in a country house. But there is no limit to perfection.

    What is not done yet and what is planned

    • Controlling air conditioning with WB-MIR modules . Now air conditioners are turned on manually, and sometimes you can observe how in one room the heater fights for the “right” temperature with the air conditioner. The fight is fascinating, but, alas, it goes at the owner's expense :)
    • Automate the distribution of water from a well between two neighbors without switching hoses and flooding (according to forgetfulness) half of the site.
    • I would like to monitor the operation of the battery inverter and the status of the batteries (via the analog input module WBIO-AI-DV-12 ).
    • I want to set up integration with the security system and Xeoma video surveillance system .

      The video surveillance system controls the movement around the perimeter around the house and on the plot
    • I would like the cottage to recognize its own people, their attempts to come to it, and to affably wave the Nice gate entrance drives (see note 4 at the end of the article) .
    • I do not plan to do a greenhouse yet, but Wiren Board (just in case) monitors the temperature of the environment and the ground with the same DS18B20 sensors. At first I thought that they would quickly be eaten away by corrosion, but the stainless case survived more than one winter.
    • Disconnect non-priority loads. Allocated power is limited, so when you turn on all-all-all consumers, it is still possible to exceed it. Now the SDM220 meter connected via Modbus is monitoring the power consumption. But for analyzing the energy consumption of individual consumers, I think to switch to WB-MAP12 (but I had to plan more places in the dashboard , yes).

    See you again!

    Marketer Notes

    1. Now we already have a Wiren Board 6 controller - with the same price and functionality, but more productive .
    2. Instead of the expensive Belden RS-232 / RS-485 2x2x28, we recommend KSPEVG 2x2x0.35, which costs only 30 rubles / meter and never failed even on complex industrial installations.
    3. Powerful loads can also be controlled without contactors - now in the equipment line there are powerful relay modules WB-MR6 (current 16 A per channel, including starting current up to 800 (!) Amperes in modification S) - the load can be connected directly through them.
    4. Regarding the opening of the gate upon arrival: one of our clients made such functionality - the barrier of the mini-hotel opens when a Bluetooth device appears with the name from the list (Wiren Board 5 and 6 have a performance with Bluetooth).

    All questions will be happy to answer in the comments.

    Also popular now: