The old remote had functions for fan speed, light on/off and dimmer. The built in buttons and sliders in the cayenne dashboard allow me to use all functionality of the old remote, plus I can set the dimmer level to a specific value right away, rather than having to look at the light while I adjust it.

Furthermore, this all fits inside the old remote housing! I opted to add a barrel connector to the bottom for power, so when “docked” it works as either a physical remote or wifi-connected remote, and when unplugged the physical remote still works due to the internal 9v battery.

Schematic

Arduino Sketch

https://github.com/dpeters1/Wifi-Ceiling-Light-Fan-Remote

The arduino sketch is very simple and just deals with the inputs from the cayenne dashboard. For the light on/off and fan control, I am just controlling the HIGH/LOW behaviour of the GPIO pins. The dimmer is a bit more complicated because it is normally adjusted by long-pressing the on/off button on the remote. Cayenne does not have this functionality so instead the arduino has to keep track of the current dimmer level and calculate how long the pin should be pulled HIGH to reach the next desired brightness. As usual with the ESP8266 boards, I am using the OTA method to upload to them as it allows me to modify the code even once it's installed in the remote.

Cayenne Integration

Cayenne is a dashboard for internet-connected devices that allows for simple interaction with the device and visualization of incoming data. I am using two sliders to control fan speed and brightness, and a button to control on/off of the light. I am also able to set triggers to perform actions based on events, like time of day. This could be useful to automatically turn off the lights past a certain time at night or when I leave the house.

Build Pictures