River's Educational Channel Controls an RF Fan and Light By "Abusing" the Raspberry Pi's GPIO Pins

Using the rpitx software, River's Raspberry Pi now controls his home's lights and fans — and with only a low-pass filter and antenna.

River's Educational Channel on YouTube is playing host to a low-cost home automation project which ties a Raspberry Pi into an RF-controlled fan — by "abusing" the general-purpose input/output (GPIO) pins to transmit a signal.

After having moved into a new house, River found an interesting feature: Pre-installed ceiling fan and lighting systems which offered remote control from a small handheld controller. Rather than rely on the controller, though, River turned to a low-cost RTL-compatible software defined radio (SDR) dongle and the Spektrum and Universal Radio Hacker software to reverse-engineer the remote's signals — then set about building his own network-connected transmitter from a Raspberry Pi.

Having reverse-engineered a remote, River turns to a Raspberry Pi to control his home's lights and fans. (📹: River's Educational Channel)

"This isn't just plugging in some expensive radio into the Pi," River explains. "The Pi itself, believe it or not, can transmit radio signals on a huge range of frequencies. Obviously it has a radio for Wi-Fi and Bluetooth, but that's way off from the frequency I need to transmit.

"What it also has that most computers don't have are GPIO pins that you can easily control. If we can toggle one of those GPIO pins back and forth between 0 and 1 we generate electromagnetic radiation in the form of radio waves. For your average hacker though, it really doesn't take too much theory — just download the tool and run it!"

The tool in question is rpitx, originally developed by radio amateur Evariste Courjaud for FM transmission. While rpitx technically operates without any additional hardware, it works best with a length of wire tuned to the right frequency on the target GPIO pin — and River added a low-pass filter to prevent any higher-frequency harmonics from being broadcast.

"At this point it's just a proof of concept," River admits. "In the future I'll integrate this into Home Assistant so that these controls are centralized and integrated with all the other smart home hardware in my house. If you're using other systems like Alexa I'm sure there's a way to set up custom actions as well. They just need to tell your Pi to run the right command."

The video is now available on River's Educational Channel.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles