[River] is a big fan of home automation. After moving into a new house, he wanted to assimilate two wirelessly controlled fan lights into his home automation system. The problem was this: although the fans were wireless, their frequency and protocol were incompatible with the home automation system.
Step one was to determine the frequency the fan’s remote used. Although public FCC records will reveal the frequency of operation, [River] thought it would be faster to use an inexpensive USB RTL-SDR with the Spektrum program to sweep the range of likely frequencies, and quickly found the fans speak 304.2 MHz.
Next was to reverse-engineer the protocol. Universal Radio Hacker is a tool designed to make deciphering unknown wireless protocols relatively painless using an RTL-SDR. [River] digitized a button press with it and immediately recognized it as simple on-off keying (OOK). With that knowledge, he digitized the radio commands from all seven buttons and was quickly able to reverse-engineer the entire protocol.
[River] wanted to use a Raspberry Pi to bring the fans into his home automation system, but the Raspberry Pi doesn’t have a 304.2 MHz radio. What it does have is user-programmable GPIO and the rpitx package, which converts a GPIO pin into a basic radio transmitter. Of course, the Pi’s GPIO pin’s aren’t long enough to efficiently transmit at 304.2 MHz, so [River] added a proper antenna, as well as a low-pass filter to clean up the transmitted signal. The rpitx package supports OOK out of the box, so [River] was quickly able get the Pi controlling his fan in no time!
If you’d like to do some more low-cost home automation, check out this approach to using a Raspberry Pi to control some bargain-bin smart plugs.
I think this is very impressive, and I like that the article explains step by step how it was done.
Kudos on adding the proper low pass filter, I hear using rpitx on the gpio pins can be rather noisy
Wow, bit-banging RF with a digital IO pin? That’s neat.
It’s a little misnomer to say it’s bit-banging. Instead, the RasPi lets you route one of its internal PLLs to one specific GPIO pin, and carefully timed small changes to the frequency … and PWM duty cycle I think … of that PLL lets you emit your choice of spectrum.
It’s still pretty magic, it’s just magic at audio frequencies instead of RF frequencies.
The jumper wires going to the BNC connector are longer than the antenna…!?
Correction: SMA connector.
https://riveducha.onfabrica.com/raspberry-pi-gpio-send-radio-signals
> (There were a couple comments that pointed out that the long wire I used in the video to connect to the low-pass filter will emit the harmonics anyways. I’ll be making the wires shorter before actually putting it into use someday…)
I’ll shut up now.
No need to shut up. HaD comments are all armchair enginerds that love to rip into people for “mistakes”. Your solution may not be elegant, but it’s functional, and more importantly you seemed to have fun with the project.
It’s been a hot minute since I saw a real hack on HaD that livs up to the sites roots. Bravo!
I agree. This is a great project and it shows just how far you can push every function of an SBC. Can not wait to see your next project.
Just wait till genetic engineering becomes cheap. Then you’ll really see some hacking.
That’s true. And theres usually a couple of people that will jump in the comments to say the whole thing could have been done with a 555 timer.
It’s not the length of wires but rather the *type* of wires that is the issue here. Coax is what is needed here as unshield loose wires become a loop antenna.
The feedbak/criticism is the warning for the brainless zombies that copy/paste what they see.
> but the Raspberry Pi doesn’t have a 304.2 MHz radio.
BTW that’s the wrong antenna for 304Mhz.
Have we become so quick to be first post for youtube to not try to do things properly here?
Criticizing others for pointing out the errors is not a good way to learn.
can you elaborate on that and provide a link to what would be a better antenna? Thx
I hate to be that guy, but like tekkieneet said, if were trying to help others learn, your technically not supposed to do that per FCC guidelines. Transmitting a dirty and loud signal can cause problems with other peoples stuff, think medical equipment or car key fobs. Licensing is “required” to transmit, but the information learned is well worth it. And it’s cheap, the knowledge and power you’re armed with after far out weighs the cost of a couple of bucks. Toss them in your hacking toolkit.
Turn one’s basement into a Faraday cage. Have fun.
Speaking from a place of little knowledge, I was under the impression that most of those FCC regulations weren’t legally applicable to broadcasts under a certain effective power. Is that the case, or it more an issue of enforcement impracticality?
Better put, the FCC has limits on output power. Part 15 covers this. Even though it’s an intentional radiator, you may be under the power limit for unintentional radiator. Of course, if you’re not selling a product…
Is River any relation to Borg Warner?
Great two part video, short and sweet, I learned a lot. I hope you don’t have to add a light sensor just to solve the light toggle problem.
hrm, this kind of sounds like that OTA TV service that was a thing in the early 2ks that got shut down. they had dime sized TV antennas for every customer connected up to personal DVRs that would stream local TV to you. I wonder how hard it would be to RX a PI into a DTV capture card using the GPIO pins. its WAY beyond what I know how to do but this looks interesting none the less.
The irony being the rtl sdr started as a digital TV tuner.
Maybe an SDR hooked to a RaspberryPi?
Locast.org – not sure if this is what you’re talking about, but they are still kicking
Neat trick. Can you control the fan via PWM?
I have a similar home automation system, but not tried integrating wireless yet. I am moving to the use of RP Picos for the hardware interfacing. I wonder whether the Pico’s PIO would be up to generating the RF?
Begin to investigate if I could port rpitx to pico…in early stage, but modulation seems way harder as there is no fractional divider on main pll…
… but the frequency at which the PIO state machine runs can be very closely defined. There’s an example program using, I think, 20000 and 20002 to generate a 2Hz pulsing light.
… in any case, my plan is to continue using the RPi as the main controller and attach multiple Picos, via i2c, as hardware interfaces (I’m currently using cards from AB Electronics for the I/O).
Wow! What a great project (and article). This is why I subscribe to Hackaday!! Very cool. Nice work.
Thank s ever so much for the post. I have been wanting to take control of my PENTAIR wireless pool controls but did not know where to start. You information about sniffing and decoding the signals and then the Rpi hack are a great help!
I think this can be done with a 555 :)
This is absolutely hilarious and impressive.
I could use this for my primitive remote controlled fan. Does the Pi Zero W have enough resources to do this? (I currently am running PiHole on it, and would like to add the fan control software to it.)
I looked at my remote and it says 434Mhz right on it. So that saves a step…
I’m sure it does. I have a few and they work hard for a living and keep on trucking. For the money they have a lot of punch.