RF 27981 receiver and RF 27980 Transmitter
nizh
Posts: 2
Hi,
I am trying to use my Parallax RF 27981 and 27980 to send and receive data using two arduino. However it didn't work. this is the sample code to try to see if they communicate and the Data cable connect to Digital pin 2 on arduino.
/*
Simple example for receiving
http://code.google.com/p/rc-switch/
*/
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
void setup() {
Serial.begin(9600);
mySwitch.enableReceive(0); // Receiver on inerrupt 0 => that is pin #2
}
void loop() {
if (mySwitch.available()) {
int value = mySwitch.getReceivedValue();
if (value == 0) {
Serial.print("Unknown encoding");
} else {
Serial.print("Received ");
Serial.print( mySwitch.getReceivedValue() );
Serial.print(" / ");
Serial.print( mySwitch.getReceivedBitlength() );
Serial.print("bit ");
Serial.print("Protocol: ");
Serial.println( mySwitch.getReceivedProtocol() );
}
mySwitch.resetAvailable();
}
}
Can someone help to start my RF to work please?
Thanks
I am trying to use my Parallax RF 27981 and 27980 to send and receive data using two arduino. However it didn't work. this is the sample code to try to see if they communicate and the Data cable connect to Digital pin 2 on arduino.
/*
Simple example for receiving
http://code.google.com/p/rc-switch/
*/
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
void setup() {
Serial.begin(9600);
mySwitch.enableReceive(0); // Receiver on inerrupt 0 => that is pin #2
}
void loop() {
if (mySwitch.available()) {
int value = mySwitch.getReceivedValue();
if (value == 0) {
Serial.print("Unknown encoding");
} else {
Serial.print("Received ");
Serial.print( mySwitch.getReceivedValue() );
Serial.print(" / ");
Serial.print( mySwitch.getReceivedBitlength() );
Serial.print("bit ");
Serial.print("Protocol: ");
Serial.println( mySwitch.getReceivedProtocol() );
}
mySwitch.resetAvailable();
}
}
Can someone help to start my RF to work please?
Thanks
Comments
Here's a direct link to the pdf file.
As you can see the forum doesn't preserve formatting unless you use code tags. The "C" icon can be used to add code tags or you can add them yourself. If you "Quote" this post, you will be able to see the code tags I used.
Here's the code you posted inside these tags.
I'm not sure if the formatting is correct or not.
It would be helpful to see the transmit code as well.
It would also be helpful if you posted a photo of how you have your radios connected to the Arduinos.
Which Arduino are you using?
I looked "RCSwitch" library and I'm confused why you're using it. It looks like the library is intended for a different radio module.
You should be able to use the Parallax modules with the normal serial commands. I'm not sure, but you might need to add a sync pulse to part of the transmitter start up code and you also might need to set the receiver's UART to receive an inverted signal.
The Parallax documentation in the pdf linked above includes example java code. This code should give you pretty good clues on how to use the module with the Arduino.
If you want to use a terminal interface with the Arduino while the Arduino is communicating with the radio, you'll probably need to use the software serial library.
From what I've read, the radios you're using transmit data almost like it would over a direct wired connection. The only differences I see are the need to invert signal on the receiver side and include a sync pulse as part of the start up.
i am new to this form and i didn't know and thanks to show me how to post the code. i am only trying to use receive part, because i am using RF remote to open and close my garage door. I am using Arduino uno R3. I will do more research on it. but i am in the beginning of this project. i will also look into UART and the link pdf.
Thanks for the help
Nish
There are all sorts of radio devices on ebay. Something like this might be a better fit for your application.