After some playing with different types of the switches which controlled lights through my Home Automation System I figured out best implementation of smart switch and in this post I will show you what I made.
First of all we are using wall switches to turn the light in our rooms and all the time we have to push some buttons, from the other side simple Wi-Fi switches do not have buttons like Sonoff and not really convenient to turn the light using cell phone all the time.
I decided to make something new, really convenient, when your phone in your pocket and hands are free. After some prototyping and using different types of solutions I made truly smart switch.
So, my components for smart switch are PIR sensor (device which can catch the motion), luminosity sensor, relay and ESP8266 (ESP12) module. My PIR sensor detects a motion and sends event to the server if it occurred, at the same time IoT device also measures luminosity in place, if it dark server sends command to device to turn on the light and after some period of time when no more motion captured server will turn off lights.
I’ve replaced regular wall switches in my home and also put it in my garden canopy. Now when I’m opening a door and get in into my corridor device is capturing the motion and turning on the light if it night time. Then I’m following to the main room or kitchen and system is “following” with me and highlights my way. After 3 minutes of inactivity system will turn off the lights in area or if new motion event will be captured it will add another 3 minutes to turn-off timer.
Here is my current code of this thing, but I will continue my development because I see a couple of areas for improvement.
I’m making life convenient!