One last college try for RF modules

I got this RF module (http://www.sparkfun.com/commerce/product_info.php?products_id=7813) last week.

I have the transmitter sitting on a (ladyada) protoshield on top of an Diecimila. Transmitter GND and VCC are connected to GND and +5, DATA is connected to digital pin 3. I have the optional antenna installed, 30cm. Here’s the transmit code:

#include <SoftwareSerial.h>

byte data = 16;
int rxPin = 2;
int txPin = 3;

SoftwareSerial rfSerial = SoftwareSerial(rxPin,txPin);

void setup() {
  pinMode(rxPin,INPUT);
  pinMode(txPin,OUTPUT);
  rfSerial.begin(2400); 
}

void loop() {
  rfSerial.print(data,BYTE);
  delay(30);
}

The receiver is attached to an Arduino NG. 3 GNDs (why so many, btw?) are attached to GND and two +5 (?) are hooked up right. The right DATA pin is connected to digital pin 2. Another 30cm antenna here. USB cable plugged in. Here’s the receive code:

#include <SoftwareSerial.h>

byte data = 0;
int rxPin = 2;
int txPin = 3;

SoftwareSerial rfSerial = SoftwareSerial(rxPin,txPin);

void setup() {
  pinMode(rxPin,INPUT);
  pinMode(txPin,OUTPUT);
  rfSerial.begin(2400);

  Serial.begin(2400);
}

void loop() {
  data = rfSerial.read();
  Serial.println(data,DEC);
}

Both Arduinos are running from the same power bus, which is a regulated 5V. The units are closer than 2 inches from each other. I’m running 0011 and remembering to send with the right board for each chosen in the menu, if that makes any difference.

The output I expect is:

16
16
16
16
16
16
16

Or roughly similar. The output I get is:

0
0
136
16
0
16
16
16
32
255
75
65
195
2
130
0
4
4
0
8
8
8
16
0
17

Notice how non-random this is. What it looks like to me is a synchronization problem, with a bunch of 1 or 2 bit errors thrown in to make it interesting. Or maybe it is random, but I only get 1 or 2 bits turned on at a time in each value. In any case, I have explored many different hardware and software setups, none of which worked (to varying degrees). Possibly I just have a bad RF module?

If this just won’t work (either because the module is bad or because I’m an idiot or whatever) is there a wireless solution that is a little less…raw while not being as expensive as XBee? ($50 for a single pair?)

How are you syncronizing the transmit and receive so the tx does not start until the rx is ready? As I see the code the tx just sends and the rx just receives so how do you know the complete byte was received?

How WOULD you synchronize something like this, isn’t it one-way comm?

2-4 bits that tell it to get ready?

Well, here is what was on the sparkfun site. It’s a little more lowlevel than the Arduino code would need to be but it will give you an idea.

Like the previous poster, I don’t see how this could work. If the SYNC byte isn’t received correctly, how does the receiver fix itself? This is plain serial data, I can’t send just 2 or 4 bits at a time.

Or is the idea that you send 4 bytes with the data in the middle and then the receiver selects 8 bits from the middle so that the edges line up…?

I can do something like that if someone says it is indeed necessary. However, the tutorial (http://www.sparkfun.com/datasheets/RF/KLP_Walkthrough.pdf, page 3) doesn’t show anything so complex. Neither do any other sites that talk about these units.

In fact, the one you link to says this: “…receiver likes adjust its input gain depending on input signal level. First byte tunes receiver to accept normal signal after then address byte, data and checksum can be read more reliably.” That doesn’t sound like a syncing so much as a “there’s some data coming, so wake up!” byte.

/*
* Simple Receiver Code
* (TX out of Arduino is Digital Pin 1)
* (RX into Arduino is Digital Pin 0)
*/
int incomingByte = 0;
void setup(){
//2400 baud for the 434 model
Serial.begin(2400);
}
void loop(){
// read in values, debug to computer
if (Serial.available() > 0) {
incomingByte = Serial.read();
Serial.println(incomingByte, DEC);
}
incomingByte = 0;
}

Try this code from SparkFun (modify pins as needed)

Yep, that code is from here: http://www.sparkfun.com/datasheets/RF/KLP_Walkthrough.pdf

Tried it. Doesn’t work.

However, I’ve already come up with a cheap alternative: Project Potpourri: Things That Don't Work vs Things That Do

I am looking to add something similar to a project I am working on. Any luck since your last post? Have you done something more complex like this:

Also - (for MY reference) if you simple set the tranmist line to +5 does the the receive line go to +5? In my particular application all I am interested in is if the line is high or low. That’s it - I am using it like a remote switch… (I have not gotten my tx433/rx433 in yet).

Um… sorry - I didn’t reallize the link that was included in my last post was already posted - so nevermind :frowning: