Hello world! Smart homes are coming and nothing short of an apocalypse can stop them. And no, we will not DIY an apocalypse, instead we will jump on the band wagon and build a smart switch to call our own. Read on to jump into the build!
- Following are the components you’ll need (The links given are affiliate ones, do consider buying from them if it doesn’t cost you any extra):
- ESP01: https://amzn.to/2ZTqusE
- 4 channel relay module: https://amzn.to/35WcemW
- 5V ac to dc converter: https://amzn.to/2Hl2Uig
- 5V to 3.3v step down power supply: https://amzn.to/35TFnPz
- Proto board: https://amzn.to/33PsNOy
- 10k resistor x 2
- Female header strip: https://amzn.to/3cfIPFw
- 1000uF capacitor: https://amzn.to/3cky0Sl
- Metal Oxide Varistor 400V (Optional)
- Jumper wires: https://amzn.to/32OCmhB
- Twisted 18AWG wires for AC
- A box to hold em all

Step 2: Prepare the interface board by referring to the connection diagram given below.
Connection diagram
Step 3: Place the relay inside the box and wire up the output of relay with the twisted wires as shown below. Attach MOV to across the output of whichever relay you will use to control an inductive load like a fan or CFLs.

Step 4: Download the code from https://github.com/mijazm/ESP01WifiSwitch and upload it to the ESP01 module. Check out my previous post if you need help.

Step 5: Connect the interface board to the relay as shown in the connection diagram below.
Step 6 : Power up the project and setup your echo device by saying “Alexa, discover devices”. This will take some time, once its completed you will be able to see new devices on your alexa app.
Step 7: Try the commands! Say “Alexa, turn on fan” or whatever device names you used in the code.

Step 8: Connect it your switch board referring to the images given below.
I hope you enjoyed this post, see you in the next one!