Skip to content

Simple program using rpitx to control ceiling fans

Notifications You must be signed in to change notification settings

Aechs/rpitx-fancontrol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

rpitx-fancontrol

Simple program using rpitx to control ceiling fans

This is a Python script using rpitx to control Harbor Breeze fans (or other simple rf fans) with a Raspberry Pi.

In order to use this with your own fan, you need to know the fan ID and frequency which can be obtained using a sdr/tv-tuner. Your Raspberry Pi needs* a bandpass filter on pin 7 or GPIO4. Read here for more info

The Fan

16863098 512

This fan can be found for cheap at local home improvement stores and are common in some rental units (link). The fan comes with hardware to attach to a ceiling junction box, a reciever, and a small remote to control the fan.

The Remote has 5 buttons for controling the light and fan speed. This remote uses 304.2MHz on/off keying (or ook) to control the fan.

Signal Decoding

In order to control the fan, you need to know the ID of the fan and the control code used for each button the remote has. Using this software, the fan remote, and a SDR radio, The signal can be decoded to simple binary data once you know the right frequency. For this fan it is 304.2MHz

Screenshot from 2022-11-07 14-44-56

This remote uses a carrier signal of '10_' where '_' is 1 bit of data. Removing the carrier signal produces this below

Screenshot from 2022-11-07 13-40-25

After Analyzing the decoded signal, The first 16 bits correspond to the fan ID or which fan the remote is talking to (marked in green above). The last 8 Bits are the Control Code or which button on the remote got pressed (marked in yellow)

So, we need to get the Pi to send this signal in order to control the fan.

Programming

rpitx has a module called sendook that allows us to send on/off keyed messages which we will use to control the fan. sendook also requires us to specfiy a few extra details such as timing between on/off keys, pause duration, and # of repeats.

Install rpitx

sudo apt-get install git
git clone https://github.com/F5OEO/rpitx
cd rpitx
./install.sh
sudo reboot

Download the program

wget 'https://raw.githubusercontent.com/Aechs/rpitx-fancontrol/main/parse_tx.py'

Run the program This example would set a low fan speed on the "K" fan

python parse_tx.py K 1

About

Simple program using rpitx to control ceiling fans

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages