Lighting automation of land in the village or the first step towards a smart home

I've been meaning to write about your smart home and here came the long vacation, which I'm not gone and have good reason to pursue it.

First, the preamble. It all started with the fact that I have put several posts on the village site and installed ceiling lighting. Then I had the idea to somehow automate lights turning on and off.

A simpler version of valcucine light in the evening and off in the morning with a light barrier is not suitable as the light came in the window of the house and interfered with sleep. The family said this version of the chorus of “no.”

The next option was relay time and calendar REV-302 NOVATEK-Electro. The drawback to this was the fact that he more or less allowed to turn on the light at dusk (dusk calendar), but to determine when to extinguish the light was definitely impossible to sleep in the village lie down sometimes at 10pm, sometimes in 1 night — any mode!

I began to think about possible scenarios. In the first variant (rather clumsy) had three modes:

  • day — lights are out
  • dusk — the lights are on
  • night — light turns on for some time by a motion sensor.
The switching of day-dusk and night-the day is obviously implemented with the help of the light barrier. Switching mode twilight and night on the idea was to be implemented in specified time (30 or 60 minutes) after quenched the light on the terrace. Terrace at village is a place where all always hang out and when everyone goes to sleep the light is turned off. Motion sensors the idea was to stand on the exits from the house or in the hallway and turn on the light in the area, when someone goes to the bathroom at night.

This scenario seemed too complicated and I simplified it by rejecting the motion sensors. In the simplified scenario is as follows:

  • light switches on when dusk (photocell)
  • the light turns off when the morning comes (also photocell)
  • the light can be switched on and off at any time switch.
Despite the simplicity of the script, implement it without any special devices could not. Here on one of the forums suggested to use a programmable relay ПР110 company Aries.



After studying the documentation for the relay, I decided that is exactly what I need. By the way (this is what I have thought much later), this relay allows you to implement the first scenario. The only thing that slightly confused — I thought that the use of such relays for such a simple task is as from a gun on sparrows, but for lack of other options I decided to try it.

Relay is programmed in a visual environment OWEN Logic, in which the program is created in the form of block diagrams. A visual approach to programming also played a role to remember programming languages do not like, and everything seems to be just (much later, I slightly changed his attitude to the visual programming is really nice for very simple tasks, but as soon as the complexity increases visual programming becomes a burden). In this environment, I implemented your logic and checked in the emulation mode — all is working exactly as wanted.





Still not sure how well the implemented algorithm, but since it works, then not touch for anything

You could go to practice. I bought a programmable relay, photocell and button-switch. To the relay also had to buy a special device to connect to computer to download programs to the relay and to debug. Debug was nothing special, but to download without him was impossible.

Assembled in the kitchen test bench.

In may, when I went to the village, I installed the relay, loaded him into the program and for two years now everything works perfectly, without a single intervention.



Was it possible to find this task more optimal solution? Probably Yes, if you solder a circuit control independently. This option is also considered but my knowledge is clearly not enough to come up with a scheme independently, and to solder I can, but not very much. Since then I met and studied different controllers, but for small tasks I still believe the programmable relay is a good alternative. published

 

Source: geektimes.ru/post/268640/