Creating a Smart Device to control a legacy ceiling fan from an Amazon Echo Dot. (Alexa)

I finally completed my old-school ceiling fan remote upgrade.  This mishmash of components allows me to operate my Hampton Bay ceiling fan and light through my Amazon Echo Dot.

By the way, all of this cost:

ESP8266 – $2.59
L78L33 – $0.18
Relay Board – $5.99
Old Remote & Old USB cable $0.00

For a total of only $8.76.

These remotes operate on an RF frequency that is a pain to control with an arduino even with a special RF board.  It operates just outside of the frequency of the common and cheap ones.  I did not want to spend too much money on this project so I opted to hard wire some female jumper cables so I can easily disconnect them.  I soldered these leads to the five buttons and ground.

 

The remote is connected to the relays on this sainsmart 5v relay board.

The relay board is powered by a 5v lead from an old USB cable and ground.  This provides the current to flip the relays.  The other three wires (white, purple, blue) are wired into three digital GPIO pins on the ESP8266 chip.

The ESP8266 is programmed as an Arduino and boots up as a web server with a tiny REST API built in to allow turning on and off the GPIO’s.  This little guy is powered via a 3v3 lead.  To get 3v3 I used an STI L78L33 voltage regulator attached to the USB power cord.  This gives me a perfect 3.3v to power the ESP8266.  The relay board expects the GPIO’s to go low (go to ground) in order to activate the switch so I have these GPIO’s normally high until the REST API is called and then the appropriate GPIO is pulled low for about 250ms.

Bridging the REST API to Alexa

In order to control these components from the Amazon Echo Dot I wrote a tiny little NodeJS module that allows me to spoof a Belkin WeMo device.  The module provides discovery and when a command is spoken to Alexa I simply make a GET request to this ESP8266 web server and request the correct GPIO to be toggled.

Check out the fauxmojs node module here.

The ESP8266 (Arduino) Code

Below is the code I used for the ESP8266.  (I will put this code on github soon.)

 

Leave a Reply

Your email address will not be published. Required fields are marked *