RF Reciever & transmitter [433Mhz, 315Mhz] Library.

Well I’ll just have to wait what the Seeed guys sat :slight_smile:.

Can you give a estimation on the range?

How is your experience with “noise” and “interference” from other wireless products operating at 434 MHz (car alarm/doors ect…)? This because I’ll probably will have some of these in the surrounding area (cars in the street).

Why are you using another library? Is the virtualWire library no good enough?

Best regards.

Hey guys! Just wanted to say I’m fairly new to the Arduino, I’ve gotten it up… blinking, wrote a library and that’s about it so far! So my experience is limited, but I’m having an issue with the 433Mhz pair. I hooked it up how the PDF showed, and used the VirutalWire examples, with no luck! The Arduino with the transmitter, LED blinks when it’s sending, like it’s suppose to. But the receiver just doesn’t get anything. I’ve tried them very close together… and spread them apart, without any luck, I’m sure it’s user error…
I’m kind of wondering if it’s the pins… at first I figured it was the Tx and Rx pins (for transmitter, and receiver respectively), but nothing there… so I read through the VirtualWire pdf, and it said something about the default pins were 11 and 12… so I gave those a try, without any luck.

Any information would be appreciated :slight_smile: Like I said, I’m sure it’s just user error, or I’m missing something…
Cheers! :smiley:

Try without the transmitters and receiverfs first mate… Directly connect your two arduinos RX to TX and TX to RX.

You are quite right about the default ports :slight_smile:

Please let me know how you get on

Sorry if the questions… seem a bit obvious, but, do I try connect the two arduinos together with the same code and try? Haven’t had much experience with TX/RX pins, all I know so far is not to use them, and if I need to, don’t connect the pins until after code is uploaded, but that’s about it! :blush: Just a little worried about hooking it up incorrectly and damaging something! :smiley:
Thanks for the quick response! :smiley: (And thanks for taking sometime to try help the newb understand!:))

You should be fine

RX is the reciever port where, inversely, TX is the transmitter.

If you run a wire from the TX to RX and run the same code it operate exactly the same and rules out any problems with the hardware :wink:.

Try that and have a play around. I’m away on business at the moment so I wont be able to resond quickly

Sorry for the delayed response! I tried hooking the TX to the RX, and vice versa on the boards, with no luck… it’s gotta be user error.
Here’s the code, I might have hooked up the tx/rx to the wrong ones. But I tried to switch em mid-code, I must be missing something. Or code issues.

Receiver[code]// receiver.pde
//
// Simple example of how to use VirtualWire to receive messages
// Implements a simplex (one-way) receiver with an Rx-B1 module
//
// See VirtualWire.h for detailed API docs
// Author: Mike McCauley (mikem@open.com.au)
// Copyright © 2008 Mike McCauley
// $Id: receiver.pde,v 1.3 2009/03/30 00:07:24 mikem Exp $

#include <VirtualWire.h>
#undef int
#undef abs
#undef double
#undef float
#undef round
void setup()
{
Serial.begin(9600); // Debugging only
Serial.println(“setup”);

// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for DR3100
vw_setup(2000);	 // Bits per sec

vw_rx_start();       // Start the receiver PLL running

}

void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;

if (vw_get_message(buf, &buflen)) // Non-blocking
{
int i;

    digitalWrite(13, true); // Flash a light to show received good message
// Message with a good checksum received, dump it.
Serial.print("Got: ");

for (i = 0; i < buflen; i++)
{
    Serial.print(buf[i], HEX);
    Serial.print(" ");
}
Serial.println("");
    digitalWrite(13, false);
}

}[/code]

Transmitter[code]// transmitter.pde
//
// Simple example of how to use VirtualWire to transmit messages
// Implements a simplex (one-way) transmitter with an TX-C1 module
//
// See VirtualWire.h for detailed API docs
// Author: Mike McCauley (mikem@open.com.au)
// Copyright © 2008 Mike McCauley
// $Id: transmitter.pde,v 1.3 2009/03/30 00:07:24 mikem Exp $

#include <VirtualWire.h>
#undef int
#undef abs
#undef double
#undef float
#undef round
void setup()
{
Serial.begin(9600); // Debugging only
Serial.println(“setup”);

// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for DR3100
vw_setup(2000);	 // Bits per sec

}

void loop()
{
const char *msg = “hello”;

digitalWrite(13, true); // Flash a light to show transmitting
vw_send((uint8_t *)msg, strlen(msg));
vw_wait_tx(); // Wait until the whole message is gone
digitalWrite(13, false);
delay(200);

}[/code]

Hi Captain. The code looks fine.

I suspect you’ve missed something or have a dodgy cable somewhere. VirtualWire is pretty reliable. Make sure you keep with the stock setup initally before you start playing with it otherwise you’ll run into trouble :slight_smile:

-Miles

So I was having trouble with these and gave up on them, didn’t see this forum though!

Where i’m at:

void setup()
{
Serial.begin(9600); // Debugging only
Serial.println(“A”);

// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for DR3100
Serial.println("B");
vw_setup(2000);    // Bits per sec
Serial.println("C");

}

Only produces an “A” and a “B” in the output. So I have worked out that vw_setup() is failing. I tried to go in and comment all of the content of the function out to see if I could test what in the Virtualwire Library was failing. But it still doesn’t fire properly…

Any ideas? Has anyone got the library working successfully with these (seeedstudio.com/depot/433mhz … p-127.html) ?? I don’t care if I use Virtualwire or another method (like the sparkfun.com method) - but none are working and i’m desperate.

void vw_setup(uint16_t speed) { }

I’ve not seen that problem before. I dont have the time at the moment to check but try my varient on this library.

arduino.cc/cgi-bin/yabb2/YaB … 1247875849

Change rf.send(“your message”); to rf.send.(“yourmessage”, false);

Let me know how you go with that

Oh in addition, I have those same modules you suggested and VW works great.

Woot! User error, indeed. Turns out the new breadboard I got, is reaallllly touchy with the jumper wires I got, if it’s not in like perfect, it won’t receive. Haven’t had the same problem with lighting LEDs, or anything else I’ve used, only when I’ve used the receiver so may be some kind of weird breadboard interference /shrug.

But it works! Once the LED started blinking, I cried a little bit on the inside.

Using the Virtual Wire examples,
Transmitter side = pin 12
Receiver side = pin 11
That was a bit confusing for me.

Next, hopefully… I’m going to hook up a 4x20 LCD, and put it in the next room, and talk crap to my brother :smiley: Just for fun, and I really want to learn programming more, and so far the best way for me, is using previous code, breaking it down, re-writing it, and adding functions as I go.

Thank you for your patience, I’m slow at times, but each learning experience is worth it!

So this Hypercom library looks alot more promising.

It took a while to get any response but where I’m at now is:

Transmitter is connected to Digital 10 on Arduino, using code from the link above. Is this right?
After startup the blue light stays solid for awhile and then the red light flashes 5 times (so failing to transmit).

The Receiver is connected to Digital 8 on Arduino. (??)
Red flahes twice
Green flashes twice
All three light up for maybe 5 seconds
Blue goes solid

And in the debug window I get these:
Unhandled status: 29
Unhandled status: 28
Unhandled status: 29
Unhandled status: 28
Unhandled status: 29
Unhandled status: 30
Unhandled status: 25
Unhandled status: 64
Unhandled status: 62
Unhandled status: 63
Unhandled status: 65
Unhandled status: 29
Unhandled status: 30
Unhandled status: 64
Unhandled status: 62
Unhandled status: 63
Unhandled status: 65
Unhandled status: 29
Unhandled status: 30
Unhandled status: 24
Unhandled status: 29
Unhandled status: 30
Unhandled status: 24
Unhandled status: 29
Unhandled status: 30
Unhandled status: 24
Unhandled status: 29
Unhandled status: 30
Unhandled status: 24
Unhandled status: 29
Unhandled status: 30
Unhandled status: 24
Unhandled status: 29
Unhandled status: 30
Unhandled status: 24
Unhandled status: 29
Unhandled status: 30
Unhandled status: 24
Unhandled status: 29
Unhandled status: 28
Unhandled status: 29
Unhandled status: 30
Unhandled status: 24
Unhandled status: 29
Unhandled status: 30
Unhandled status: 24
Unhandled status: 29
Unhandled status: 30
Unhandled status: 24
Unhandled status: 29
Unhandled status: 30
Unhandled status: 24
Unhandled status: 29
Unhandled status: 28
Unhandled status: 29
Unhandled status: 30
Unhandled status: 24
Unhandled status: 29
Unhandled status: 30
Unhandled status: 24
Unhandled status: 29
Unhandled status: 30
Unhandled status: 24
Unhandled status: 29
Unhandled status: 30
Unhandled status: 24
Unhandled status: 29
Unhandled status: 30
Unhandled status: 24
Unhandled status: 29
Unhandled status: 30
Unhandled status: 24
Unhandled status: 29
Unhandled status: 30
Unhandled status: 24
Unhandled status: 29
Unhandled status: 30
Unhandled status: 24
Unhandled status: 29
Unhandled status: 30
Unhandled status: 25
Unhandled status: 64
Unhandled status: 62
Unhandled status: 63
Unhandled status: 65
Unhandled status: 29
Unhandled status: 30
Unhandled status: 64
Unhandled status: 62
Unhandled status: 63
Unhandled status: 65
Unhandled status: 29
Unhandled status: 30
Unhandled status: 24

Where can I find a list of what these mean??

Well I feel pretty stupid, I didn’t change the rf.send to include ‘false’. That seems to have fixed the problem with the transmitter, but the receiver isn’t happy.

I’m finally transmitting between the two which is exciting, but the receiver has 3 solid lights for a second, and then the green flashes (while it receives), then back to 3 solid lights. It does this over and over, receiving around one in every 5 sends from the transmitter.

I also have a question about speed, there is no delay in the transmitter sending its message, which is “T01.04.100” (this is the format i’ll be sending in for my final app). It is probably firing 3-4 times a second. Is there a way to speed this up (i don’t know too much about this stuff), as i’ll be reading potentiometer values from a toy affecting sound and it needs to be realtime.

Something that has happened a couple of times since i’ve been working on this as well, is that there seems to be some sort of ‘time-out’ happening. Once the transmitter has been going hard for a while, it goes to 2 red blinks and 1 green blink, and the receiver gives up all together!

Cheers for all your help guys, i’d be screwed without you!

Well I really like how… simple the code looks for the VirtualWire. That’s a big thing for me!

I’m still a wee-little nublet in the programming sense… actually all of the electronics sense. I’m kind of looking to send commands to my LCD, having transmitter connected to the PC sending commands to it to say something, but it’s a bit out of my league at the moment. one step at a time I suppose:D

I am now transmitting pretty well between the two…

But this “Out of memory, cannot create packet” is my main problem, it stops the connection being fast. It has this message between every receive.

Any ideas about clearing the memory??

The problem is you are trying to send to much for the arduino to handle. It’s still quite an early build so it uses quite a lot of memory to send data.

Try and reduce the amount of data you send…

Hmm, it shouldn’t really crap out. That could be a bug you’ve uncovered.

The lights are basically my implementation. green light means it’s recieving a “packet stream”. Blue means it’s either pending recieving or sending and the blink green means it has been succesful.

If it takes “forever” and blinks red, that means it was expecting a confirmation but never recieved anything.

…Just while we’re on the topic…

For everyones information the diference between HyperCom, VirtualWire and, for example, software serial is reliability.

My library inparticular is focused around assuring a message is recieved by the remote client. VirtualWire adds some extra data which adds a little redudancy so it’s more likely the remote client will receive NON-CORRUPT data.

First off, I’d like to say thanks ALOT for the help Miles, I was tempted to just let my 2 pairs gather some dust! (along with a couple LCDs) I got it up and… well receiving! Just not able to send what I want at the moment.
Well, I’m a little confused on how to … send information! :smiley: I’ve used a sample sketch for a button and receiver setup using SoftWareSerial.

I think I understand how to use rfSerial.send(); but not really sure how the send syntax is, if I could send say… a few words and have the receiver receive, and print those words. Bit lost when it comes to that, and filtering out the noise. When I have the two running, transmitter and receiver, I only print… cbcbcbc to serial and lcd, which is the 99 and 98 button state… Confusing! lol

Ultimately, I’d like to have… say an Arduino connected via USB to the computer, sending data I input to the receiver, which will then print on an LCD. And also using potentiometer values on the Transmitting side, to change the value of LEDs on the receiving end. Psuedo(spelling?) code would be AMAZING. I’ve read the VirtualWire document and used the samples… but also a bit confused on receiving the data I want to send… and not the random RF waves. I’m just more comfortable at the moment with SoftWareSerial because the commands are so much like the Serial commands I’ve been working with.

I did try to edit some of the code I had to send values over, without any luck… Now all I’m reading is garbage. The sketch, previous to my edit was to read a button from the transmitter, and when I push the button, it would send a C rather than B, and vice versa (99 and 98 are B and C in decimal)

Any tips for… optimizing the code, and well, getting it to work correctly, would be much appreciated!:smiley:
Transmitter

[code]#include <SoftwareSerial.h>
/*
Read a pushbutton and send a value
to another microcontroller.
*/

#define rxPin 2
#define txPin 3
#define buttonPin 12
#define ledPin 13
#define potPin 0

// set up a new serial connection for communicating with RF transmitter
// (this also frees up Arduino’s built in serial port for PC communication)
SoftwareSerial rfSerial = SoftwareSerial(rxPin, txPin);

byte potVal = 0;
byte val = 0;
byte onState = 99;
byte offState = 98;

byte prevpotVal = 0;

void setup() {
pinMode(buttonPin, INPUT); // declare pushbutton as input
pinMode(ledPin, OUTPUT); // declare led as output
rfSerial.begin(2400); // our RF Link is a 2400 baud model (make sure you check this!)
// start by blinking high and then low so we can tell the setup routine has been completed
digitalWrite(ledPin,HIGH);
delay(1000);
digitalWrite(ledPin,LOW);
}

void loop(){
val = digitalRead(buttonPin);
potVal = analogRead(potPin) /4;
delay(20);

if ( potVal != prevpotVal ) { // check if the input is HIGH (button pressed)
rfSerial.print(onState, BYTE); // OK send it to the RF transmitter
digitalWrite(13, HIGH);
} else {
rfSerial.print(offState, BYTE); // send a 0 through Transmitter
digitalWrite(13, LOW);
}
prevpotVal=potVal;
}
[/code]

Receiver[code]#include <LiquidCrystal.h>
#include <SoftwareSerial.h>

#define rxPin 11
#define txPin 12
#define ledPin 13

LiquidCrystal lcd(9, 8, 2, 4, 5, 6, 7);

// set up a new serial connection for communicating with RF receiver
// (this also frees up Arduino’s built in serial port for PC communication)
SoftwareSerial rfSerial = SoftwareSerial(rxPin, txPin);

char prevChar = 0;

void setup() {
lcd.begin(4, 20);
delay(100);
lcd.print(“Loading…”);
// set up the input and output pins
pinMode(rxPin, INPUT); // set up pins for serial comm. with RF receiver
pinMode(ledPin, OUTPUT);
// initialize serial comm
rfSerial.begin(2400); // begin serial connection with RF Link unit
Serial.begin(2400); // begin serial communication over USB to the computer
// blink LED on and then off just to let us know the setup routine is complete
digitalWrite(ledPin,HIGH); // turn on LED
delay(1000);
digitalWrite(ledPin,LOW); // turn off LED
delay(2000);
lcd.clear();
lcd.print(“Ready2Receive:”);
Serial.print(“Ready2Receive:”);
lcd.setCursor(0,1);
}

void loop(){
char someChar = ‘0’;
someChar = rfSerial.read(); // read whatever the RF Link has to offer
// print out the character:
if (someChar!=prevChar) { // only print out new data (don’t print 0 a billion times in a row)
// send data to computer
Serial.print(someChar);
lcd.print(someChar);
prevChar=someChar; // store what we just read
}
}[/code]