Tutorial 9 for Arduino: Wireless Communication


This tutorial was featured on the official Arduino blog on 3/9/2011

This week, we go wireless! We’ll be using a set of arduino Unos, XBee shields, and XBee Transceivers that will create a Personal Area Network (PAN) for wireless serial communication. By the end of the episode, we will be able to turn a potentiometer on one arduino, and have it adjust a motor connected to a another arduino – all wirelessly! I suggest you pick up one of these Sparkfun XBee USB Breakout Boards to get your XBee addresses set up. Enjoy the video :)

Serial.flush() has changed in Arduino 1.0. You can use the following instead:

You can download the files associated with this episode here:

GNU GPL License Distributed under the GNU General Public (Open-Source) License.
Please Attribute and Share-Alike.


  1. +++ OK
    ATMY1000 ERROR000
    ATDL1001 OK
    ATID1111, OK
    WR OK


  2. Hello,

    I am trying to configure two XBee S2 modules to communicate with each other via Ardiono Unos and the XBee Pro shields. My problem is I am new to this and not sure how to configure the XBee modules to talk to each other. I tried using Putty with instruction from Jeremy but I keep getting an error during the ATML1000 configuration portion. (His instructions work great for the XBee S1 but not the XBee S2). I have downloaded the XCTU software but am unsure how to use and the proper procedure to configure S2 modules to talk to each other.

    Any help would be greatly appreciated.



  3. Dear Sir

    Good day,

    I have been working with my colleages on our graduation project and we happened to use the Xbee S1 module and the Arduino Uno microcontroller.

    We wanted to develop a wireless sensor network as follows:

    The laptop will be used as the coordinator(Arduino) and we will have two end devices in two neighbouring classrooms both of which will be composed of an Arduino Uno mounted on an Xbee shield which has an Xbee antenna on top, these end devices have two sensors and two switches respectively.

    We need help in allowing these two end devices to act as transceivers and send/receive the sensor and switch readings accordingly.

    In addition to this, we are thinking of using another end device as an access point or a repeater that receives a signal and strenghens it in order to be received by a further away coordinator.

    Please present us with any ideas or ways to successfully implement these ideas into action.

    Yours faithfully,
    Saleh Helmy

  4. Pingback: Xbee lessons | Gnardo Polo

  5. Hello, Sir Jeremy!
    I was wondering If I could just pull the reset of the arduino to ground instead of removing the chip?
    It was suggested on this video I have an arduino MEGA2560 and an xbee shield but I don’t have an xbee explorer.

  6. i need to send the data from two or more zigbee transmitters circuit to one zigbee circuit ca u help me??

  7. Pingback: Xbee notes | Grimtech

  8. Hello.. I am using digital fire sensor at one xbee and an LED on another ..
    I have done the XBEE commuications using putty as those commands are different from yours because i am using XBEE S2….the commands are..

    XBee 1


    Its done….
    Now will you help me with the CODING part of both the arduino’s & tell me about jumbers on XBEE shield.. should I first keep it to USB and change to XBEE after upload?
    My Codes are:-

    For Arduino and XBEE 1:-

    void setup()

    void loop()
    int no=digitalRead(11);

    For Arduino & XBEE2 :-

    void setup()


    void loop()
    while(Serial.available() ==0);

    Is there any bug? And one more thing, When I am conecting two Arduinos to my laptop, it is giving two com ports but only one selected on both IDE’s
    My two ports are COM13 & COM23…
    either COM13 is selected or COM23
    I always have to select the COM port which is perticular..HELP ME!

    • Hi
      I tried your commands for my XBee S2. But the ATDL command is not working for me. Could you please tell me what the reason may be?
      Ammu Jose

    • For Arduino & XBEE2 :-
      void setup()
      void loop()

  9. Hey Ram,

    I know this a post from two years ago, but I too am having issues with interfacing my ADIS16488 with my arduino. Did you ever get this problem resolved?

    Thank you for your time,

  10. hello jermey
    i am using xbee s2 in AT Mode for sending a byte wireless in TX end i hook up accelerometer ti arduino and then sent a byte correspondingly tilting of accelerometer but RX end i am getting byte with some delay i don’t what’s happening is it kind of buffer overflow or something ??

  11. Hi Jeremy
    I wish to use EZ430-RF2500 for serial transmission of analog values from 5 potentiometers, from the End Ponit target board to the Access point target board, and obtain these values at the respective pins of the target board at receiver end. Is there any way to achieve this? Basically, i want to try substituting XBee with the Ez430 module

  12. hi I am working on control 13 servo motor wireless with potentiometer
    pls send me the correct code

  13. Pingback: Tutorial 09 for Arduino: Wireless Communication

  14. I currently have a similar setup but with 4 dc motors, hardware: 2 arduino UNOs, 2 xbee shields, 2 xbee series 2, 1 motor shield, 4 dc motors, and 1 2 axis joystick, can you help with code to control the motors with joystick wirelessly

  15. Hi Jeremy,

    I currently have a similar setup but with 4 dc motors, hardware: 2 arduino UNOs, 2 xbee shields, 2 xbee series 2, 1 motor shield, 4 dc motors, and 1 2 axis joystick, can you help with code to control the motors with joystick wirelessly. Im not sure where to start. Please help me I cannot find any examples like this online.

  16. Hello, Mr. Jeremy!

    I have some problem with WiFi Bee 2.0 (model RN171-I/NM).
    I have:
    1) Arduino Mega 2560 rev3
    2) Mega Sensor Shield 2.4
    3) WiFi Bee 2.0 shield
    4) usb-cable to connect arduino via USB to computer

    So, I connected Bee to XBee2 port on Mega Sensor Shield and I can’t do any action:
    1) can’t connect to home wifi-network
    2) can’t create an AP
    I need one of this variants to realize connection between PC and Arduino, but WiFly library’s method float WiFly::version() always reports -1.0. I watched the code of library – boolean WiFly::sendCommand(const char *cmd, const char *ack, int timeout) returns “false” because boolean WiFly::ask(const char *q, const char *a, int timeout) returns “false” and so on…

    Google gave me no any usable information, that I can use.

    I will be wery happy to get any advice to fix my problem :-)

  17. Hello there. I am trying to do the same with an uno and a nano board but i have been unsuccessful so far. Do I need a special configuration for nano and uno to talk to each other? (For the nano board I am using an xbee shield offered by Gravitech).

    Thank you

  18. hello sir, plz help me for receiver zigbee interfacing with ardiuno uno r3 and give programe for motor drive

  19. PLEASE HELP!!!! I have two xbee pro s3b high range 900hp radios with two arduino UNOs 1 motor shield controlling 4 dc motors, robot side: xbee s3b with high gain antenna, motor shield, arduino uno with 4 dc motors. My side: xbee s3b 900 hp with high gain antenna xbee sheild arduino uno with two axis joy stick. Here’s what I can’t figure out. How can I control those motors without a computer just a battery powering the arduinos and robots I don’t know how the code looks. I have figured out how to do it serially but I want to cut ties with computer

  20. is there a way i can connect flex sensors to one arduino and have it control servo motors that are connected to another arduino

  21. Can anyone help, I have two xbee s3b 900hp that I am trying to use without computer to control 4 dc motors with a joystick
    2 arduino uno
    2 xbee sheilds
    2 xbee s3b 900hp
    1 motor shield
    1 2 axis joystick

    I am trying to use only battery power to control 4 dc motors through xbees using joystick can some one let me know how to send packets or what is involved in using those types of xbees? Please email me at [email protected] subject xbee

  22. How can I use arduino for ” EN 62056-21 ” .It can be used for reading and programing an meter using a optical probe?

  23. Can more than two XBee’s communicate with each other? The project I have undertaken requires three Arduino based bots to communicate with each other and send and recieve data in the form of text files . Can this be done with XBee or I need to use something else like some other transreciever?

  24. I type +++ but there is no response can any one tell me how to do

  25. Dear Jeremy Blum,
    I’m very glad to meet you, I’m a research scholar, for my project work I need to use the wireless communication system for data tracking from the tractor rear wheels, for that by watching your tutorials I have designed two wireless systems by using Arduino & Two Xbee modules (One as transmitter and other as receiver) for each wheel i.e. finally I have two wireless systems each has One Arduino and two xbee modules and both the systems have been connected to two laptops separately to record the data.

    But its difficult to use two laptops on the tractor, hence we have decided to to collect both the axles data with single laptop, but how to do that I could not understand, basically I’m an Agricultural Engineer…. I request you please help me in this issue.

    Thanks in advance

  26. Hello, thanks for the tutorial. Is there a reason why you don’t use XCTU from Digi to program your XBEE modules? Does that software work with Sparkfun’s XBEE breakout board or does it only work with their own boards? Thanks.

  27. Hi nice information got here, thanks just wondering is it possible to control 5 different servos and send information to a particular servo connected to another device (lilypad to arduino and vice versa) using 2 Xbee??

    Many Thanks for your time

  28. This is a great project! My favorite project with the arduino so far though is by far the home automation project with Arduino Uno and the Ethernet shield to control lights and stuff in your room or house. You can find a simplified home automation project at ( ) It’s a pretty good tutorial and the code is included!

  29. Witam,czy ktoś może mi wytłumaczyć jak prawidłowo podłączyć i skonfigurować modół NRF24L01 z adaptere STC15L204. Siedzę już kilka dni i ciągle mi nic nie działa. Po podłączeniu 2 Arduino kabelkiem wszystko jest wporządku.
    Podaję link do modułu:

  30. Hello, can someone explain to me how to properly connect and configure modół nRF24L01 from the adapter STC15L204. I sit a few days and I still nothing works. After connecting 2 sync cable Arduino everything is okay.
    I’ve included a link to the module:

  31. Nice post about “Arduino: Wireless Communication”. Very informative and helpful. This post is helpful in my arduino project. Thanks for sharing.

Leave a Reply

Required fields are marked *.