Arduino Forum

Using Arduino => General Electronics => Topic started by: steven6282 on Jul 10, 2012, 05:32 am

Title: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: steven6282 on Jul 10, 2012, 05:32 am
Ok, so I ordered some of these from sparkfun to play around with for my project:

http://www.sparkfun.com/products/10535
http://www.sparkfun.com/products/10533

And I don't get it.  Using the VirtualWire.h library and using the examples given by them as well as examples on sparkfun and examples on the web, I can't get the receiver to receive anything at all.

Based on a lot of what I read, I was expecting to get a lot of garbage signals if anything, but I'm not receiving a single thing.  I ordered 5 transmitters and 2 receivers to test out with, and I've tried all 5 transmitters, and both receivers to no avail.

I'm pretty sure I got everything wired correctly, just doesn't make any sense.

On the receiver, I have both Vdd pins going to 5 volt, all 3 grounds going to ground.  I've got a piece of wire connected to the anteanna, and the Data Out pin going to digital pin 11 on my arduino uno (this is supposed to be the default rx pin).

For the transmitter I have Vcc going to the 5 volt, ground to ground, and Data In going to Pin 12 (supposed to be the tx pin).

I've tried every variation of the wiring that I can think of including other digital pins, swapping the rx and tx connections around, and nothing seems to work.

Is it possible that I got 2 bad receiver units from sparkfun?  Like I said I was expecting to receive a lot of garbage if anything.  I don't know if there is anyway for me to test the receivers or the transmitters to make sure they are even working correctly.

Magnets wouldn't damage anything on these would they?  Because I also ordered some rare earth magnets from sparkfun and they were all packaged in one box together.

Anyone have any suggestions?
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: mauried on Jul 10, 2012, 06:03 am
Theses types of Transmitters and Receivers are extremely simple Amplitude Modulated devices, where the data simply turns
a Radio Frequency Carrier on and off.
They operate on a frequency that is shared by many other household devices.
To transmit data reliably with them you need some smarts at the Transmitting end and also at the Receiver end.
Firstly, you need to Manchester Code the data that you want to transmit, and you also need to transmit preamble sequences
of alternating 1s and 0s, and start flags  before you start sending your data.
You also need some kind of CRC error checking.
The code in the receiver must be designed to look for the preamble sequences and the start flags and then has to decode the manchester encoded
data, and finally make sure the data is intact by computing the CRC against what is sent.

To understand what manchester coding is about this is a good article.
http://www.atmel.com/Images/doc9164.pdf

Its not hard to do , but if you want something that does all the hard work for you then
look at using Xbee Wireless modules.



Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: steven6282 on Jul 10, 2012, 06:12 am
All that is great and all, but if it is in fact receiving a bunch of garbage signals, should I not be getting them on the receiver?

I'm getting absolutely zilch, nada, 0, on the receiver.  Not so much as a garbage receive, or something that I actually tried transmitting.

I even tried plugging the receiver output pin into the serial rx and the rx light never even turns on leading me to believe it's never even sending a signal to the arduino.

I'm not interested in getting into any extravagant code atm to make sure the data being received is the data the transmitter sent, all I want to do right now is actually see the receiver receive something, anything!
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: mauried on Jul 10, 2012, 08:58 am
How are you receiving the data.
Are you using a usart in the controller.
If so, the broadband noise simply causes buffer overruns and the usart will lock up and produce nothing.
You have to check for buffer overruns , and then clear the usart buffers when they occurr.
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: steven6282 on Jul 10, 2012, 05:06 pm

How are you receiving the data.
Are you using a usart in the controller.
If so, the broadband noise simply causes buffer overruns and the usart will lock up and produce nothing.
You have to check for buffer overruns , and then clear the usart buffers when they occurr.



As I said, I've tried using a digital pin through VirtualWire and using it's rx receiving functions as well as plugging it directly into the rx of the arduino board.  At which time I also attempted using Serial.read to get any data from it that might be coming in.  In both cases there is absolutely nothing.

By the way, I think the VirtualWire library already handles error checking and such on transmissions that are sent and received through it.  Possibly even some form of this manchester code you are talking about.  Every single example I can find using the VirtualWire library shows it working with simply the library, no other extra code or preambles or anything of the sort.

I really think my receivers simply aren't working, but I don't know how to find out.  If it were overloading the uart buffer then I should be getting some kind of signal on the output pin of the receiver but I'm not.  I hooked a multimeter to it and I'm not getting a single blip in voltage or anything.  And if the receivers aren't working, I have no way to figure out if the transmitters are working or not as well.

EDIT:
And yes when I attempted to use the rx pin directly I set Serial to run in 4800 bps mode since that is what the transmitter and receiver are rated at.
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: CrossRoads on Jul 10, 2012, 07:13 pm
I have the 434 MHz version of these working in a remote control with Virtual wire, have not seen what you are seeing.

You have them running on separate Arduino's, yes? I have not seen anyone successfully use Tx and Rx on the same Arduino.

With 2 Arduino's, try connecting the Tx out to the Rx in, see if you can even get data going that way.  If not, then VirtualWire is not running.
My remote was built under -0021, I have not tried VirtualWire under 1.0 or 1.0.1.

The receiver code is smart - if properly encoded data does not come across, it will not be passed along as output data.
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: CrossRoads on Jul 10, 2012, 07:16 pm
Virtualwire does not use the UARTs - its more like smart software serial.
Data rate should not be higher than 2000 and messages sent under 27 bytes (or 37? check virtualwire document) due to time needed for message encoding/checking.
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: perhof on Jul 10, 2012, 07:43 pm

Virtualwire does not use the UARTs - its more like smart software serial.
Data rate should not be higher than 2000 and messages sent under 27 bytes (or 37? check virtualwire document) due to time needed for message encoding/checking.


I agree. Keep it down to 2000 bps and limit the chunks of data you're sending to a few bytes to begin with. 27 bytes is the maximum length.
I'm using similar models running at 434MHz all the time and they've never caused me any problems at that speed.

As CrossRoads said earlier, encoding and error checking and everything is done within the library so garbled data will never show up on the receiving end.
You will only see data that has passed CRC check

I'd say that you don't need to add an antenna at all if you just want to test them at short range.
For longer ranges you should get a wire of a more precise length and not "just a wire". You could use quarter, half or even full wavelength if space permits.

What version of VirtualWire are you using?
I'm using version the latest version which is 1.9 with Arduino 1.0. Get it at http://www.open.com.au/mikem/arduino (http://www.open.com.au/mikem/arduino)
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: steven6282 on Jul 10, 2012, 07:59 pm
Yes I'm using two arduinos, and initially I did try a speed of 2000 as that is what the example projects use.  But even the examples at 4 inches apart with and without a wire plugged into the antenna give me nothing.  Just trying to send the message "hello" from the example transmitter file :(  I am using VirtualWire 1.9 with arduino 1.0.1

One of my arduinos is an arduino uno, the other is a mega 2560.

I've even tried reversing the RX and TX pins (both in pins 0 and 1 actual rx / tx pins, as well as pins 11 and 12 the default VirtualWire rx and tx pins) in case I had them backwards in my head, to no avail.

This is quite a bit frustrating as all the examples I've read using these and virtual wire showing it as simply pluging it in and starting to send and receive messages with the virtualwire library.  I wish there was some way I could confirm that either my receivers or transmitters were faulty so that I could contact sparkfun to see about getting them exchanged or something.

I bought some transceivers to play around with as well: http://www.sparkfun.com/products/9582  hopefully they will not be as complicated at getting setup.  I'm just dreading having to wire the things since they are surface mount boards and I think their connections are closer than the standard bread board pitch so can't just solder some pins to it.  They also use more power than I'd like since the units with the transmitters are going to be run off batteries, that is why I was trying to get the RF transmitter / receiver working first.
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: CrossRoads on Jul 10, 2012, 08:08 pm
" I wish there was some way I could confirm that either my receivers or transmitters were faulty so that I could contact sparkfun to see about getting them exchanged or something."

Did you try connecting Tx pin to Rx pin (Tx Arduino 11 to Rx Arduino 12, or maybe the other way around), bypassing the RF modules?
That will confirm Virtualwire is working.

Also, make sure you take out the PTT references. These modules do not use PTT (Press to Talk):

4.3 vw_set_ptt_pin
extern void vw_set_ptt_pin(uint8_t pin);
Set the digital IO pin to use to enable the transmitter (press to talk). Defaults to 10. Not
all transmitters require PTT. The DR3100 does, but the TX-B1 does not.

Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: perhof on Jul 10, 2012, 08:25 pm
I realize you've already checked the comments at Sparkfun since you posted a question there yesterday :)
By the comments it looks like these particular modules are very sensitive to interference. I don't know if 315MHz is worse than 434MHz.
I've heard of wireless alarms and other equipment that more or less jam these open frequencies.
Maybe you could try your modules at another location to see if you have a problem in your area?

I've been using this type of modules for remotes and wireless sensors and I never had a problem: http://www.ebay.co.uk/itm/433MHz-RF-transmitter-and-receiver-link-kit-/261055772748 (http://www.ebay.co.uk/itm/433MHz-RF-transmitter-and-receiver-link-kit-/261055772748)
You can miss a packet of data once in a while but it usually works very well.
I open a garage door from within a car about 60 meters from the garage. Receiver and it's wire antenna is placed inside the garage.
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: Docedison on Jul 10, 2012, 08:46 pm
First I would plig them into the same breadboard, about 15 20 Cm Apart supply 5V and ground to the appropriate pins on tx and rx modules and put a pull up (4K7 should work fine) on the receiver and a pull down on the transmitter data output. Then I would then put some kind of indicator on the rx output module a DMM should work... There isn't enough current available to light an LED... and monitor the rx output pin while pulling up the TX data line... use a 470R resistor to pull the TX data line up to +5V. If it fails there are three possibilities 1. They aren't tx/rx modules (That would be no surprise from Sparkfun...) 2. the TX and RX modules aren't on the same frequency (there are 3 or 4 separate frequencies around 433 Mhz) again Sparkfun... or 3 the modules aren't any good. However for 3 TX's and 2 RX's to all fail completely in the same manner kinda beggars the imagination. My thinking so far is that ??hopefully? they are on the same frequency and that the receiver has an Open Drain/collector type of output and it isn't really hooked up properly. I've used hundreds of those modules for remote data collection, device controller/programmer applications and all but a small handful worked out of the box, the failed ones were all due to poor assembly and lack of inspection prior to sale. I later ?advanced to making my own devices and If I Never see another MPSH10 It will be too soon. I had an assembly line at my place of employment and all errors made were of the monday morning or "Wrong time of the month" type of errors... All but one batch. I designed the transmitter inductor (Coil) on the PCB and my printed circuit house and I had a great relationship... on one run of boards the PCB guys didn't have any .020 1/4 oz copper laminate (FR4) but he did have a bunch of left over Duriod 5880 Stock and he used it to make my transmitter boards. 5880 material has a very different dielectric constant... like about 2 - 2.5 and the FR4 is about 4.3 - 4.9 my 433 mhz transmitters were in fact working... @ ~550 Mhz... I really came to dislike production electronics...

Doc
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: Docedison on Jul 10, 2012, 08:51 pm
I bought a couple of pairs of 433 modules from Electrodragon ($1.90/pair rx/tx) and they are functioning well as temp monitors for my little greenhouse in the garage... Very Well @ 50 meters. I like buying things that just work... without a major production to find out "How to Make them Work"

Doc
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: steven6282 on Jul 11, 2012, 01:06 am
Ok, now I am thoroughly confused.

I tried plugging the tx pin (virtual wire tx not the serial tx) from the 2560 into the rx pin (virtual wire rx not the serial rx), and it's sporadic at best.  This is completely eliminating the transmitter and receiver.  Sometimes vw_have_message will return true, but then vw_get_message doesn't actually get anything.  Then ever once in a while it will print out that it got something, and it looks like the hex is the correct hex for hello, but it's not getting it everytime.  Over a hard wire connection that just doesn't make any sense.

This is the code I'm testing with right now:

Transmitter:
Code: [Select]

#include <VirtualWire.h>

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);
}


receiver:
Code: [Select]

#include <VirtualWire.h>

void setup()
{
   Serial.begin(9600);  // Debugging only
   Serial.println("setup");

   //vw_set_ptt_inverted(true); // Required for DR3100
   // Initialise the IO and ISR
   vw_set_rx_pin(2);
   vw_setup(2000);
   vw_rx_start();       // Start the receiver PLL running
}

void loop()
{
   //Serial.println("waiting....");
   //vw_wait_rx();
   uint8_t buf[VW_MAX_MESSAGE_LEN];
   uint8_t buflen = VW_MAX_MESSAGE_LEN;

   if (vw_have_message()) Serial.println("Have a message");
   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("");
  }
}



....*sigh*

EDIT:
Ok... all of my problems may have something to do with power levels.  I've been using a 9volt battery to power the transmit arduino (2560).  Everything seemed to be working fine with it the led blinked and everything so I didn't think anything of it.  But out of desperation I changed batteries, and suddenly with the hardwire every single message is going through.  So maybe the battery was to weak and it wasn't sending a strong enough signal down the wire?  I'm going to try again with a wall wart plug later when I get time to put one together to see if I can get the actual transmitter to work off that.
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: steven6282 on Jul 11, 2012, 02:05 am
Thanks for all the help guys.  Looks like my problem was simply power issues all along.  Plugged a wall wart into the 2560 with the tranmitter hooked up, the uno into my computers USB with the receiver hooked up and walla, hello in hex is coming through.

Stupid batteries =p  That does not bode well for me planning to use batteries in the devices that will be doing the transmitting!

EDIT:

Well it's mostly working.  Even with a 13cm piece of wire plugged into them for an antenna I can't separate them more than a couple inches without loosing all the data.

Guess that is a sign that I have a lot of interference in this area or something.
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: CrossRoads on Jul 11, 2012, 02:13 am
Yes, 9V battery not the greatest for Arduino. 1/2 the capacity wasted as heat just going thru the regulator.
Using a switching regulator such as this to make 5V and then powering the 5V at the header pin is better.
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: CrossRoads on Jul 11, 2012, 02:34 am
I made a remote control, uses 8 MHz Promini running direct from 3.7V LiPo connected to Vcc line (bypasses regulator).
Keypress creates interrupt, wakes up uC from power down sleep mode, it reads the keypress using the Keypad.h library, sends it out via virtualwire, goes back into powerdown sleep mode.
Uses MAX1811 to charge the battery from a 5V source, like a USB port, but I have a 5V wallwart that powers the receiver, I just move the cord over when I want to charge it. Both have panelmount 5.5/2.1 barrel jacks.
http://www.parts-express.com/pe/showdetl.cfm?Partnumber=090-479

or PCB mount if that's your design
http://www.dipmicro.com/store/KLDX-0202-A

wallwarts
http://www.dipmicro.com/store/DCA-0510
http://www.dipmicro.com/store/DCA-0520
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: steven6282 on Jul 11, 2012, 02:58 am
Alrighty then... that is odd.

Trying to figure out why I can't get any range out of it, I removed the transmitter from the 2560 board while it's running, the uno continue to receive the hello message.....  Unplug the 2560 the messages stop, plug it back in they start again.  So apparently even without the transmitter plugged in, the 2560 is putting out enough signal for the receiver to pick it up at close range with no transmitter at all???
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: steven6282 on Jul 11, 2012, 03:14 am
Yep, I'm dumbfounded.  This has got to be one of the most annoying pieces of electronics I have worked with yet.

I can not get more than a 2 inch range out of these things with a 13 cm antenna.  Removing the antenna has a very small impact on performance.  It doesn't increase the range, just helps more of the signals get through at the max range of 2 inches!

At this 2 inches, the receiver will pick up the message from the other arduino board somehow with no transmitter plugged in.  Although with the transmitter plugged in, it picks up the message a lot more consistently.

I'm almost ready to throw these things in the trash  :0


EDIT:

Ok scratch that.  Looks like I've got at least one bad receiver.  Swapped out the receiver with my 2nd receiver and now I'm receiving messages from one end of the house to the other (about 20 meters).  It was missing some signals at that range but it was picking up at least 3 in 5.
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: perhof on Jul 11, 2012, 10:18 am

Ok scratch that.  Looks like I've got at least one bad receiver.  Swapped out the receiver with my 2nd receiver and now I'm receiving messages from one end of the house to the other (about 20 meters).  It was missing some signals at that range but it was picking up at least 3 in 5.


That's more like it but you shouldn't stick to that 13 cm antenna. 13 cm is for 434MHz.
The wavelength at 315 MHz is 95.2 cm so a 1/4 wavelength antenna would have to be around 24 cm.

Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: steven6282 on Jul 11, 2012, 05:17 pm


Ok scratch that.  Looks like I've got at least one bad receiver.  Swapped out the receiver with my 2nd receiver and now I'm receiving messages from one end of the house to the other (about 20 meters).  It was missing some signals at that range but it was picking up at least 3 in 5.


That's more like it but you shouldn't stick to that 13 cm antenna. 13 cm is for 434MHz.
The wavelength at 315 MHz is 95.2 cm so a 1/4 wavelength antenna would have to be around 24 cm.




I never new antenna lengths had anything to do with it.  I only used 13cm because I read that somewhere, don't remember where.  Probably the sparkfun comments on the 434mhz version of the transmitter or something.

13cm is really to long for what I'm doing, 24 cm would be bordering on ludicrous lol :)  Not unless I can coil it inside a project box and only have a small part sticking out, but that seems like it would defeat the purpose of an antenna.

People say this is a commonly used frequency in alarm systems and such but I don't recall ever seeing anything with a 24 cm antenna sticking out of it, so how do they achieve it?  Like I said if I can coil it around inside the project box I can probably get by, even with 24cm.  The question then is should it be a bare piece of wire, a rubber insulated piece of wire, or something else entirely?  Is one type of wire / gauge of wire better than others if wire is ok to use?  For the project I'm using this in, getting a message through to the receiver is important, but my overall project size needs to remain somewhat small and inconspicuous.
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: CrossRoads on Jul 11, 2012, 09:13 pm
17cm is for 434 MHz.

315 MHz ~1.5ft,
1/4 of that, ~11cm, should work well
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: perhof on Jul 11, 2012, 10:00 pm

17cm is for 434 MHz.


Right, it should be 17. My bad.
I've also read 13 in some guides but it should be 17 for 434MHz and that's what I'm using.

Quote

315 MHz ~1.5ft,
1/4 of that, ~11cm, should work well


What is 11cm? 1/8 wavelength?
Guess it should work too.

Experiment a bit. Try 11-12 cm and route it around inside your enclosure and try 24 cm and make more loops. It doesn't necessarily have to stick out.
Maybe it has to if you use a metal enclosure.

Any piece of wire should do. I've used thick single core copper without plastic insulation, thin single core jumper wire with insulation, a multi core wire with insulation from an ethernet cable (there are eight of these in each cable) and that worked fine too. I don't know what's best in theory.

The alarm devices you're mentioning are probably using coil antennas or pcb loop antennas which are a bit harder to get right.
Maybe someone here can tell what dimensions you would need for that.

What kind of range are you aiming for?
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: CrossRoads on Jul 11, 2012, 10:16 pm
I just have 30 guage wirewrap wire, sits loose on my enclosure.
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: steven6282 on Jul 11, 2012, 11:32 pm


17cm is for 434 MHz.


Right, it should be 17. My bad.
I've also read 13 in some guides but it should be 17 for 434MHz and that's what I'm using.

Quote

315 MHz ~1.5ft,
1/4 of that, ~11cm, should work well


What is 11cm? 1/8 wavelength?
Guess it should work too.

Experiment a bit. Try 11-12 cm and route it around inside your enclosure and try 24 cm and make more loops. It doesn't necessarily have to stick out.
Maybe it has to if you use a metal enclosure.

Any piece of wire should do. I've used thick single core copper without plastic insulation, thin single core jumper wire with insulation, a multi core wire with insulation from an ethernet cable (there are eight of these in each cable) and that worked fine too. I don't know what's best in theory.

The alarm devices you're mentioning are probably using coil antennas or pcb loop antennas which are a bit harder to get right.
Maybe someone here can tell what dimensions you would need for that.

What kind of range are you aiming for?


Worse case scenario about 15 meters, but mostly within 10 meters.

I'm still playing with stuff just testing and prototyping right now.  Got some transceivers to try out next if I can figure out how to wire them.  They just use a bit more power which I'm not crazy about since I'm trying to keep these things low enough to run off batteries for a good amount of time.
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: perhof on Jul 12, 2012, 01:40 am
Quote

Worse case scenario about 15 meters, but mostly within 10 meters.


I'd say you should reach 15 meters no matter what kind of wire and which of the antenna lengths you select as long as it's a length that matches the frequency.
Selecting any other length might not help.

Quote

I'm still playing with stuff just testing and prototyping right now.  Got some transceivers to try out next if I can figure out how to wire them.  They just use a bit more power which I'm not crazy about since I'm trying to keep these things low enough to run off batteries for a good amount of time.


What's the application if i may ask?
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: steven6282 on Jul 12, 2012, 01:52 am

What's the application if i may ask?


Wireless sensors for an alarm system.
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: steven6282 on Jul 12, 2012, 04:24 am
I just found these on sparkfun:

http://www.sparkfun.com/products/690

How the heck do you solder something like that?  It's really cheap and a 2.4ghz transceiver should have a lot less interference problems, and the power usage is between the rf transmitters and the transceivers I  currently have (http://www.sparkfun.com/products/9582)

Does it require anything else to work?  The description mentions something about works great with a 16mhz crystal, does it require that though?
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: Docedison on Jul 12, 2012, 05:18 am
Do you know for sure that the device is getting 5V? Those little devices usually just work. They worked well for me when I actually made the things before I retired. Clean 5V and Ground, the antenna wires should be about 7" or about 18CM and either vertical or horizontal doesn't matter as long as both are the same way. You might get lucky there as it is possible to decrease the interfering signal by changing antenna polarization, theoretically by a factor of 10, Practically about 1/3.

Doc
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: CrossRoads on Jul 12, 2012, 05:24 am
You buy it on a board instead:

http://www.sparkfun.com/products/691

http://iteadstudio.com/store/index.php?main_page=product_info&cPath=7&products_id=53
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: steven6282 on Jul 12, 2012, 06:01 am

You buy it on a board instead:

http://www.sparkfun.com/products/691

http://iteadstudio.com/store/index.php?main_page=product_info&cPath=7&products_id=53


Lol thanks, I actually found the board version on sparkfun after I posted that, but wasn't going to pay 20 dollars for it on a board, however $5.50, that I can probably swing :)
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: pwillard on Jul 12, 2012, 02:23 pm
 9V's batteries are horrible...   High Cost/Low Current.

You would do well to buy a $15-$20 radio control 9.6V rechargeable (usually comes with a charger too).
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: Docedison on Jul 14, 2012, 10:32 pm
And the same module here for $2.75 US (this price is typical of many vendors on Ebay) 5.50 Ea should be for a pair... Check it out.
http://www.electrodragon.com/?product=storage-container-set (http://www.electrodragon.com/?product=storage-container-set).
I recently bought 6 of those devices and a USB Receiver "Dongle" for $9.95... "Free Shipping"... Too ? $22.00 Ea... Yeah I'll Bet... that they would love to sell a bunch at that price, oh yeah and the Features on the $22.50 board are built into the Chip. All of the nRF24XX series Ic's have those features... They're part of what drove the original design and that was an inexpensive Chipset that could co-exist with all the other ISM stuff as well as Microwave Ovens @ 2450 Mhz and most capable of 1000 watts or more @ ~ 2450 mhz as the ovens use a "Power Oscillator" (A Klystron of Magnetron tube) neither of which has any external frequency control (Oscillating Frequency is set by internal cavity dimensions primarily).

Doc
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: steven6282 on Jul 15, 2012, 09:52 pm

And the same module here for $2.75 US (this price is typical of many vendors on Ebay) 5.50 Ea should be for a pair... Check it out.
http://www.electrodragon.com/?product=storage-container-set (http://www.electrodragon.com/?product=storage-container-set).
I recently bought 6 of those devices and a USB Receiver "Dongle" for $9.95... "Free Shipping"... Too ? $22.00 Ea... Yeah I'll Bet... that they would love to sell a bunch at that price, oh yeah and the Features on the $22.50 board are built into the Chip. All of the nRF24XX series Ic's have those features... They're part of what drove the original design and that was an inexpensive Chipset that could co-exist with all the other ISM stuff as well as Microwave Ovens @ 2450 Mhz and most capable of 1000 watts or more @ ~ 2450 mhz as the ovens use a "Power Oscillator" (A Klystron of Magnetron tube) neither of which has any external frequency control (Oscillating Frequency is set by internal cavity dimensions primarily).

Doc


That $2.75 one doesn't look like the + model that sales for $5.50 at the other place.  The + model adds a few features including a slower transmit speed for increased range and less power usage.

However you are correct they are cheaper on ebay http://www.ebay.com/itm/2PCS-Arduino-NRF24L01-Wireless-Transceiver-Module-/270977894613?pt=LH_DefaultDomain_0&hash=item3f178a88d5 is a + and 4.10 for 2 of them, so only $2.05 each free shipping.

Although I'd probably buy this one instead: http://www.ebay.com/sch/i.html?_sacat=0&_nkw=nrf24l01&LH_PrefLoc=1&_sop=15  a little bit more expensive but it's located in the US, so would get here 3 times quicker lol.
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: Stigern on Oct 08, 2012, 09:03 pm
So, I'm testing the RF434, with VirtualWire. And is there a way to make it translate what it recieved into a text? Instead of hex codes for each letter.
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: CrossRoads on Oct 08, 2012, 10:34 pm
Sure, just translate the hexcodes into letters. Translation is available at asciitable.com

Say you get 1 character at a time:
Code: [Select]

    // mapping from incoming character to font_array or other commands: \ + = < >
    // invalid characters are not defined and are ignored
    switch(incomingByte){
    case 0x20:
Serial.print(" ");
      break;
    case 0x21:
Serial.print("!");
break;
    case 0x2d:
      Serial.print("-");
      break;
    case 0x2e:
      Serial.print(".");
      break;
    case 0x2f:
      Serial.print("/");
      break;
    case 0x30:
      Serial.print("0");
      break;
    case 0x31:
      Serial.print("1");
      break;
// etc.   
}
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: Stigern on Oct 09, 2012, 07:09 pm
Thanks!

But I've ran into another problem, the VirtualWire library is hard to understand.

I'm using a DHT11 to measure the temperature, now getting the readings from the DHT11 is easy, getting em shown in the serial monitor is easy.

Problem comes when I want to send the readings using VirtualWire, thats hard :P Or I'm sure I'm missing something...

This is my code:

Problems starts in "char *msg = char(DHT11.temperature);" it seems.

Code: [Select]

// 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 (C) 2008 Mike McCauley
// $Id: transmitter.pde,v 1.3 2009/03/30 00:07:24 mikem Exp $

// dewPoint function NOAA
// reference: http://wahiduddin.net/calc/density_algorithms.htm
double dewPoint(double celsius, double humidity)
{
double A0= 373.15/(273.15 + celsius);
double SUM = -7.90298 * (A0-1);
SUM += 5.02808 * log10(A0);
SUM += -1.3816e-7 * (pow(10, (11.344*(1-1/A0)))-1) ;
SUM += 8.1328e-3 * (pow(10,(-3.49149*(A0-1)))-1) ;
SUM += log10(1013.246);
double VP = pow(10, SUM-3) * humidity;
double T = log(VP/0.61078);   // temp var
return (241.88 * T) / (17.558-T);
}

// delta max = 0.6544 wrt dewPoint()
// 5x faster than dewPoint()
// reference: http://en.wikipedia.org/wiki/Dew_point
double dewPointFast(double celsius, double humidity)
{
double a = 17.271;
double b = 237.7;
double temp = (a * celsius) / (b + celsius) + log(humidity/100);
double Td = (b * temp) / (a - temp);
return Td;
}


#include <dht11.h>

dht11 DHT11;

#define DHT11PIN 2

#include <VirtualWire.h>

int tempsend;
char tempconv;
char fuck;

void setup()
{
   Serial.begin(9600);  // Debugging only
   Serial.println("setup");
   Serial.println("DHT11 TEST PROGRAM ");
   Serial.print("LIBRARY VERSION: ");
   Serial.println(DHT11LIB_VERSION);
   Serial.println();

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

void loop()
{
    Serial.println("\n");

 int chk = DHT11.read(DHT11PIN);

 Serial.print("Read sensor: ");
 switch (chk)
 {
   case 0: Serial.println("OK"); break;
   case -1: Serial.println("Checksum error"); break;
   case -2: Serial.println("Time out error"); break;
   default: Serial.println("Unknown error"); break;
 }

 //Serial.print("Humidity (%): ");
 //Serial.println((float)DHT11.humidity, 2);

 Serial.print("Temperature (oC): ");
 Serial.println(DHT11.temperature);


  char *msg = char(DHT11.temperature);

   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(2000);


}


Since it complains I can't do "'int' to 'char*'", I tried to set a char() conversion first. But then it complains about this "'char' to 'char*'". So I try to remove the * infront of MSG, but then I get the warning about a constant char...

I'm really confused here, anyone want to help me think this one out?

Sigh, I wish VirtualWire would have more examples showing how to send other values than 'const char'.
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: CrossRoads on Oct 09, 2012, 07:18 pm
Change a couple of things:

Move these to the top of the sketch
Code: [Select]

#include <dht11.h>
#include <VirtualWire.h>


Delete this unless your transmitter needs a Push to Talk switch (most don't)
Code: [Select]

    vw_set_ptt_inverted(true); // Required for DR3100


put the data you want to send in an array
msg[ ]
then virtualwire will send the msg[] array out.

I can't tell what data type you want to send - DHT11.temperature is a float? thus 4 butes?
So put 4 byte in msg[0] thru msg[3] and let 'er rip.
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: Stigern on Oct 09, 2012, 07:39 pm
Hm, sorry for not understanding. But the value I'm sending could just be a normal int.

Code: [Select]

   Serial.print("Temperature (oC): ");
  int convert = DHT11.temperature;
  Serial.println(convert);


   char *msg[3] = convert;

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


So after converting my float value to a int, it's basically the value of 23-25 around there. What do you mean by put 4 byte in msg[0] thru msg[3]?

Thanks for all the help so far! :)
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: CrossRoads on Oct 09, 2012, 07:53 pm
I didn't know how many bytes of data  you were dealing with, so figured you had a float that was 4 bytes long.

I don't know what this does
Code: [Select]

char *msg[3] = convert;


I would personally do this:
Code: [Select]

msg[0] = highByte(convert);
msg[1] = lowByte(convert);

and then let virtualwire send the [msg] array out.  Or just grab the low byte if its always <=255

I'd have to look at my remote control code at home to see if
Code: [Select]

vw_send((uint8_t *)msg, strlen(3));

had to change to support that.
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: Stigern on Oct 09, 2012, 08:16 pm
Hm, got no compiling errors, but it won't send. Led 13 won't even light up, so it can't have gotten that far into the program :P

Code: [Select]

#include <dht11.h>
dht11 DHT11;
#define DHT11PIN 2
#include <VirtualWire.h>

double dewPoint(double celsius, double humidity)
{
double A0= 373.15/(273.15 + celsius);
double SUM = -7.90298 * (A0-1);
SUM += 5.02808 * log10(A0);
SUM += -1.3816e-7 * (pow(10, (11.344*(1-1/A0)))-1) ;
SUM += 8.1328e-3 * (pow(10,(-3.49149*(A0-1)))-1) ;
SUM += log10(1013.246);
double VP = pow(10, SUM-3) * humidity;
double T = log(VP/0.61078);   // temp var
return (241.88 * T) / (17.558-T);
}

// delta max = 0.6544 wrt dewPoint()
// 5x faster than dewPoint()
// reference: http://en.wikipedia.org/wiki/Dew_point
double dewPointFast(double celsius, double humidity)
{
double a = 17.271;
double b = 237.7;
double temp = (a * celsius) / (b + celsius) + log(humidity/100);
double Td = (b * temp) / (a - temp);
return Td;
}

int tempsend;
char tempconv;
char fuck;

void setup()
{
    Serial.begin(9600);   // Debugging only
    Serial.println("setup");
    Serial.println("DHT11 TEST PROGRAM ");
    Serial.print("LIBRARY VERSION: ");
    Serial.println(DHT11LIB_VERSION);
    Serial.println();

    // Initialise the IO and ISR
    vw_setup(2000); // Bits per sec
}

void loop()
{
     Serial.println("\n");

  int chk = DHT11.read(DHT11PIN);

  Serial.print("Read sensor: ");
  switch (chk)
  {
    case 0: Serial.println("OK"); break;
    case -1: Serial.println("Checksum error"); break;
    case -2: Serial.println("Time out error"); break;
    default: Serial.println("Unknown error"); break;
  }

  int convert = DHT11.temperature;

   char *msg;
   msg[0] = highByte(convert);
   msg[1] = lowByte(convert);

    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(2000);
}
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: CrossRoads on Oct 09, 2012, 08:25 pm
Are you getting any of these?
Code: [Select]

  switch (chk)
  {
    case 0: Serial.println("OK"); break;
    case -1: Serial.println("Checksum error"); break;
    case -2: Serial.println("Time out error"); break;
    default: Serial.println("Unknown error"); break;
  }


is this doing anything now?
char *msg;
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: Stigern on Oct 09, 2012, 08:55 pm
I'm getting the Ok. But I found an example on a blog:
http://genericnerd.blogspot.no/2012/07/arduino-sending-integers-over-rf-with.html

So I took it, and merged it with the DHT11.

Transmitter:
Code: [Select]

//
//   FILE:  dht11_test1.pde
// PURPOSE: DHT11 library test sketch for Arduino
//

//Celsius to Fahrenheit conversion

#include <dht11.h>

dht11 DHT11;

#define DHT11PIN 2

#include <VirtualWire.h>

// LED's
const int ledPin = 13;

// Sensors

int Sensor1Data;
//int Sensor2Data;
char Sensor1CharMsg[4];

double Fahrenheit(double celsius)
{
return 1.8 * celsius + 32;
}

//Celsius to Kelvin conversion
double Kelvin(double celsius)
{
return celsius + 273.15;
}

// dewPoint function NOAA
// reference: http://wahiduddin.net/calc/density_algorithms.htm
double dewPoint(double celsius, double humidity)
{
double A0= 373.15/(273.15 + celsius);
double SUM = -7.90298 * (A0-1);
SUM += 5.02808 * log10(A0);
SUM += -1.3816e-7 * (pow(10, (11.344*(1-1/A0)))-1) ;
SUM += 8.1328e-3 * (pow(10,(-3.49149*(A0-1)))-1) ;
SUM += log10(1013.246);
double VP = pow(10, SUM-3) * humidity;
double T = log(VP/0.61078);   // temp var
return (241.88 * T) / (17.558-T);
}

// delta max = 0.6544 wrt dewPoint()
// 5x faster than dewPoint()
// reference: http://en.wikipedia.org/wiki/Dew_point
double dewPointFast(double celsius, double humidity)
{
double a = 17.271;
double b = 237.7;
double temp = (a * celsius) / (b + celsius) + log(humidity/100);
double Td = (b * temp) / (a - temp);
return Td;
}


void setup()
{
 Serial.begin(9600);
  // LED
pinMode(ledPin,OUTPUT);
 // VirtualWire setup
vw_setup(2000);     // Bits per sec

}

void loop()
{

 
 
  // Read and store Sensor 1 data
 int chk = DHT11.read(DHT11PIN);
 Sensor1Data = DHT11.temperature;
 delay(2000);
 // Convert integer data to Char array directly
 itoa(Sensor1Data,Sensor1CharMsg,10);
 
 // DEBUG
 Serial.print("Sensor1 Integer: ");
 Serial.print(Sensor1Data);
 Serial.print(" Sensor1 CharMsg: ");
 Serial.print(Sensor1CharMsg);
 Serial.print("RawSensor: ");
 Serial.print(DHT11.temperature);
 Serial.println(" ");
 delay(1000);

 // END DEBUG

digitalWrite(13, true); // Turn on a light to show transmitting
vw_send((uint8_t *)Sensor1CharMsg, strlen(Sensor1CharMsg));
vw_wait_tx(); // Wait until the whole message is gone
digitalWrite(13, false); // Turn off a light after transmission
delay(200);
}
//
// END OF FILE
//


Reciever:

Code: [Select]

/*

Sensor Receiver
By Markus Ulfberg 2012-07-06

Gets a sensor reading 0-1023 in a char array
from RF Transmitter unit via VirtualWire
converts char array back to integer

*/

#include <VirtualWire.h>

// LED's
int ledPin = 13;

// Sensors
int Sensor1Data;

// RF Transmission container
char Sensor1CharMsg[4];

void setup() {
 Serial.begin(9600);
 
 // sets the digital pin as output
 pinMode(ledPin, OUTPUT);      
   
   // VirtualWire
   // Initialise the IO and ISR
   // Required for DR3100
   vw_set_ptt_inverted(true);
   // Bits per sec
   vw_setup(2000);    
   
   // Start the receiver PLL running
   vw_rx_start();      

} // END void setup

void loop(){
   uint8_t buf[VW_MAX_MESSAGE_LEN];
   uint8_t buflen = VW_MAX_MESSAGE_LEN;
   
   // Non-blocking
   if (vw_get_message(buf, &buflen))
   {
   int i;
       // Turn on a light to show received good message
       digitalWrite(13, true);
   
       // Message with a good checksum received, dump it.
       for (i = 0; i < buflen; i++)
   {            
         // Fill Sensor1CharMsg Char array with corresponding
         // chars from buffer.  
         Sensor1CharMsg[i] = char(buf[i]);
   }
       
       // Null terminate the char array
       // This needs to be done otherwise problems will occur
       // when the incoming messages has less digits than the
       // one before.
       Sensor1CharMsg[buflen] = '\0';
       
       // Convert Sensor1CharMsg Char array to integer
       Sensor1Data = atoi(Sensor1CharMsg);
       
       
       // DEBUG
       Serial.print("Temp Outside: ");
       Serial.println(Sensor1Data);
       
     
       
       
       // END DEBUG
               
       // Turn off light to and await next message
       digitalWrite(13, false);
   }
}



Now it's working. :P Not sure I understand exactly how it parses the int over. I sure need to study arrays more. And just experiment with em.
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: CrossRoads on Oct 09, 2012, 09:04 pm
Seems to be here:
Code: [Select]

  // Convert integer data to Char array directly
  itoa(Sensor1Data,  Sensor1CharMsg,  10);

then sends it out
vw_send((uint8_t *)  Sensor1CharMsg  , strlen(  Sensor1CharMsg  ));


itoa is one of those C things that you have to know about to be able to look it up:
http://www.arduino.cc/playground/Code/PrintingNumbers
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: Stigern on Oct 09, 2012, 09:31 pm
So, there are many other functions other than those listed on Arduino.cc-Reference?

Thanks so much for the help :) I understand much much more than before I read your answers :D
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: CrossRoads on Oct 09, 2012, 09:38 pm
Oh yeah, there's all kinds of C stuff out there.

There's an enlarged Reference page
http://arduino.cc/en/Reference/HomePage?from=Reference.Extended

Try some of the links at the lower right of the page too:

"Looking for something else? See the libraries page for interfacing with
particular types of hardware. Try the list of community-contributed code.
The Arduino language is based on C/C++. It links against AVR Libc and allows
the use of any of its functions; see its user manual for details. "
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: genn on Oct 22, 2012, 03:28 pm

Hi,

I want to sent data through RF transmitters using simple UART in arduino instead of using virtualWire library. I tried with virtualWire library its working fine. But when i used UART its not working. My data packet format is like this... "$$(DATA)(INVERTEDDATA)Z ". I tried connecting with baud rates 2400,1200,300 but none of this works.

Anyway serial communication is working fine when i connect two controllers with a wire(i.e Connecting TX of one with RX of the other). But when i introduce RF transmitter in the middle its not working. I think RF transmitter is transmitting data and RF receiver is receiving it but since iam connecting DATAOUT of reciever directly to RX pin(0th pin in arduino) serial port is not considering the data packets as valid bits.

Can anyone tell me what is the problem?
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: tylernt on Oct 22, 2012, 04:25 pm
genn,

I'm not sure what Rx hardware you're using, but a lot of them have a PLL that requires a nearly even distribution of  ones and zeros to work properly. By default, the hardware UARTs send a constant HIGH that will confuse the Rx hardware (and it's not so good for battery life either). So, you want to turn the transmitter's serial port or RF unit OFF until you want to send a packet. Then you send a "preamble" of one or two bytes consisting of either 01010101 or 10101010 to allow the Rx unit's PLL to lock in. Then try sending your data. If your data contains long strings of 1s and 0s, you may need to use Manchester encoding on your data to keep the Rx PLL locked -- hence the popularity of the VirtualWire library (which does the preamble and Manchester [and some error checking too] for you).
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: mauried on Oct 23, 2012, 02:45 am
As above, and the other problem with trying to use a hardware usart with simple radio modules
is that in the absence of any transmission , the receiver outputs continuous random data transitions
which are not at any constant baud rate , and this will cause the usart at the receiving end to continuously
generate overrun and framing errors, which must be cleared before it will work properly.
To do what you want using radio needs intelligent Transmitters / receivers which will simulate correctly a hard wired
connection.
Look at using Xbee modules, some of which can do this.

Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: genn on Oct 23, 2012, 02:05 pm

Thanks for the replies.

Iam using rf reciver which i bought from rhydolabz. 

http://www.rhydolabz.com/index.php?main_page=product_info&cPath=130_131&products_id=386

I tried turning off RF transmitter and switching it on when i want to transmit.It doesnt worked.
I checked whether any errors occuring in receiving side(Framing error, Overrun...) .  No error is there. It seems nothing is coming out from the reciever DATAOUT pin.

Iam not at all receiving any data(no garbage data). Is there any way to figure it out
Title: Re: RF Transmitter and Receiver WRL-10535 and WRL-10533
Post by: fungus on Oct 23, 2012, 02:23 pm

hooked up and walla


Peeve:  It's "voila!" - a French word which needs an exclamation mark after it.

(unless you speak Arabic, in which case carry on...)