Setting Up the Pi for RF

Following Tim’s guide, Piddler’s guide, and Sam’s guide I was able to get the RF Signals from the Remotes. During this phase, I faced a few challenges and have learn something about electronics along the way. Here are some of my mistakes and lessons I have learn since my adventure began.

Lessons

The low cost RF Receivers and Transmitters from Amazon are not variable.

When I purchased my first set of receivers and transmitters, I read the description very carefully before I picked the one I want. According to my research, there are two primary types of RF Outlets available on the market, those that function on a frequency of 433 MHz and those that function on 315 MHz. Tim, Piddler, and Sam all seems to have used the 433 MHz version of the outlets. In fact, all three of them suggested the same brand of RF outlets. However as the ones I got at home were purchased from Home Depot, I have to improvise. Via numerous researches, I’ve found that the ones I have have a sender model of TR-011 as the remote and RC-015 as the outlet. These function on the 315 MHz frequency instead.

The amazon seller who I purchased my XY-MK-5V and XY-FST from indicates their product have a working frequency of 315 MHz to 433 MHz. To a trained eye or someone who majored in electronics, this may have been an instant alarm. To a person whose training in electronic was p-gates, n-gates, etc…. I just took the description as-is and placed the order.

Once I hooked everything up just like how the three guides have shown, I was not getting a signal when I press the remote. For the a short period of time, I was banging my head on the hardware and was wondering if I wired things wrong. Finally, after exhausting all other sources, as there aren’t that many people who had this setup for 315 MHz, I reached out to the seller via Amazon. I asked the seller if there is a method to tune the modules into 315MHz as it doesn’t seem to be picking up signals at the frequency. They indicate that was a mistake and quickly corrected the mistake on their webpage. The seller also send me the 315 MHz version of the receiver and transmitter free of charge.

Radio Frequency is nothing more than a communication format but there’s more.

Using Tim’s RFSniffer, I was able to pick up the code from remotes once I replaced the newly delivered 315 MHz receiver and Transmitter. I was able to obtain the code and immediately attempt to mimic the signal to the power outlets using Tim’s codesend program. It did not work. I also have a copy of the 433Utilities on my Pi installed and checked to see if that may have a different code reading. That didn’t have any effects either.

This led me to start to question what could be different between what I am sending and what the remote was sending. With C++ being one of the languages I know, I open up Tim’s source code and took a very deep dive into the RFSniffer and RCSwitch codes. Reading the available getter methods in the RCSwitch, I noticed RFSniffer was returning only two of the four retrievables, the code and the delay. I simply added a few more printfs to display the Bit Length and the Protocol and very quickly, I found a difference. The remote had a bit length of 15 while codesend was using a bit length of 24. The protocol used by the remote is 2 and codesend was defaulted to 1.

I simply open up codesend and alter the source so I can add these differences via the arguments upon launch. The received signals now matches perfectly but the outlet still wouldn’t respond, that’s a different lesson by itself.

Follow the guide as-is before venturing out will save you from insanity.

As mentioned above, I was able to match the signals from the transmitter perfectly to the remote, yet the power outlets were not reacting to my signals. This kind of consumed me for a few days as I attempted different methods and read deeper into the RCSwitch code, both from Tim’s copy (which is easier, IMO) and the original RCSwitch copy (which accounted for multiple boards and have a lot of #if in it). At one point, I was close to reconstructing the signal via binary to see if that would make a difference but reading into the initialisation handshake nearly put me to sleep. What I did next is a little me insane but for my sanity’s sake, it was a needed step. I purchased the Etekcity 5 pack outlets from Amazon.

Since I still have functioning 433 MHz transmitters and receivers, I figured might as well follow the guide exactly as they were written to ensure it isn’t my setup or environment that is interfering with the signals. Once I plug the RF outlets in and repeated the steps with the 433 MHz transmitters and receivers, it just worked. Sanity restored. Now all that I have to figure out is why isn’t the 315 MHz ones working, but worst case scenario, I can always switch everything out and limit myself to the 433 MHz band.

Never Give up and don’t trust the digitally converted analogue signal numbers.

After verifying my setup functions, I started further ruling out things that could have prevented the 315MHz outlets from reacting to the Pi. With the extra knowledge about how the RF outlets actually work now, I came across this discussion on the Arduino forum. User sp_mike took a radio receiver and listen on the 315 MHz frequency and realised on screen that it is somewhere closer to 800ms delay as opposed to the receiver reported 1090-1190 ms delay. After reading this, I quickly fired up my Pi and switch the delay to 800 on my inputs to codesend and viola! The power outlet responded to the Pi instead of the remote!

back to planning

Well, now that I have the outlet being able to be controlled by the Pi, I am planning my programs. However, being the picky anus that I am, let’s begin with cleaning up Tim’s code!

One thought on “Setting Up the Pi for RF

Leave a Reply

Your email address will not be published. Required fields are marked *