Periodically, reading
articles on smart home, I come across a description of the inconvenience brought by the automation of lighting in the premises.
I also ordered a motion sensor, temperature and humidity. Hanged in the bathroom and made a cool automation: the light in the toilet automatically turns off after 15 minutes, if you forget to turn it off, and the light in the bathroom turns on at the entrance, according to the motion sensor, and turns off after 15 minutes. Everything is cool, except that it is impossible to live with it. It turned out that 15 minutes in the toilet is actually not enough, especially if Wi-Fi is well caught there. And he is caught well. The increase in the waiting period did not help, so I have turned off this automation and ordered another motion sensor.
Without pretending to exclusivity (and even suspecting that everything that has been said is obvious), I’ll tell you about my own implementation of this task.
1. Pyroelectric infrared motion sensor
The sensor, I think, is familiar to everyone, it does not make sense to talk about the features. I have it hidden under ceramic tiles, only Fresnel's lens comes out.
This sensor can be used both by itself and with the smart home controller.
Work algorithm:
')
- the inclusion of lighting for a certain period of time when capturing movement;
- turning off the lights in the absence of movement for a long time.
Minuses:
- households will have to periodically move in order not to turn off the light;
- if the sensor is fenced off by something (for example, a shower curtain), it will not work and you will have to look out of the barrier and wave your hand.
2. Magnetic door opener sensor
Classic reed switch. We hang on the door and can use.
Use options:
- or simply turning on the lights for a certain period of time when opening / closing the door,
- or (as my son naively suggested) to consider every odd opening of the door as the entrance of a person to the bathroom, and every even one - as an exit from it.
Minuses:
- in the first variant, you will periodically sit in the dark or vice versa an over-expenditure of electricity will occur;
- in the second variant, it is necessary to open and close the door at least once (without entering) and the algorithm will be lost.
3. Both sensors together
So, let's try to combine the advantages of both sensors. We will monitor their sensors and memorize the response time.
In addition, let us single out for ourselves three modes of system operation:
- "Man in the room exactly", in which the lighting is on for an unlimited time;
- “A person is possible in a room”, in which the lighting is also on, but for a short time;
- “There’s probably no person in the room” in which the lights go out.
The algorithm works as follows:
- when opening / closing the door or moving, we switch to the “Man in the room” mode
- if after that nothing happens for 15 seconds, then we switch to the mode “Man apparently is not in the room”
- if after closing the door a motion sensor has been activated, then we switch to the “Man exactly in the room” mode
That's all! The logic is very simple - a person entering the bathroom and closing the door behind him will precisely fall under the motion sensor for at least a couple of seconds. After that, he can hide behind a curtain or sit still - it does not matter, the system has already counted it, the light will be on until the door opens again (or rather, another 15 seconds after that and the end of any movement).