Smart Wi-Fi Switch

by Aced Inventor in Circuits > Arduino

242 Views, 0 Favorites, 0 Comments

Smart Wi-Fi Switch

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

Components.png

The components needed to make this project are:

IR Sensor Wiring

Ir wiring.png

Connect the IR Sensor as the following:

ESP8266 >> IR Sensor

GND >> GND

3V >> VCC

D6 >> OUT

Servo Motor Wiring

Servo Wiring.png

Connect the Servo Motor as the following:

ESP8266 >> Servo Motor

GND >> GND

3V >> VCC

D5 >> Signal

Setting Up Adafruit (Step 1)

adafruit 1.png

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)

adafruit 2.png

Setting Up Adafruit (Step 3)

adafruit 3.png

Setting Up Adafruit (Step 4)

adafruit 4.png

Setting Up Adafruit (Step 5)

adafruit 5.png

Setting Up Adafruit (Step 6)

adafruit 6.png

Setting Up Adafruit (Step 7)

adafruit 7.png

Uploading the Code

Coding.png
my key.png

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

My Video Gif.gif

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)

google 1.png

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)

google 2.png

Setting Up Google Assistant (Step 3)

google 3.png

Setting Up Google Assistant (Step 4)

google 4.png

Setting Up Google Assistant (Step 5)

google 5.png

Setting Up Google Assistant (Step 6)

google 6.png

Setting Up Google Assistant (Step 7)

google 7.png

Setting Up Google Assistant (Step 8)

google 8.png

Setting Up Google Assistant (Step 9)

google 9.png

Setting Up Google Assistant (Step 10)

google 10.png

Building the Housing

Building the Housing.png

The last step in this project is to make the housing and mount it onto the light switch.

Testing Complete Project

My Video Gif (2).gif

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.