In this Instructable, I'll walk you through the very simple process to automate your ceiling fan so you can control it with voice commands using an Alexa device. You can use these instructions to control other electronic devices (lights, fan, TV, etc). For my example, I will be using an Amazon Dot, an existing ceiling fan, and a $7.25 Sonoff Wifi Switch.
Step 1: Voice Commands
Our ceiling fan had wireless built in but sometimes I couldn't find the remote when I wanted to turn on or off the fan (or I was too lazy to go grab it). Now I can control this fan just by asking Alexa.
Step 2: Wiring the Sonoff
First, remove the canopy cover from the top of the ceiling fan to expose the electrical wiring. The fan I have has a wireless control (blue box) which was wired in-line between the electrical feed coming out of the ceiling and the fan motor. I looked at the wiring diagram on this wireless control to see which wires I needed to use.
The white (neutral) wire came down from the ceiling and tied directly together with the white wire from the fan's motor and the white wire from the wireless controller. All three were twisted together with a wire nut. I cut the white wire going from this wire nut to the motor. Then I stripped the wires ends and placed the white wire from the nut side into the input of the Sonoff and the white wire from the motor side in the output of the Sonoff.
For the "hot" feed, I could see the yellow wire came out of the wireless control and was tied to the black coming out of the fan motor. I just removed this wire nut and placed the Sonoff in-line between the yellow (input side) and black (output side) wires.
Now the Sonoff Wifi switch was wired in but not getting any power since the fan was turned off. I switched the fan on and the green light of the Sonoff came on....good sign.
Step 3: Program the Sonoff
Now I had to program the Sonoff and add this to Alexa.
I downloaded the eWeLink Sonoff app from the app store and added my device. I first had to set up this app and add my wifi information. Next, I push the + symbol to add a new device. Hold down the link button on the Sonoff and pair the device.
Once this was paired I went into the Alexa app on my phone, then under Skills I searched for the eWeLink skill and enabled this skill. Now in the Alexa app, I opened 'Smart Home' and added a new device naming it "Ceiling Fan".
That's it! Drum roll.....
Step 4: Test and Button Up
Now it was just a matter of testing and I was done. I can turn this on or off using the Device in the Alexa app. To use the voice commands I can just say "Alexa, turn on ceiling fan" or "Alexa, turn off ceiling fan".
The hardest part of the whole project was stuffing everything back into the ceiling and getting the fan's canopy cover back up there. It was very tight with all the wiring and these two controls boxes but I managed (after some colorful language) to get it all back together.
I do have to leave the fan in the "ON" position at all times and this switch just controls when the motor is powered. If I want to speed up or slow down the fan I still have to use the remote. Also, if I was to use the light on the fan, it is controlled only through the remote. I could have added a second Sonoff to the light but there was no room. I could have also wired the fan motor and light in together so they both come on at once but.....that's just crazy.
Bottom line, it took about one hour and cost $7.25 to enable the voice control and I couldn't be happier so I wanted to share it with you all. Please let me know if you use this and what projects you use it on.