Need Help on Programming Arduino Xbee+Explorer

Hi there.

I have just bought these things

1- Two Arduino Duemilenove(ATMEGA 328)

2- Two Xbee Shields

3- Two Xbee Module Chip

Now my simple task is to pair them and make the communication between them possible.

Here is my Arrangement

Arduino Connected to Xbee Shield and Xbee Chip is connected to Xbee Shield

Alright now i have two pairs of above arrangement and i want to send some String data from one pair and want to receive that String on the other pair using Zigbee, how can i do that? Is there something else i need?

How have you configured the XBees?

What code do you have on the Arduinos?

If the XBees are properly configured, and the jumpers on the shields are in the right positions, sending data out from one Arduino is simple:

Serial.print("<Hey there>");

Receiving it on the other end is equally simple.

char inData[64];
byte index;
boolean started = false;
boolean ended = false;

void loop()
   while(Serial.available() > 0)
       char aChar =;
       if(aChar == '<')
           started = true;
           index = 0;
           inData[index] = '\0';
       else if(aChar == '>')
           ended = true;
       else if(started)
           inData[index] = aChar;
           inData[index] = '\0';

   if(started && ended)
       // Use the value now in inData for whatever

       // Get ready for the next time
       started = false;
       ended = false;

       index = 0;
       inData[index] = '\0';

OK, receiving is not as simple as sending, but it is straightforward.

Thanks for the reply, but this is my first time working with Arduino+Zigbee, so dont know much about the configuration, can you please throw a little light on how to do that? Some link may be??


Well they come configured ready to use out of the box. So you dont have to configure anything except perhaps the jumpers on the xbee shield. You just use them like a Serial port. I presume the xbee shield wires them to the pins 0 & 1. Just try out the code given by PaulS and glow a LED at the receiving end if what you send matches what you receive. to start with try sending a single character.

You can use the X-CTU program (on Windows) to configure the XBees. The things that need to be set are PAN ID, MY, and DL. PAN ID is any value you like; set the same value on each XBee. MY and DL are complimentary. MY on one equals DL on the other. Any value can be used for MY and DL. I like 8001 and 8002.


Well i am a bit confused now, as you said the devices come configured out of the box and PaulS recommending a software to configure the devices, so i am left in a fog of confusion.

So let me rephrase the question.

Do i need to configure Xbee devices before using them?

Out of the box, any XBee can talk to any other XBee.

To get your two XBees to talk only to each other, such that no other XBees can interfere, you need to change a few values.