Serial Problem Redux! RF Modules.

Earlier I was faffing on with serial comms between two arduinos. Thanks to Coding Badly for sorting that one out for me. The reason I was doing that is that I've got a pair of RF modules that I couldn't get working.

Now I've got serial comms working I've tested the RF modules and can't get it working.

I'm using the RF Tx and Rx modules from bitsbox: http://www.bitsbox.co.uk/sensors.html#rf (the data sheets are available on that link).

On the transmitter arduino I've got the Tx module wired up like this:
Pin 1: +5v
Pin 2: GND
Pin 3: Arduino digital pin 3
Pin 4: Jumper cable connected to nothing (for an antenna).

I'm running the following code:

#include <NewSoftSerial.h>
NewSoftSerial sender(2,3);
int i = 0;  

void setup() 
{
  sender.begin(4800);
  Serial.begin(9600);
  delay(1000);
}

void loop()
{
  sender.print(i);
  sender.print (", ");
  Serial.print(i);
  Serial.print (", ");
  i++;
  delay(1000);
}

On the second arduino I've got the receiving module wired up like this:
Pin 1: +5v
Pin 2: GND
Pin 3: Nothing
Pin 7: GND
Pin 10: +5v
Pin 11: GND
Pin 12: +5v
Pin 13: Nothing
Pin 14: Arduino pin 3
Pin 15: +5v

I'm run the following code:

#include <NewSoftSerial.h>
NewSoftSerial rec(3,2);

void setup()
{
  rec.begin(4800);
  Serial.begin(9600);
  delay(1000);
}

void loop()
{
  if (rec.available() > 0) {
    Serial.print((char)rec.read());
  }
}

When I run it I get vast amounts of random characters.
If I unhook pin 3 I don't get anything.
The output looks different if the Tx arduino isn't running.

Any suggestions, please?

Have you connected the GNDs together?

D'oh!

Thank you :slight_smile:

I've edited my original post but I don't think it'll show as an unread thread if I don't do a new post.

You have the Tx & Rx running on different arduinos?
Not much point in going wireless if they are on the same.

If different Arduinos, you wouldn't have the grounds connected. One might be battery powered even (think a remote control to a wallwart powered receiver).

The datasheet says up to 4k datarate, yet your code says you are sending at 4800? Slow it down.
Then look into using Virtual Wire for sending out data. This provides a means for the receiver to get in sync with the transmitter vs trying to grab a few randomly transmitted bytes.