In my previous post here, I tried to use a cheap 433 MHz transmitter to replicate the 433 MHz remote functionality but landed up hacking the remote to send the codes instead. The main issue I was facing there was that the code was not being recognized by the RF outlets.
I was finally able to resolve that issue so I just need one GPIO pin to control all my RF remote outlets now!
Troubleshooting my original issue:
I am using this receiver and transmitter - 433MHz Tx-Rx pair (set of 2)
I was using the RCSwitch library ported over to the Raspberry Pi from here
http://ninjablocks.com/blogs/how-to/7506204-adding-433-to-your-raspberry-pi
As mentioned in my previous post, I first tried using the Audacity route but I could not decode the data correctly.
Since I had an Arduino lying around as well, I downloaded the RCSwitch library for the Arduino and tried the advanced receiver demo.
The output for one switch of my remote looked like this:
Protocol: 1
I noticed that the pulse length was 207 which is different from the default length in the code. I quickly changed the pulse length in the send demo sketch on the Arduino and was able to get the RF outlet to switch on!
So I went back to my Raspberry Pi and modified the send.cpp code to look like this:
Note: I have removed the header files for a cleaner code look below. Please include them in your actual code if you want to use the code below.
I have the transmitter data pin connected to the Pi pin 11 (GPIO 17). I re-ran make in the dir and sent the previously decoded code:
sudo ./send 1398209
And it works! Good riddance to the multiple GPIO pins to replicate the remote functionality + the remote is free for use independently now.
I was finally able to resolve that issue so I just need one GPIO pin to control all my RF remote outlets now!
Troubleshooting my original issue:
I am using this receiver and transmitter - 433MHz Tx-Rx pair (set of 2)
I was using the RCSwitch library ported over to the Raspberry Pi from here
http://ninjablocks.com/blogs/how-to/7506204-adding-433-to-your-raspberry-pi
As mentioned in my previous post, I first tried using the Audacity route but I could not decode the data correctly.
Since I had an Arduino lying around as well, I downloaded the RCSwitch library for the Arduino and tried the advanced receiver demo.
The output for one switch of my remote looked like this:
Protocol: 1
Decimal:
1398209
binary: 000101010101010111000001
PulseLength: 207
I noticed that the pulse length was 207 which is different from the default length in the code. I quickly changed the pulse length in the send demo sketch on the Arduino and was able to get the RF outlet to switch on!
So I went back to my Raspberry Pi and modified the send.cpp code to look like this:
int main(int argc, char *argv[]) { /* output PIN is hardcoded for testing purposes see https://projects.drogon.net/raspberry-pi/wiringpi/pins/ for pin mapping of the raspberry pi GPIO connector */ int PIN = 0; unsigned long code = atoi(argv[1]); if (wiringPiSetup () == -1) return 1; printf("sending code[%d]\n", code); RCSwitch mySwitch = RCSwitch(); mySwitch.enableTransmit(PIN); mySwitch.setPulseLength(207); mySwitch.send(code,24); return 0; }
Note: I have removed the header files for a cleaner code look below. Please include them in your actual code if you want to use the code below.
I have the transmitter data pin connected to the Pi pin 11 (GPIO 17). I re-ran make in the dir and sent the previously decoded code:
sudo ./send 1398209
And it works! Good riddance to the multiple GPIO pins to replicate the remote functionality + the remote is free for use independently now.