Controlling 303MHZ / 433MHz ceiling fans with CC1101 and MQTT

I recently installed a new ceiling fan and was dismayed to learn its RF remote used 303 MHz commands rather than 433 MHz like the rest of my fans. This meant that I couldn’t use a Sonoff RF Bridge to integrate it into Home Assistant.

I went deep down a rabbit hole of DIY 303 MHz RF control using the CC1101 RF transceiver module, but nothing I found was wholly accurate or fit my entire use case.

Specifically, it looks like there are at least two different versions of this module floating around (an older 10 pin, and a newer 8 pin stamped “v2”) and most of the sample code I found was for the older version and was missing a key statement.

I finally got everything working the way I wanted and I packaged it up into an Arduino sketch on Github.

This project contains an accurate pinout for the module I used and can be used to capture RF commands as well as send them. I also included the YAML for an MQTT Fan element in Home Assistant (which was a pain to get right).

Hopefully the next poor schmuck going down this rabbit hole will find this post and have an easier starting point than I did…

1 Like

Just wanted to give a huge thank you for your work on this! I have been trying to figure out a solution for controlling my 303mhz fans for awhile and am beyond excited to give this a try. I ordered the antenna and will report back once I have everything put together.

Cheers and thanks again :beers:

1 Like

Nice!

I went down this rabbit hole about a year ago, too. I ended up using OpenMQTTGateway with the same CC1101 RF transceiver. I also added a contact sensor to a light switch for a physical toggle for the light.

(Your documentation is far more complete than my notes.)

1 Like

I discovered that my fan remote sends 3 burst transmissions, about 76ms apart, every time a button is pressed.

This meant that every physical button press triggered 3 RF receptions, which in turn triggered 3 MQTT state updates. I documented this here: https://www.reddit.com/r/esp32/comments/1jvwojd/cc1101_with_rcswitch_receives_3_signals_for_each/

I fixed it by adding a short delay before I reset the state of the cc1101 module, and I just pushed that change to Github. Make sure you get latest.

There are some good comments in that thread about a more robust debouncing method, and if you intend to support multiple users or fans you might consider making some changes. (My delay basically renders the cc1101 deaf and dumb for a brief moment, which could cause it to miss incoming signals)

Lastly, take care if you try and package your solution into a project box of some kind. I 3D printed a case (LMK if you want the .stl) and hand-crimped some short jumper wires, but some of my connections kept coming loose when I shoved everything in there. This led to some frustrating debugging where everything would work great when out of the box, but lots of missed signals when in the box. In hindsight, I probably should have just soldered the cc1101 to the ESP32. Might have been less brittle.

In any case, let me know how it goes. I hope it works for you!