I'm trying to control a wireless power outlet, something similar to this. So I bought a 315MHZ [transmitter](RF Link Transmitter (4800 bps - 434 MHz) in Canada Robotix mhz) and receiver. I've been able to use the receiver to obtain the codes sent out by the remote, and I've been able to program the transmitter to send out those codes, which I've been able to verify with the receiver. But the problem is the base unit just won't respond. I've captured the wave forms of both the remote and my transmitter using my sound card (using this technique), and they look identical to me. (See attached image. Top is the remote, bottom is my transmitter). I don't know what else to try. Any ideas?
Can you post the data that you captured from the remote (non waveform) ?
Using the sample program ReceiveDemo_Advanced that comes with the RCSwitch library, this is what I get:
SOURCE: REMOTE
ON
Decimal: 5588055 (24Bit) Binary: 010101010100010001010111 Tri-State: FFFFF0F0FFF1 PulseLength: 314 microseconds Protocol: 1
Raw data: 9768,228,1016,860,400,228,1020,856,404,224,1028,852,400,224,1024,856,404,220,1032,848,404,228,1024,224,1024,224,1028,852,404,224,1028,224,1028,220,1028,852,408,220,1028,852,408,220,1028,848,404,848,416,840,420,
OFF
Decimal: 5588052 (24Bit) Binary: 010101010100010001010100 Tri-State: FFFFF0F0FFF0 PulseLength: 316 microseconds Protocol: 1
Raw data: 9804,332,952,928,328,324,940,952,320,316,960,940,324,312,976,928,332,308,948,948,348,288,972,288,964,288,952,948,328,292,980,300,972,292,964,936,340,308,960,940,332,304,984,912,336,288,996,280,988,
SOURCE: ARDUINO
ON
Decimal: 5588055 (24Bit) Binary: 010101010100010001010111 Tri-State: FFFFF0F0FFF1 PulseLength: 318 microseconds Protocol: 1
Raw data: 9864,264,1020,896,392,256,1020,892,388,264,1016,884,404,248,1028,884,396,248,1028,884,404,244,1032,248,1024,252,1028,884,392,256,1028,252,1024,252,1024,884,400,248,1032,876,400,252,1028,880,400,876,404,872,412,
OFF
Decimal: 5588052 (24Bit) Binary: 010101010100010001010100 Tri-State: FFFFF0F0FFF0 PulseLength: 318 microseconds Protocol: 1
Raw data: 9860,268,1008,908,376,264,1008,904,380,272,1012,896,384,264,1016,892,384,264,1020,888,392,256,1020,260,1016,260,1016,896,392,256,1020,256,1020,260,1016,896,392,256,1020,892,388,252,1024,888,396,260,1020,260,1020,
(EDIT: I've got two Arduinos, one programmed to send, the other to receive.)
Here is the code I use to send from the Arduino:
#include <PushButton.h>
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
PushButton button = PushButton(12);
void setup() {
Serial.begin(9600);
// Transmitter is connected to Arduino Pin #10
mySwitch.enableTransmit(10);
// Optional set pulse length.
mySwitch.setPulseLength(314);
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
}
void loop() {
// check to see what's happening with the button
button.Process();
if (button.Pressed) {
digitalWrite(13, HIGH);
mySwitch.send(5588055, 24);
digitalWrite(13, LOW);
}
delay(1);
}
Thanks for posting your data. Have a look at this thread.
http://forum.arduino.cc/index.php?topic=211294.0
Your trouble might be similar. I suggest you try lowering and raising your PulseLength values by a factor of 20,
Say, try taking the value down to 200 and up to 440.
Thanks for the suggestions. I set up a loop to try all pulse widths between 50 - 1500, in increments of 2! (Getting desperate here :D) Still no joy.
You certainly have covered quite a range of PulseLengths. I have another idea. Locate your RCSwitch.cpp file and edit this section:
void RCSwitch::setProtocol(int nProtocol) {
this->nProtocol = nProtocol;
if (nProtocol == 1){
// this->setPulseLength(350);
this->setPulseLength(315); // try this
}
else if (nProtocol == 2) {
this->setPulseLength(650);
}
else if (nProtocol == 3) {
this->setPulseLength(100);
}
}
This will make the Protocol 1 PulseLength a value of 315 . Then, in the setup, DO NOTset a PulseLength.
Set a Protocol instead. It will be Protocol 1:
mySwitch.setProtocol(1);
Thanks again, but that didn't work either. I've given up on that plan and have resorted to Plan B, which is to hack into the remote and control the buttons with Arduino and some optocouplers. Thankfully I managed to not wreck the remote, and it's working great!
That method will work just as well. I just tried a method of detecting the "sound to ear" that is better than using my radio receiver. I had read where someone else did this. Take a audio stereo/mono patch cord and plug it into your pc's mic or line in. In Windows 7, set up the "recording" tab device to "Listen to this device". Connect either the left or right pin side of the stereo cord to the data pin of your 315mhz or 433mhz receiver. When the sensor is triggered, you will here the pulses quite clearly. Then you can compare the difference between the sound generated from the working remote control and the sound being generated from the transmitter and your sketch. Then you can tweak your parameters. Just typing all this info in case someone else finds this post. Best of luck with the project.
