Light, Fan, and Dimmer Control via ESP8266 and Cayenne

About This Project

The previous owner of my house installed remote controlled ceiling lights in all the bedrooms. This was really cool for a couple weeks, but now I’m realizing that it can be really annoying when I misplace the remote. Each room has a separate remote that only works for that room. Extra remotes are both expensive and hard to come by. Making my own rf remote is impractical as they run in the 400mhz range and there is generally very little documentation about the radio codes for this fan model.

To circumvent this, I disassembled one remote and soldered transistors directly to the physical button contacts. An esp8266 is used to control the transistors, allowing me to switch them using the cayenne dashboard or via other wifi connected microcontrollers.

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.

What’s Connected

5x 2N2222 Transistor
5x 2k ohm resistor
ESP8266 microcontroller
3.3v switching regulator
Female Barrel connector → 9v DC wall power
9V alkaline battery

Arduino Sketch

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

Simple but it works well. Finally a project where I can use the right widget logo!

Photos of the Project

4 Likes

I love that you managed to make it fit in the original remote’s housing. That’s probably the most difficult thing for me, I’m fine wiring stuff up and interacting with it in Cayenne, but all of my projects have the look of a Electronics 101 freshman project, with wires and breadboards everywhere. I Need to work on those soldering skills… :slight_smile:

Kewl concept- nice interfacing.
Deud, -look into the medical profession
-neurosurgury pays well! :wink:

dont’cha just love these new ESP modules!

looks like a top prize candidate to me.

Thanks guys!

@HighTech Don’t know if I could deal with the whole “cutting people’s heads open”. Think I’ll stick to soldering for now haha.

1 Like

I have recently uploaded some of the libs I wrote for messing with the 433Mhz remote control stuff (blinds and garage) I have. This allows you to record the codes, and replay them easily. So far it’s been working great. See here: GitHub - sillyfrog/RFreplayESP: Record and replay RF433Mhz signals on an ESP8266, using the Arduino IDE. - I have put a page on the wiki of what I’m actually using as well.

The process is crude, and often will also record noise in the signal, but practically I have had no issue (as the reply will include the correct signal), and I have recordings for my blinds up, down and stop for each of them (so 6 files in total), and I can just call what ever one I want at will. No messing with remotes once programmed :slight_smile:

Plus if you get the right boards, they just connect using 3 wires (no extra components), so I have my WeMos board and the transmitter. I just connect it to a USB port power supply and away I go - so far so good!

Interesting, if I have some time this weekend I’ll mess around with that library. I’ve had bad luck in the past trying to use proprietary rf codes but maybe you’ve solved it by recording the original remote signal.