📜 ⬆️ ⬇️

Automatic light in the bathroom: my version (without Wi-Fi, preference and poetess)

image
I thought for a long time whether to post this post: no special breakthrough technologies were used, the solution was typical ... But it might be interesting for novice automators.

So, given - toilet, incandescent lamp in the ceiling of IKEA. Lamp type - by design, replacement with CFL or LED is not considered. That is why it was decided to fight with forgetful citizens, not turning off the light, with the help of automatics ...

A friendly Chinese acquired a PIR sensor and a relay (the cheapest, but with a rake, as it turned out later).

image
image
')
Although these components are repeatedly “licked” and familiar, there were some surprises. For a long time, the PIR sensor could not be adjusted, because the trimming resistors were not signed. Information on the Internet was also controversial. With the help of a spear method, I figured out which one is responsible for the time delay, and which one is for sensitivity (the spoiler is the resistor that is closer to the jumper and adjusts the time). Jumper is also a secret. In one position, it counts down the time since the last movement, and in the other, since the last actuation of the start.

With the help of a soldering iron and some mother, I assembled a test stand, figured out the settings, and adjusted the sensor in the rough. Arduin was not generally needed (although he kept her close at hand). Then he began to think about how to organize the feeding of all this (there is not very much space in the plafond). As a result, I found the smallest network charging with a USB output, removed the case, brought out 4 wires, and pulled the board into shrink.

Total we have a sensor and power supply. Now you need a relay. From the Chinese, something very time arrived under the proud name “Relay Module for Arduino”. $ 0.47 apiece, you must take :). Connect the power signal input. Does not work. I check that everything goes from the sensor as it should, comes to the relay. But it does not work. I sketched the circuit from the board (I don’t cite here, everything is simple there: a key on a transistor and an electromagnetic relay, controlled by it). It turns out that there is configured not to act on a logical unit at the input, and to close the input to the ground. Arduino relay module, damn it!

What to do? He began to dig in the box with crumbling. Found a kind of optocoupler, with the help of him and two resistors built a crutch.
image
Works.

Next - a matter of technology. Dismantling the ceiling, the placement of wires and blocks, propayka twists, shrink, all pies. The most difficult thing was to solder the last connections, when the plafond was already hanging on the wall, I was standing on the stepladder, and the tin from the soldering iron was dripping merrily on the protruding parts of the body. You can see the mounted system at KPDV.

Now about the logic of work. After turning on the light in the toilet with a standard switch, the power comes to all the units, the relay is activated and the lamp lights up. Now you can go to the privacy room and do your own thing. If you do them for a long time and do not move - the automatics will turn off the light after a configured period of time. In order for the light to catch fire again, it is enough to wave a hand or another no less massive part of the body (the PIR sensor responds to the movement of objects emitting in the IR range). When you exit, you can turn off the light normally, or forget to do it (automatic will do it for you after a while). Now the timer is set for two minutes, we will correct it after receiving feedback from users. The sensor does not work on the cat (it does not need it).

I don’t cite the circuits, everything is simple there - 5V power, a signal from the sensor to the optocoupler assembly, from there - to the input of a Chinese relay that controls the lamp.
Thanks for attention.

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


All Articles