Smart Wi-Fi Switch
This is something that has happened to me very often, and I find it very annoying when I come and lay down on my bed and then realize that I forgot to turn off the light, and the light switch is on the other side of the room, and I have to get up and turn off the lights. So I decided I would build a Smart Wi-Fi Switch so that I could ask a voice assistant like Google Assistant to turn off the lights. This way, I won't have to get out of bed again to turn off the lights. This is also useful when I am reading a book before going to bed because now I don't have to get up to turn off the lights.
Supplies
The components needed to make this project are:
IR Sensor Wiring
Connect the IR Sensor as the following:
ESP8266 >> IR Sensor
GND >> GND
3V >> VCC
D6 >> OUT
Servo Motor Wiring
Connect the Servo Motor as the following:
ESP8266 >> Servo Motor
GND >> GND
3V >> VCC
D5 >> Signal
Setting Up Adafruit (Step 1)
For the servo to turn the lights on and off over Wi-Fi you will have to set up an online service that the ESP8266 can connect to. A free online server I am using is Adafruit.IO.
Setting Up Adafruit (Step 2)
Setting Up Adafruit (Step 3)
Setting Up Adafruit (Step 4)
Setting Up Adafruit (Step 5)
Setting Up Adafruit (Step 6)
Setting Up Adafruit (Step 7)
Uploading the Code
You will have to make some changes to the code for it to work properly. Start off by entering your network SSID, and password. Go back to Adafruit and click on "My Key." Copy your username and authentication key onto the sketch. Make sure you have the correct board and processor selected before you upload the sketch.
For more information about this, please visit my Patreon: https://www.patreon.com/acedinventor
Testing Online Server
If everything is working properly you should be able to turn the switch on and off on your phone and the servo should rotate up and down.
Setting Up Google Assistant (Step 1)
Now if everything is working properly you can head over to IFTTT, to connect Adafruit to Google Assistant. This way you don't have to touch your phone to turn the lights on or off.
Setting Up Google Assistant (Step 2)
Setting Up Google Assistant (Step 3)
Setting Up Google Assistant (Step 4)
Setting Up Google Assistant (Step 5)
Setting Up Google Assistant (Step 6)
Setting Up Google Assistant (Step 7)
Setting Up Google Assistant (Step 8)
Setting Up Google Assistant (Step 9)
Setting Up Google Assistant (Step 10)
Building the Housing
The last step in this project is to make the housing and mount it onto the light switch.
Testing Complete Project
To test the project start off by signing in to Google Assistant with the account you used for IFTTT. Now you can ask Google Assistant to turn the lights on or off for you. The lights will be able to turn on or off from anywhere in the world as long as the ESP8266 and your phone has connection to the internet.