I bought these a bunch 433mhz Receiver and Transmitter from ebay and setup an arduino Uno with the transmitter and my raspberry pi .
I was able to hookup the transmitter to the Arduino and the Receiver to the PI easily with information available online. I am able to send signals and receive them on my raspberry but the issue I am having is for every value sent once from my arduino, the raspberry seems to be detecting multiple values. I am not sure why this is happening. I have replaced 5 different transmitters and receivers, so I am not sure if it is a hardware issue.
I would appreciate some help/guidance with this.
I am using RFSniffer to detect the signals on my PI and this is what I see.
Received 1111
Received 1111
Received 5592575
Received 5592575
Received 5592575
Received 5592575
Received 1111
Received 1111
Received 1111
Received 5592575
Received 5592575
Received 5592575
Received 5592575
This the source running on the Arduino
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
int led = 13;
void setup() {
Serial.begin(9600);
mySwitch.enableTransmit(10);
}
void loop()
//Send a Test value
mySwitch.send(1111,24);
delay(1000);
//send the fob value
mySwitch.send(5592575,24);
delay(5000);
}
Also attaching the picture of the rf components, which seem to be very commonly used by a lot of projects online.
The RCswitch library is used for the simple remote controls. They use some kind of 3-state code. And it is repeated 10 to 20 times to increase the chance that it is received. Every receiver can handle those multiple transmissions.
The first detected transmission is often the second one, since the trailer of the first is needed to get into sync.
It is set with setRepeatTransmit(10); in RCSwitch.cpp. So the default is 10 times.
Does the Raspberry Pi have some timing during receiving ? I don't know how long the total of 10 transmissions is, perhaps half a second.
Thank you so much Peter_n. I was able reduce the repeats by adding the two lines before my send. I will give the radio head library a try. Here is my code, in case anyoneelse is following , its not complete by any means, it is just a start to my next step.
void setup() {
Serial.begin(9600);
mySwitch.enableTransmit(10);
mySwitch.setPulseLength(183); //New Line
mySwitch.setRepeatTransmit(4); //Fix for multiple repeats
}
Wilutsi, thats true, but I will be replacing the receiving end with a rf wireless relay module (img attached) once I was able to solve this problem.
I intend to use the relay module with an easy project like a garage opener at first but eventually I would like to use the same principal for controlling additional devices without having an arduino on each end unless I can reprogram the chip on these relays, which I dont know how to do as yet. I am learning as I go, by searching online and with help from good folks like yourself.
I bought these rf transmitters and couple of these relays but I didnt know how to build them to work together so I ended up buying a 3rd relay with rf and the keyfob.