Cheap Arduino Wireless Communications

I was looking for a way to handle wireless communications between two Arduino boards. Other options like Xbee or Bluetooth were going to cost $50 to over $100. Then I found a cheap RF transmitter and receiver at Sparkfun. The total cost is only $9!

Here are a few limitations to RF solution:

  • Communications is only one way. If you wanted two way communications you’d need to buy two receivers and two transmitters which would raise the cost to $18. This is still cheaper than other solutions I found.
  • The variable gain on the receiver causes it to pick up lots of background noise. I had to do some processing with the Arduino to filter out this noise. More details about this below in the code section.
  • Bandwidth maxes out at 2400 bps, but there is a version with 4800 bps. A large portion of this bandwidth is used for network protocol I wrote that handles error detection.
  • Range is limited to a max of 500 feet.

The advantages are that it is cheap and it is pretty easy to use.

Below are some images showing how I hooked up the receiver and transmitter to two different Arduino boards. When wiring the receiver/transmitter you only need is to give them power/ground and then a pin for the TX (serial transmit) or RX (serial receive) pin. I also wired a button to the Arduino doing the transmitting, and used the LED on pin 13 that is built into my Arduino boards on the receiver so I could test this setup. The test app just flashes a button on the receiving board when a button is pressed on the transmitting board.

Here’s a picture of the my actual bread boarded circuit.

Code

Since the receiver is constantly picking up random noise I add a few extra bytes to every data packet. I add two bytes to signify the start of a data packet. Then I send the a byte address. This address allows multiple devices to work in the same area without interfering with each other. Next is the data (in my example code it’s an unsigned int (2 bytes). Lastly I send a checksum which is a simple xor of all the data bytes to make sure the data got received without being corrupted.

I broke the Arduino code into two files. If you’ve never used two files before with Arduino all you need to to is keep both files in the same directory and the Arduino IDE merges them for you. Here is the full code for the main application, and here is the full code that does the network error catching.

Increasing the Range

I did all of my initial testing without any of these improvement and everything worked fine with these devices inside the same room.

  • Add an antenna. All you need is a 23 cm piece of wire. I did this and it made it so I could reliably transmit data from one corner of my house to the other (3 floor town house).
  • Increase the voltage for the transmitter. The transmitter can use 2-12 volts. With 5 volts I got pleanty of range for my use case, but increase this if you need more range.
  • Reduce the baud rate. My test app runs at 1200 bps out of the max 2400 bps. You could drop this even further to something like 300 bps and that should help reduce transfer errors and hopefully increase range.

Thanks

I got a lot of help from the transmitter/receiver data sheets, and from this article.

I’ll mention an even cheaper idea I had while doing this. If you will always have line of sight between your devices you could setup something very similar to this with an IR LED and IR transistor. It would work like a TV remote. It won’t work for me because I want this to go through walls, but if line of sight is fine for you then you could use this code and an IR LED/transistor would probably cost under $3.

107 Comments

  1. Pototo said,

    August 31, 2009 @ 12:42 am

    Could you connect the transmitter trough USB, per say, to the computer, and use it as a UART in order to do wireless programming of your microcontroller?????

    thanks

  2. tz said,

    August 31, 2009 @ 2:36 am

    You would need to go from USB to UART. I have the 4800 baud set. On the breadboard next to this computer.

    1. You need to constantly transmit something so the receiver can stop trying to increase the gain.
    2. It can go 2400 (or 4800) baud, but a space (mark?) is the only time there is an RF signal.
    3. You can transmit ANY train of pulses. You could do a 1/3 – 2/3 width modulation, NRZ, PWM, or some of the hard drive RLL codes using the pulse stuff to more reliably transmit data. It appears to have a higher bandwidth/throughput when you do something like this.

  3. x893 said,

    August 31, 2009 @ 2:55 am

    I use TR24A modules (SPI) with 4$ cost per module.
    http://www.spiriton.com.tw/download/TR24.pdf

  4. madsci said,

    August 31, 2009 @ 8:28 am

    You can find similar devices all over ebay – most of which not only have 4 data pins (send a nibble at a time), but come with an encoder/decoder chip to set device-specific channel. By setting the encoder pins directly from the microcontroller, you could increase effective bandwidth by removing addressing (at the expense of 8 I/O pins on the transmitter).

  5. ArduinoHN said,

    August 31, 2009 @ 9:40 am

    I found this ones
    http://www.seeedstudio.com/depot/315mhz-rf-link-kit-p-76.html
    http://www.seeedstudio.com/depot/433mhz-rf-link-kit-p-127.html
    And this one of 2KM range with encoder and decoder
    http://www.seeedstudio.com/depot/2km-long-range-rf-link-kits-w-encoder-and-decoder-p-321.html

  6. reader via hackaday said,

    August 31, 2009 @ 11:40 am

    A very nice blog! Have you considered using lower resolution images that link to the high res pictures?
    Because you’re putting hi-res images directly into the html, it takes a LONG time to load each page!
    If you put up resized (72/96 dpi) images, your bandwidth use will go down and your page loading speed will decrease…

    And yes, I know it seems fast enough to you, but you probably have everything cached. :)

    Anyway, nice work!

  7. Angus said,

    August 31, 2009 @ 7:20 pm

    Nice! Not that there’s anything wrong with rolling your own, but for completeness sake I wanted to point out the VirtualWire Arduino library:

    http://www.open.com.au/mikem/arduino/

    Designed for these same transmitter/receiver pairs, broadcast/receive variable length datagrams in ASK encoding with a simple checksum.

  8. Maurice Ribble said,

    August 31, 2009 @ 7:27 pm

    Angus, someone suggested this solution at http://hackaday.com/2009/08/30/cheap-wireless-for-microcontrollers/. The problem I see is you can’t seem to use hardware UART. Am I missing anything?

  9. the_geek_guy said,

    September 1, 2009 @ 7:26 pm

    I think yo can get a transmitter/reciever pair for $5 at robotshop.com Which may be cheaper.

  10. kevin mcguigan said,

    September 2, 2009 @ 9:31 am

    can you teach me how to write code for the ardunio?

  11. Maurice Ribble said,

    September 2, 2009 @ 10:34 am

    There are tutorials about getting started here: http://arduino.cc/en/Tutorial/HomePage

    You could also ask on this forum for suggestions on how to get started: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl

  12. Paul said,

    September 4, 2009 @ 5:15 pm

    Hello,

    I’m having trouble compiling your code. I combined the two source files into one file (with functions at the beginning of the file). Any thoughts?

    Here is a screenshot: http://71.250.239.19:86/temp.jpg

    Thanks!

  13. Maurice Ribble said,

    September 4, 2009 @ 6:44 pm

    Hi Paul,

    The problem is that you’re using an old version of Arduino (0015). Version 0016 added some new functions to the serial library that I used. I suggest upgrading to 0017 like I used (I believe I mentioned this in the comments).

  14. Paul said,

    September 8, 2009 @ 7:09 pm

    Thanks Maurice. The code now compiles after upgrading to version 0017.

  15. Andres said,

    October 2, 2009 @ 9:37 pm

    Hi Maurice,

    Great code! I just have one question, I want to send an array of bytes. I call the first writeUInt make a small delay, and then call it again to send the next int. The reciever, however, only gets the first number. What am I doing wrong?

    This is the piece of code i’m using:

    if ((prev_button == BUTTON_NOT_PRESSED) && (cur_button == BUTTON_PRESSED))
    {
    writeUInt(271); // Put any number you want to send here (71 is just a test)
    delay(50);
    writeUInt(280);
    }

  16. Maurice Ribble said,

    October 3, 2009 @ 6:08 am

    Andres, that does seem to be strange. I don’t have this setup anymore currently, but I do plan to use this on future projects so if there is a problem like this I’ll eventually hit it and have to fix it. Unfortunately, that doesn’t help you right now. I really don’t know what would be causing this issue and I’m sure I tested something like that. Maybe you’ve found some corner case bug. If you need this solved soon, all I can suggest is trying to debug the problem yourself by looking at what data is being send and what data is being received. Do you have access to a second set of hardware to verify that’s not the problem?

  17. Michael said,

    October 10, 2009 @ 7:41 pm

    Hi Maurice,

    I opened RFDriver.pde on Arduino 0017 and it tells me that

    ” The file “RFDriver.pde” needs to be inside a sketch folder named “RFDriver”. Create this folder, move the file, and continue? ”

    So I press ‘OK’ and it moves it into it’s own folder, same thing with RFLink.pde

    Then when I tried to compile the code and upload it, it says that there is an ‘Error compiling’.

    o: In function `main’:
    E:\Arduino\Arduino Sketches\RF_Link\RFDriver\applet/RFDriver.cpp:90: undefined reference to `setup’

    E:\Arduino\Arduino Sketches\RF_Link\RFDriver\applet/RFDriver.cpp:93: undefined reference to `loop’

    Any idea what’s going on?

  18. Maurice Ribble said,

    October 11, 2009 @ 6:33 am

    You should create a folder called RFLink and put both RFLink.pde and RFDriver.pde in that folder. Then from the Arduino gui open RFLink.pde. This should basically markRFLink as the project and you can then open supporting files like RFDriver from this RFLink project. If you keep having trouble you can just move the code from both of these files into a single file.

  19. cjgaus said,

    October 14, 2009 @ 9:21 pm

    I have a arduino mega. Will the code still be the same for the receiving? If so i only have a basic stamp and a arduino. How could i transmit on the bs2?

  20. Nick said,

    October 16, 2009 @ 1:07 pm

    I have this type of transmitter set up with a PIC micro talking to another PIC micro. On the receiver end I used a comparator op-amp with a pretty high voltage reference of 4 volts. This makes for a much cleaner data signal to the micro. Using Asynchronous communication you need to sync up the reciever to the transmitter. I used Hex 0×55 because it gives an even number of oneses and zeroses (as one of my old instructors used to refer the them as) . Then I send the data byte, then the checksum byte. The checksum is just Here is an example of basic reciever test code I used:
    Using some sort of system (checksum or what have you) to filter out the junk.
    Hope this helps some people out with these nifty toys!

    *******************************************************************************************
    #include
    #fuses NOWDT, NOPROTECT, NOBROWNOUT, NOLVP, NOPUT
    #use delay (clock = 8M)
    #use rs232(uart1, baud= 2400, xmit=PIN_A2,rcv=PIN_A3, Errors)
    char first = ‘z’;
    char second = ‘z’;
    char third = ‘z’;
    char data = ‘z’;

    void main(){
    printf(“Hello!\r\n”);
    while(1){// the forever loop
    //////////////////reset data/////////////////////
    data = ‘z’;
    first = ‘z’;
    second = ‘z’;
    third = ‘z’;
    ////////////////////////////////////////////////////

    if (!kbhit()); //Waits until the UART receives a byte
    first = getc(); // Takes the first byte after it is received and stores it in variable first

    if (first == 0×55){ //if the first byte is equal to the start byte, continue…
    second = getc(); //recive data
    third = getc(); //recieve checksum
    if (first + second == third) data = second;// only accept the data as valid if the received data + 0×55 is
    //equal to the received checksum byte (simple)
    }

    printf(“%c, %c, %c, %c \r\n”, first, second, third, data); // outputs recieved bytes.

    }
    }

    *******************************************************************************************

  21. Paul said,

    October 18, 2009 @ 12:21 pm

    Maurice,

    Do you see any way for the receiver to be connected to an Arduino board at the same time as an ethernet shield? I tried a work-around ‘soft serial’ solution, but it seems messy and not very reliable. Thanks in advance for your input!

    Paul

  22. Maurice Ribble said,

    October 18, 2009 @ 1:51 pm

    I presume the ethernet shield uses the hardware gart? If that’s true there are a few solutions.

    1) Software Serial. I’ve used this and as long as you structure your code so you can keep polling for a transmission and there is nothing too CPU intensive this works fine.
    2) You could use put a switch controlled by a different pin that selects whether to use the ethernet shield or the radio receiver. There are lots a different switch options, but two 5 cent transistors would be the cheapest digitally controlled switch.
    3) The Arduino mega has multiple hw garts and could run both that the same time.

  23. Andres said,

    October 21, 2009 @ 11:15 am

    Do you have any references for antennas? I’ve been using a simple cable antenna, but I’m building a nice prototype and can’t use a cable antenna. I’ve tried using radio antennas, but they don’t seem to work. I’m not looking to extend the range that much, ~100 meters is fine, but I do need a nice antenna to fit in a small platic case. Any ideas?

    Thanks!

  24. Maurice Ribble said,

    October 21, 2009 @ 11:40 am

    I used a 23 cm piece of wire. This seemed to work pretty good for me. You can try this and if it’s not good enough then look for a better solution.

  25. Bryan said,

    November 11, 2009 @ 2:52 pm

    When compiling it throws the following flag associated with the line that reads “writeUInt(271);”

    In function ‘void loop()’:
    error: ‘writeUInt’ was not declared in this scope

    Any ideas how to fix this compiling error? Thanks!

  26. Anonymous said,

    November 12, 2009 @ 7:08 am

    It sounds like your project only has the RFLink.pde file above and not the RFDriver.pde file. If you are having the multiple files working feel free to copy and past the functions you need from RFDriver into RFLink.

  27. mo said,

    November 21, 2009 @ 5:39 pm

    Hi ..
    thanks for the tip…
    i just have some questions:

    on the transmitter side: what is the DATA transmitted? is it bitwise Data or bytes or what exactly? like sending 10101010… and so on?

    on the reciever side: will i do have to read it out as a bus? how will the data arrive ?

    just one question:
    what if i dont have the Arduino board ?
    i just need to send an array of binary bits and recieve them on the other side and show them on a lcd?
    is it possible with those boards?
    thanks in advance

  28. Maurice Ribble said,

    November 21, 2009 @ 7:20 pm

    The software sends the data one byte at a time, but it is a serial connection so at the hardware level it is one bit at a time.

    You don’t need Arduino, but you will need some sort of microcontroller. You need something to run a driver for the LCD and you need something to do the noise filtering that I did in the software for this project.

  29. Cliff said,

    January 11, 2010 @ 7:00 pm

    Hi,

    This is a beginner question, so please bear with me. Why do you need the resistor in your circuit for the transmitter?

    Thanks,

    Cliff

  30. Maurice Ribble said,

    January 11, 2010 @ 7:56 pm

    It’s being used as a “pull up resistor”. This is a common use for a resistor. The purpose is to limit current. If that resistor was not there then pin 2 on the Arduino would die a quick death because of too much current.

  31. Jimmy said,

    January 13, 2010 @ 6:30 am

    Hey Maurice! This is really a great blog! (I also liked the turning on/off lights with arduino, plus the photography stuff is amazing, although It reaches away from my level…

    I was wondering what kind of antenna would be suitable for this. I’m working on a “real” project and can’t just stick a wire there, I need to use some kind of antenna. I saw this at sparkfun, would this work? In the description it talks about being careful with what connectors you use and something about damaging other stuff. Do you know something about that?

    http://www.sparkfun.com/commerce/product_info.php?products_id=145

    Thanks, I appreciate your help.

    Jimmy.

  32. Alex said,

    January 22, 2010 @ 5:44 pm

    Hi,
    does the connection work without the error catching?
    because I tried but nothing work…
    Thanks

    Alex

  33. Maurice Ribble said,

    January 23, 2010 @ 7:22 am

    Hi Alex,

    No, it won’t work without error correction. Since these modules are variable gain they will create noise when there is no signal. So without the error correction the receiver will read a bunch of noise.

  34. Alex said,

    January 23, 2010 @ 3:32 pm

    Ok thanks, I’ve another question:
    Is it possible to create a loopback interface? I mean, to connect the TX pin of the arduino to the Transmitter and the RX pin of the same arduino to the Receiver just for debugging.

  35. Cliff said,

    January 24, 2010 @ 9:49 pm

    Hi,

    I tried this on my own, and have it working. Great tutorial!

    One thing I am not clear on is this line in the writeUInt function:

    Serial.write(0xF0); // This gets reciever in sync with transmitter

    Why is this required? Where does 0xF0 come from?

    Thanks,

    Cliff

  36. Maurice Ribble said,

    January 24, 2010 @ 10:36 pm

    Alex, I’m not sure what you mean by debugging, but in general you can attach output pins to input pins as long as you have a resistor there to limit current.

    Cliff, glad it’s working for you. I found that I needed to send a byte here for reliable transmission or the transmitter/receiver weren’t always in sync when real data started. I chose this value because in binary it gives a two nice pluses (0b11110000). Many other values should work here too.

  37. Cliff said,

    February 6, 2010 @ 9:26 pm

    Thanks for the responses! I wanted to try this out with another Arduino, so bought an Arduino Pro 328 from Spark Fun. My first attempt with the Duemilanove word fine with my Serial.print(“Test Data”) being received. When I hooked the same circuit to the TX of the Pro, I did not receive the message, but had garbled text appear at the intervals I expected my message to be sent. In both cases the receiver is the same, the Sketch is the same, the transmitter circuit is the same, even the power source is the same. I only moved the wire from TX on one Arduiono to TX on the other.

    Does anyone have any ideas why this owuld be different between Arduinos? I also tested that the Pro can send correct data to the PC through the USB, and that was OK, so TX works in general.

  38. Michael Mol said,

    February 15, 2010 @ 5:08 pm

    You should look into using a form of ECC; rather than simply detecting errors, you can potentially correct them.

    Just a thought.

  39. Kevin said,

    March 9, 2010 @ 11:01 am

    Hi there,

    This article has been very helpful.

    But, I was hoping someone could help me.

    I plan using a potentiometer on one of the analog input pins on the arduino, I then will map the value to a value between 0-255 from 0-1023.
    Something like this:

    POTVAL = analogRead(POTPIN);
    PWMVAL = map(POTVAL, 0, 1023, 0, 255);

    I wish to then transmit the 0-255 value through one of these transmitters.

    On the receiver end I want to use the 0-255 number on one of the PWM pins.

    I am unsure how to adapt your code for my purpose.

    Can I just do something like this?
    Obviously this isn’t the whole program, just an idea.

    Transmitter:

    POTVAL = analogRead(POTPIN);
    PWMVAL = map(POTVAL, 0, 1023, 0, 255);

    writeUInt(PWMVAL);

    Receiver:

    Val = readUInt(true);

    analogWrite(PWMOUT, Val);

    I have had a look at things like VirtualWire and Hypercon but both are a bit too complicated I think and the other problem with VirtualWire is that it sends character strings and I am also not sure how to get that to send just 1 byte of my information.

    Thanks for any help in advance.

  40. Maurice Ribble said,

    March 9, 2010 @ 10:35 pm

    Bruce sent me this fix. Thanks Bruce!

    In the processing filter code:

    m_data[m_endIndex] = getVal(indx)*.5 + val*.5;
    should be
    m_data[m_endIndex] = m_data[indx]*.5 + val*.5;

    Otherwise the current value is smoothed with values from the
    beginning of the array which introduces a rather cool and convincing
    oscillating effect (It’s also visible on the video).

  41. Cory said,

    March 16, 2010 @ 8:05 pm

    Does anyone know how to write the code for a BasicX microcontroller?

  42. Jimmy said,

    March 22, 2010 @ 4:55 pm

    Hey there Maurice,

    Some time ago I posted a comment here and I’ve been checking out for a while and haven’t received an answer.

    http://www.glacialwanderer.com/hobbyrobotics/?p=291#comment-5155

    Could you comment on that please? If you don’t know or whatever it’ll be just fine with me, I just wanted to make sure you wouldn’t miss it.

    Thanks!

    Jimmy

  43. Maurice Ribble said,

    March 22, 2010 @ 5:20 pm

    Cory, I have never done code for the BasicX so I can’t help with that. Perhaps you could find a forum for BasicX for help or you could work on the port yourself. Sorry I can’t help more.

    Jimmy, sorry I didn’t respond to your first post. I’m pretty sure that antenna won’t work because it is made for 2.4 Ghz. You want to find an antenna that is made for the frequency of your receiver (315 Mhz for the one I used). I don’t follow what they are talking about at damaging antennas with male connectors.

  44. Chris said,

    March 23, 2010 @ 9:08 am

    Hi,

    Im just trying to get the basic circuit working but im pretty confused with the code files. Im not sure what you mean by just having them in the same directory, am I uploading them to the board separately? and am I right in thinking both files need to be on both boards?

    Thanks

  45. Chris said,

    March 23, 2010 @ 9:10 am

    Sorry i forgot to mention its the ‘merging’ bit im really clueless on. Im just not sure how i go about this

  46. Jimmy said,

    March 23, 2010 @ 9:16 am

    Great cheers man! Your blog is absolutely GREAT!

  47. Chris said,

    March 23, 2010 @ 9:54 am

    Ive sorted it! :D

  48. Maurice Ribble said,

    March 23, 2010 @ 10:13 am

    Glad you figured it out Chris. If people just try things out the solution should be become evident by looking at compiler warnings. If you’re really confused you can just combine the two files into one and everything will work.

  49. Chris said,

    March 23, 2010 @ 2:08 pm

    Yer thats usually the case. I havent got it working yet tho, i think it might be my wiring.. the receiver seems pretty straight forward but im a bit of a novice and finding it tricky to work out the transmitter, i tried to copy the photo and follow the chart but not luck as yet. there isnt a breadboard layout sheet of this is there?

  50. ovidiu said,

    March 26, 2010 @ 2:07 am

    Great stuff!
    Can this schematics function properly : Arduino + rf receiver on one side and the transmitter alone on the other side (like a remote controller) ?

    Thank you

  51. mick said,

    March 29, 2010 @ 11:19 am

    Am i right in thinking that all you need to change in the code is which variable you comment out for the relative board? thanks

  52. Francis said,

    April 1, 2010 @ 4:53 am

    Hey ,

    Really great tutorial, love this kind of practice…

    But still a big question for me, if anybody can answer this it could be really helpfull.

    There’s a line with :

    const byte g_network_sig[NETWORK_SIG_SIZE] = {0x0F, 0xAA, NET_ADDR}; // Few bytes used to initiate a transfer

    and then :

    Serial.write(g_network_sig, NETWORK_SIG_SIZE);

    Can anybody explain why we use that, and why it doesn’t really work correctly if we remove it from the read and write method ???

    Thank you very much !!!

    Francis

  53. Calgar C said,

    May 1, 2010 @ 3:46 pm

    would it be possible to use this system to wirelessly control a dc motor. for instance if i have a motor sheild and i want the arduino to wirelessly send information so i can control the motor from a distance.

  54. Manuel said,

    May 4, 2010 @ 3:56 pm

    I attached the output from a Parallax PIR(http://www.parallax.com/dl/docs/prod/audiovis/pirsensor-v1.2.pdf)into the transmitter..and the receiver to my Arduino. I’m basically trying to create a wireless motion sensor. The PIR goes high if triggered then sends the signal through the transmitter…arduino receives it and does something.A basic HIGH OR LOW scenario. I’m having a problems..it seems the signal won’t transmit right…any advice.I use a Serial.begin(9600)….do I lower that?

  55. John said,

    May 22, 2010 @ 9:39 pm

    This is great. I’m new to Arduino. Big question here?
    Can I use this setup and add servos (4) to the recieving Arduino and run them wireless?
    I’m looking for a easy way to control a RC Robot and pan/tilt camera.

  56. Phil Dupuis said,

    May 29, 2010 @ 4:39 pm

    Hey Maurice,

    You’ve got an incredible write-up here. I just have a few questions.
    I have the same setup that you have, 2 arduinos, one hooked up to the tx and the other to the rx.
    I hooked up the wires exactly as you did.

    1. You mentionned you broke the Arduino code into two files and how the Arduino IDE merges them for me. I may be totally off, but does that mean you write this code to both arduinos? I’m trying to understand where I put the code that does the network error catching?

    2. I tried putting this code to one of the arduinos and it came up with an error.
    under the receiver section
    if (readUInt(true) == 271) // Check to see if we got the 71 test number
    {
    an error comes up, it says:
    In function ‘void loop()’:
    error: ‘readUInt’ was not declared in this scope
    I’m using Arduino 0018 so it’s not an older version, but maybe it’s how I’m not applying the other code you have.

    Can you help?

  57. Heyarnold said,

    June 6, 2010 @ 4:59 pm

    When you call the “readUInt” function does it stay in this loop untill it reads good data from the rf link?

  58. Maurice Ribble said,

    June 7, 2010 @ 5:00 am

    Phil,

    1) In the code there is a “#define TRANSMITTER” and a “#define RECEIVER”. Depending on which of these is enabled determines if you are compiling the code for the transmitter or receiver.

    2) The readUInt() function is defined in my other file. You need to make sure this file is in the same directory as the other one you”re using for this project. http://www.glacialwanderer.com/_blog/blog2009/08_August/RFDriver.pde

    Heyarnold,

    Yes, it won’t return until it finds a valid signal. If this is a problem for your project it would be possible to use interrupts to remove this condition, but that makes the code much more complex and I didn’t want that complication since this was good enough for my needs.

  59. Arduitter said,

    June 8, 2010 @ 9:13 am

    Hi, could i connect the transmitter to a PC USB port? So i wouldn’t have to use another Arduino. Probably i’m going to need a driver so my OS can recognize it. Have you ever done anything like this? Thanks in advance.

  60. Jordan Cobb said,

    June 21, 2010 @ 9:48 am

    I am trying to use this code and the same hardware in my project.
    I believe I am transmitting correctly. I have a diagnostic LED hooked up and it flashes when I send data.
    I have the above set up running on its own arduino.

    When I hook up the receiver by itself (as in not hooked up to the arduino RX pin) and I put an LED from the receivers data pin to ground, I can see that it flashes at exactly the same time as the transmit led flashes on the transmitter. However, when I connect the data pin on the receiver to the RX pin on the arduino duemilanove the led comes on and stays on. I read the voltage with my meter and it appears to constantly be high at 5V. I removed the USB cord and the RX pin still stays high.

    How can I get this to work if the RX pin is always high on the arduino?

  61. Aaron said,

    June 27, 2010 @ 2:17 am

    Hi there,

    I got your example working. Thank you very much for this.

    I had a general question about communicating with multiple arduinos, a situation with one base arduino station, and several arduinos that are taking some measurements. I’m imagining I would like to have all of these other devices communicating with the base station the data that they observe. But is there a way to handle this properly? Do ihave to do some sort of time sharing to tell who can send what and when?

  62. fabrizio said,

    July 21, 2010 @ 5:34 am

    Hi there,
    very nice work! I’m a professional photographer and i want to adapt this setup to use it to trigger remotly canon DSLR cameras on a long distance up to 1000 meters. is it possible to trigger with one transmitter more than one receiver? is it possible to code the signal to have a secure connection between transmitter and receiver to avoid interferences by other transmitters?
    anyone have experience with long range wireless remote trigger based on Arduino?
    Is it possible to use one unit as transceiver?
    i need to operate the unit on 433mhz or 868mhz or 2,4ghz.
    doese anyone found something similar on the web?

  63. Maurice Ribble said,

    July 21, 2010 @ 5:40 am

    For 1000 feet this solution probably won’t work. I suggest looking into xbee.

  64. Mohammad Islam said,

    August 29, 2010 @ 5:26 am

    I have made a arduino wireless joystick that almost work like yours. It has error checking features too. The only issue I had was slow data transfer rate and data loss. I should have used higher voltage for transmitter, as it increases baud rate and range as well.

  65. Raphael Cerqueira said,

    October 17, 2010 @ 10:49 pm

    I think you would like to see your work being used.

    http://arduitter.blogspot.com/2010/10/rf-links-reliable-messaging.html

  66. Maalik said,

    November 2, 2010 @ 8:10 pm

    Very nice work.

    Can u help me out plz?
    I want to communicate b/w two arduino devices, sending and receive voice on both ends, using internet.
    Plz help me out this is wut i have to make and I dont know anything how to do this.
    I am using two of 328 arduinos and two of the ethernet sheilds. :-(

  67. Maalik said,

    November 2, 2010 @ 8:11 pm

    you can email me on athar-malik@live.com
    Regards.

  68. lu said,

    November 3, 2010 @ 4:35 am

    hi,
    would like to know,

    will this setup work if i were using a Bluetooth module on d Transmitter side as well as an Arduino BT on the receiver side?

  69. Maurice Ribble said,

    November 3, 2010 @ 6:40 am

    Lu, the whole point of this code is to include some basic error correction. If you are using bluetooth that includes error correction in the protocol so there is no need for this code. With Bluetooth things would be much simpler.

  70. Jun said,

    November 10, 2010 @ 2:39 am

    got a question. I’m trying to modify your code so that it sends 5 int when swtich is on.
    I listed the writeUInt inside if statement, but it doesn’t work. It does random data.
    if ((prev_button == BUTTON_NOT_PRESSED) && (cur_button == BUTTON_PRESSED))
    {
    writeUInt(year);
    writeUInt(month_i);
    writeUInt(day_i);
    writeUInt(hours_i);
    writeUInt(mins_i);
    }
    Any suggestion?..(I tried to use counter and delay to do this because I thought it takes time to transmit data.., but it still doesn’t work.

    I will really appreciate for any suggestion.but plz be specify or give me code because I’m pretty new to this..

  71. Eric said,

    March 26, 2011 @ 9:30 pm

    Can you use multiple transmitters (stationed in a fixed location) and a single receiver to calculate the exact location/trilateration?

  72. Maurice Ribble said,

    March 27, 2011 @ 5:18 am

    Eric, not with this hardware. To do the basic solution you’d need to have hardware in the ghz range and even then it wouldn’t be accurate (you can calculate how accurate easily yourself by remembering radio waves travel at the speed of light). To get good results you’d need to measure phase shift like the GPS systems do.

  73. sathish said,

    June 13, 2011 @ 1:13 am

    could any 1 help me.. am using lin ic1021 and want to show the data transmission between two microcontrollers using this ic. also im having the two set of arduino board and two lin ic TPIC1021. shall i use the arduino as mc n how can i show the data transmission using the sources if possible send the code for data transmission and reception. am beginners to this embedded…

  74. Ron said,

    July 14, 2011 @ 11:02 am

    Can this communication be used under water? One device out of the water the other in water (public pool size)?

  75. Maurice Ribble said,

    July 16, 2011 @ 11:11 am

    Ron, this won’t work under water. Communicating under water is a fairly complex problem unless you buy an expensive fully designed solution. I suggest using a search engine to research this.

  76. Joshua said,

    September 5, 2011 @ 9:44 am

    Hello,

    you know how can I do to transmit sound from one side to the other?
    I want to send music from a transmitter to the receiver.
    I want to connect a speaker on the receiver to output the sound.
    How is code for the arduino?
    Thank you.

  77. saumendra said,

    September 26, 2011 @ 7:06 am

    Hai,
    good evening

    can i use this for my audio/video signal transmission for 2 km?

    if so tell me where can i buy this an price pls.

  78. Maurice Ribble said,

    September 26, 2011 @ 8:51 am

    Did you read the article? It has a range of 500 ft and a baud rate of 9600 bps. Both of which exclude your use case.

  79. metody said,

    November 21, 2011 @ 8:24 pm

    hallo, my english is so bad, but try to help me please.
    i will try to do some follow focus for dslr camera.
    i need to copy potentiometer rotate via tx/rx to stepper.
    i have
    - 2x arduino duumillanove
    - 430mHz tx rx system model kxdjs20021
    - h-bridge
    -potentiometer 10 k
    i did tried to compile codes from many tuttorials , but…..i am camera operator :)
    do not know about programming…..
    many thanks for help…
    metody

  80. tedrobotbuilder said,

    January 21, 2012 @ 10:11 pm

    Could these be used as a beacon? Could you get range and direction with the receiver for the position of the transmitter?

  81. Maurice Ribble said,

    January 23, 2012 @ 7:44 am

    I’m not sure if these could be used as a beacon. In theory they probably could, but this would be extremely complicated and require other very high speed components. It would be like creating a local GPS system. The problem is these signals move at the speed of light so timing is extremely critical.

    Since you had to ask this question I’d say that practically the answer for you is no. I’m not aware of anyone in this space who has done something like this. Using sound is much easier than using light and that’s still a difficult problem.

  82. xepe71 said,

    January 24, 2012 @ 10:48 am

    Hi Maurice, thanks for this post. I am wondering if I can use this system to remote control a (slow) electric model boat (one way Tx is ok, 500ft is more than I will ever need, CRC check and multiplexing will do the rest). Or do I need to go Xbee?

  83. locost-se7en said,

    February 10, 2012 @ 4:43 pm

    the guy who coded this is flipping brilliant. worked first time, no problems. I have now seen the light or should I say RF and am now sending all sorts of data across this link. Thanks :)

  84. Karol said,

    March 11, 2012 @ 5:04 pm

    I wrote part of a program to stabilize the flight flying wing, but the response time is too long. I guess wrong reading the signal from the transmitter.How to reads the PWM signal? Servos work too slowly. Please help because no one has been able to help me on my university. where is the error? I have no idea. I do not know anyone who would be able to help me. Please answer the mail for more info

    shymano666@wp.pl

  85. Aritra said,

    March 14, 2012 @ 6:54 am

    The program and circuit worked fine, but when I press the switch (and release it readily), the receiver LED blinks 13 times before stopping. I increased the delay in LED blinking in the receiver link code to 2s, this reduced there blinking to 10 times. Isint is supposed to blink only once when the switch is pressed?

  86. Sri said,

    March 16, 2012 @ 5:50 am

    Hello!

    For my project, I am trying to run a dc motor with respect to the signal from a piezo sensor. For this I had to go wireless, and so i used RF Link transmitter and receiver. I have referred to the code from this website.

    This code was working. Then when I connected the piezo sensor circuit to the transmitter, and the dc motor circuit receiver, the dc motor dint work for the signal from the transmitter. To check whether the transmission and receiving works, i replaced the dc motor circuit with LED, and LED responded to the signal being transmitted.

    So, I feel there is something wrong with my dc motor circuiting to the receiver.

    I dont know how to post in this. The pic of my circuit, and my arduino code is here:

    http://arduino.cc/forum/index.php/topic,96900.msg726989.html#msg726989

    Could someone please help me, and tell where I have gone wrong, and how to rectify it?

  87. shashank said,

    April 7, 2012 @ 11:45 am

    hey i wanted to use this wireless rf module .. but have no clue hw to proceed… what kind of signals are exaltly transmitted thriugh the transmitter ???
    n btw how to select the pair ??? i use arudino ,,!

  88. craig said,

    May 2, 2012 @ 9:05 am

    tried this code and works perfectly but when i remove power it loses the program, any ideas ?

  89. Sean Duffy said,

    June 1, 2012 @ 11:57 am

    Thanks for the tutorial, really helpful stuff! This could be used for a ton of different projects and applications.

  90. ajay kumar said,

    July 12, 2012 @ 9:50 am

    Hi All,

    Actually i’m planning to make a project of using Arduino to ON/OFF an electrical motor using a mobile phone. Please let me know if this is possible to using Arduino, if possible which version of Arduino should i purchase. Please also help me in executing the project.

  91. Ramila said,

    July 23, 2012 @ 11:41 am

    Can I get a basic arduino program to check this device? Because I’m new to arduino

  92. Rui7 said,

    July 31, 2012 @ 7:20 am

    Hi all,

    Im building a project that will involve controlling a car wirelessly using values detected from an accelerometer.

    My plan is to use 433MHz RF link modules for the radio control. An accelerometer and arduino UNO on the tranmitter side and an arduino and servo motors on the receiver side.

    Let’s say I am driving the RC car forward and want to turn left, so I tilt the accelerometer left. I want this movement processed fast so the car turns when the accelerometer is tilted.

    Example,when the accelerometer tilts left the y axis will go from 2.5V to 2.6V. The uController will register this as a left movement, by 0.1V. This has to be packetised, transmitted, received, depacketised and sent to the motor/servo. Lets say all of this has to happen within 500ms in order to feel realistic. So what do I need to consider? Where are the bottlenecks? What are the workarounds?

    The accelerometer outputs an analog voltage. This is input to the uController, converted to digital (ADC), processed (software), sent to transmitter, transmitted, received by receiver, sent to uController, processed (software), converted to analog or PWM (DAC) then sent to the motor/servo. What are typical times for each of these operations? How can they be measured? Which of these stages is the critical stage?

    thanks,

    Rui7

  93. stilten said,

    August 8, 2012 @ 2:52 pm

    hi, i was wondering if the transmitter and the receiver have to be facing each other to transmit. i am building a robot so that would not be possible. also, why are encoders and decoders necessary?

  94. Peter said,

    August 20, 2012 @ 1:22 am

    Hi

    Thanks for so nice software, work great!!
    just one question. I have the same problem as Andres (write October 2, 2009 @ 9:37 pm) if I want to sent two int to the receiver the transmitter only sent the first value or the receiver who only get the first value.
    like in this code.

    if ((prev_button == BUTTON_NOT_PRESSED) && (cur_button == BUTTON_PRESSED))
    {
    writeUInt(271); // Put any number you want to send here (71 is just a test)
    delay(50);
    writeUInt(280);
    }

    the receiver get the test number 271, but not 280.
    has anyone solve what issue or have another solution for the problem.

    I can read that Jun (Write November 10, 2010 @ 2:39 am) have the same problem.
    and now also me.

    Best Peter

  95. Yoon said,

    August 21, 2012 @ 10:28 pm

    Question!
    Can i transit and receive analog value (such as stepmotor control) with this RF cheap?

  96. Anuj said,

    August 30, 2012 @ 12:57 am

    I want to send data from 1st arduino Uno using a keypad wirelessly to another arduino Uno to get it displayed on LCD.Please suggest ways or any tutorials….thanks

  97. tzuki said,

    September 15, 2012 @ 3:01 pm

    hey
    right now the code does not work
    i’ve changed the code a bit to send a transmission every second

    #ifdef TRANSMITTER
    void loop()
    {
    delay(1000);
    writeUInt(271); // Put any number you want to send here (71 is just a test)
    digitalWrite(led, HIGH);//transmitting
    delay(1000);
    digitalWrite(led, LOW);
    delay(1000);

    }
    #endif //TRANSMITTER

    i’ve also tried to connect the RX/TX directly via wier, and still nor respons
    any ideas ?

  98. Willer said,

    December 14, 2012 @ 1:50 am

    I was thinking of doing wireless flash trigger.
    yes, you can buy wireless flash trigger from ebay that connect on with your camera to trigger the flash. but what I am expecting is some kind of flash trigger that trigger by sensor like motion tracking, laser and sound.

    anyone have idea how fast the wireless module can transfer the data?

    usually camera shuttle having speed of 1/160 (6.25ms) when flash is turned on

  99. Anthony said,

    December 21, 2012 @ 3:15 pm

    So of I keep one arduino plugged into my computer and give it a command the other will do the same?

  100. Borat said,

    January 3, 2013 @ 2:37 pm

    Can this also transmit audio rather then data packages? Use it for creating wireless speakers.

  101. Jorge Solis said,

    April 9, 2013 @ 12:03 am

    I am doing a school project using a LED matrix and i have the Matrix code, but i was wondering how can i put it on the first Arduino and use the transmiter to send the code to the receiver ( the LED will be plugged to the second Arduino) . Any help will be useful. :)

  102. Jayakarthigeyan P said,

    April 16, 2013 @ 10:21 am

    Is possible to receive data from two transmitters by a single receiver at the same time…? I tried doing it… can I give a unique id for two transmitters… I just want two arduino’s used as tramitters and one arduino as receiver… totally 3 Arduino’s working together…

  103. Mauricio said,

    May 1, 2013 @ 4:13 am

    Fakes, counterfeits, generic pills are all the same content they’ve grown to love, plus a lot more customization available now! But not all its effects may be quite so worried about its future. Child support is always a bad idea, look no further than the April issue of BJU International. I actually handed out a number of alternatives to filter the stream. Prescriptions are necessary at several outlets while others do not charge separately for this service while others do not insist on them.

  104. Chong Han said,

    May 24, 2013 @ 3:46 am

    Hi~ is it possible i use it to do messaging application?
    sending a string of message to other to receive using cheap RF module

  105. yulia retno said,

    June 7, 2013 @ 12:12 pm

    hello, tengs for the tutorial , it helped me so much,
    but I want to ask,,
    when I supply my board with battery, it doesn’t want received, but If I connect supply with usb cable, it’s works,,
    can you explain me why ?
    tengkiu anyway
    plisss, answer my question T__T

  106. tafsir alquran said,

    August 18, 2013 @ 3:29 am

    What’s up Dear, are you truly visiting this site regularly, if so then you will definitely obtain fastidious know-how.

  107. Usman Saleem said,

    October 18, 2013 @ 4:54 am

    What are the different frequencies generated by the transmitter on pressing A B C D ?

RSS feed for comments on this post