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

Hey Guys,

First up, this isn’t my library. It was developed by Mike McCauley, I believe he is still partially active with development.

The original “VirtualWire” library has a few compatibility issues with the latest version of the Arduino IDE. After some hunting I found the fix and thought it would be wise to share my findings.

[VirtualWire 1.3] download.milesburton.com/Arduino … alWire.rar

[Documentation for 1.3] download.milesburton.com/Arduino … alWire.pdf

This library works great with the Seeedstudio RF kits
[315 Mhz] seeedstudio.com/depot/315mhz … cc711ee267
[433 Mhz] seeedstudio.com/depot/433mhz … cc711ee267

Like most other libraries, drop VirtualWire (Above) into the hardware\libraries directory and fire up the example sketches per the documentation.

I can vouge for the 433Mhz version as it is now sitting on my desk chatting away. The document above explains what you need to do to get up and running. Unlike stock libraries, VirtualWire provides some basic error handling and syncronising. It produces a simple “packet” (which supposidly follows the ‘VirtualWire’ standard) that produces a pretty clean wireless communicate between two devices.

Great stuff, let me know how you get on :wink:
-Miles

Amazing!! Can’t wait to add it into the product page. Thanks! :bulb:

Thanks to Miles. I’ve added the library to the product page.

Hello Seeed Crew and Miles,

What is the main difference between this set and the Sparkfun modules (except the price the price :wink:)? I see a crystal and a small IS on the Sparkfun modules.

sparkfun.com/commerce/produc … ts_id=8950
sparkfun.com/commerce/produc … ts_id=8946

What is the range and baud rate (bps) of these modules?

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).

Just remembered the other discussion about these modules:

viewtopic.php?f=4&t=198

Where are you using the modules for?

Thanks in advance.

Hey Pinmode,

I honestly can’t say with regards to th difference between Sparkfun and Seeed modules. I’ll leave that up to the other guys to answer that.

At the moment I’m just testing a new library I’m writing. They seem resonably accurate if you solder an ariel to them. You can be pretty flexible with regards to the baud… I usually use around 2k-4k…

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 ([email protected])
// 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 ([email protected])
// 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