Introduction: XBee Adapter

About: All-original DIY electronics kits - Adafruit Industries is a New York City based company that sells kits and parts for original, open source hardware electronics projects featured on www.adafruit.com as well a…
Simple wireless communication: An XBee wireless modem adapter that doesn't suck!

XBee modems are one of the easiest ways to create a wireless point-to-point or mesh network. They have error correction, are configured with AT commands, come in multiple flavors and can create a wireless serial link out of the box! I wanted to make a wireless Arduino project but all the adapter boards on the market made me unhappy. So I designed what I think is an excellent low-cost adapter board.

  • Yes it can act as a breakout board, but it also has....
  • Onboard 3.3V regulator to cleanly power your XBee, up to 250mA
  • Level shifting circuitry means that its trivial to connect it to 5V circuitry such as an Arduino without risk of damage
  • Two LEDs, one for activity (RSSI), the other for power (Associate)
  • 10-pin 2mm sockets included to protect the modem and allow easy swapping, upgrading or recycling
  • All the commonly used pins are brought out along the edge, making it easy to breadboard or wire up
  • For use with any XBee/Pro pin-compatible module
  • Specifically created for use with an FTDI cable to connect to a computer via USB. This means that you can use, configure or upgrade the adapter painlessly simply by plugging in a cable:

Perfect for wirelessly communicating with a microcontroller project.

Step 1: Make It! Tools and Preparation

Assembling the kit!

This is a very easy kit to make, just go through each of these steps to build the kit

1. Tools and preparation
2. Check the parts list
3. Assemble it

Tutorials

Learn how to solder with tons of tutorials!
http://www.ladyada.net/learn/soldering/index.html

Don't forget to learn how to use your multimeter too!
http://www.ladyada.net/learn/multimeter/index.html

Tools

There are a few tools that are required for assembly. None of these tools are included. If you don't have them, now would be a good time to borrow or purchase them. They are very very handy whenever assembling/fixing/modifying electronic devices! I provide links to buy them, but of course, you should get them wherever is most convenient/inexpensive. Many of these parts are available in a place like Radio Shack or other (higher quality) DIY electronics stores.

I recommend a "basic" electronics tool set for this kit, which I describe here.
http://www.ladyada.net/library/equipt/kits.html#basic

Soldering iron. One with temperature control and a stand is best. A conical or small 'screwdriver' tip is good, almost all irons come with one of these.

A low quality (ahem, $10 model from radioshack) iron may cause more problems than its worth!

Do not use a "ColdHeat" soldering iron, they are not suitable for delicate electronics work and can damage the kit (see here) http://www.epemag.wimborne.co.uk/cold-soldering2.htm

Solder. Rosin core, 60/40. Good solder is a good thing. Bad solder leads to bridging and cold solder joints which can be tough to find. Dont buy a tiny amount, you'll run out when you least expect it. A half pound spool is a minimum.

Multimeter/Oscilloscope. A meter is helpful to check voltages and continuity.

Flush/diagonal cutters. Essential for cutting leads close to the PCB.

Desoldering tool. If you are prone to incorrectly soldering parts.

'Handy Hands' with Magnifying Glass. Not absolutely necessary but will make things go much much faster.

Good light. More important than you think.

Check out my recommendations and where to buy.
http://www.ladyada.net/library/equipt/kits.html#basic

Step 2: Make It! Parts List

Parts List

Check to make sure your kit comes with the following parts.Sometimes we make mistakes so double check everything and email support@adafruit.com if you need replacements!

Please note that an XBee radio module is not included, check the user manual for suggested modules and distributors.

Name: IC1
Description: 3.3V linear voltage regulator, 250mA current
Part # & Datasheet: MCP1700-3302E/TO
Distributor: DigikeyMouser
Qty: 1

Name: IC2
Description: 5v compliant buffer chip
Part # & Datasheet: 74AHC125N
Distributor: Digikey Mouser
Qty: 1

Name: LED1
Description: Red LED
Part # & Datasheet: Lite-On LTL-1CHE (or any 3mm LED)
Distributor:
Qty: Digikey
1

Name: LED2
Description: Green LED Lite-On LTL-1CHG (or any 3mm LED)
Part # & Datasheet:
Distributor: Digikey
Qty: 1

Name: R1, R2
Description: 1/4W 5% 1.0K resistor Brown Black Red Gold
Part # & Datasheet:
Distributor: DigikeyMouser
Qty: 2

Name: R3
Description: 1/4W 5% 10K resistor Brown, Black, Orange, Gold
Part # & Datasheet:
Distributor: DigikeyMouser
Qty: 1

Name: C1
Description: 0.1uF ceramic capacitor (104)
Part # & Datasheet:
Distributor: DigikeyMouser
Qty: 1

Name: C2
Description: 100uF / 6V capacitor
Part # & Datasheet:
Distributor: DigikeyMouser
Qty: 1

Name:
Description: Straight male header
Part # & Datasheet:
Distributor: DigikeyMouser
Qty: 1

Name:
Description: 10-position 2mm female header Sockets for XBee modem
Part # & Datasheet:
Distributor: DigikeyMouser
Qty: 2

Name: PCB
Description: Circuit board
Part # & Datasheet:
Distributor: Adafruit Industries
Qty: 1

Step 3: Make It! Solder It! Part 1

Assembly Manual

First, make sure you have all the parts necessary. Check the Bill of Materials. You may also want an XBee module, as it makes it a little easier to position the 10-pin sockets

To begin, place the PCB in a vise or third-hand so that it will be easy to work on. Heat up the soldering iron to 700degF and get all the parts and tools ready for use.

First thing we will place is R3, a 10K resistor (brown, black, orange gold). This resistor is used to keep the XBee out of reset mode, so that by default it is on.

Bend the resistor into a staple as shown, and slip it in. (The stock photo below shows a 100 ohm resistor but just ignore the stripes and focus on the shape)

Place the resistor in the location marked R3. Resistors do not have polarity which means you can put it in 'either way' and it will work just fine. Bend the wire legs out so that the resistor sits flat against the PCB.

Turn the PCB over. Using your soldering iron tip, press and heat both the pad (the silver ring around the hole) and lead (wire) at the same time for 2 or 3 seconds. Then poke the end of the solder in to create a nice solder joint. Do this for both leads.

Using your diagonal cutters, cut off the long leads just above the solder joint.

Step 4: Make It! Solder It! Part 2

Next are the other 2 resistors, R1 and R2. These resistor have a different value, 1K. The stripes are Brown Black Red Gold. These resistors set the brightness of the two indicator LEDs

Solder these two resistors using the same techniques you learned from the first one.

Then, use the clippers to cut the long leads of the resistors off.

Next are the two LEDs: one LED indicates that the XBee is up & running ("Asc"), the other indcates when data is received by the unit ("RSSI") and is very useful for debugging.

In these examples, the green LED will be the "Associate Indicator" indicator and the red LED will be the "Received Signal Strength Indicator"

LEDs are polarized, unlike resistors. This means they must be soldered in properly in order to function.The longer lead of the LED is positive and must go in the hole marked with a +. See the images for a detailed view of how the LEDs are placed. If they are placed wrong, the LEDs will simply not light up and it could be very confusing

Once you have doubled checked that the LEDs are in properly, flip the board over and solder in both LEDs. Then clip the leads off

Step 5: Make It! Solder It! Part 3

The next component we'll place is the large electrolytic capacitor. This capacitor helps keep the 3.3V power supply stable even when there are bursts of usage - such as a data transmit! Electrolytic capacitors are polarized, just like LEDs. The longer lead indicates the positive leg and should go into the pad marked + as shown

Once the electrolytic capacitor is in place, insert the 3.3V regulator and the smaller ceramic capacitor as well. The small ceramic capacitor helps filter out high frequency noise from the power supply and the regulator turns the 5V input into a nice & steady 3.3V that the XBee requires.

The ceramic capacitor is non-polar, so place it 'either way'

The 3.3V regulator must be placed correctly, but is easy to do: simply match the shape on the silkscreen with the semicircle of the regulator.

Make sure the capacitor and regulator sit close to the PCB, especially if you're planning to use an XBee Pro module.

Now solder in the power supply components & clip the leads

Next is the buffer chip. This chip converts the 2V-5V signal from the bottom strip of pins to 3.3V so that you can safely connect the XBee to 5V logic circuitry. If you're planning to use the two lines of parallel breakout pins instead of the lines at the bottom of the PCB, you may want to skip the buffer. However, most people will want it in place

The buffer chip must be placed in the right way for it to work. Look for a U-shaped cutout notch in one end of the chip. This notch should match the U-shaped notch in the silkscreen. See the picture to make sure its in right.

Flip over the PCB and solder in every pin of the buffer carefully. The pins will not have to be clipped once they are soldered in

Step 6: Make It! Solder It! Part 4

Next are the two 10-pin 2mm headers. These header sockets hold the XBee radio module securely so that it can be easily replaced or reused. Put the sockets in the two strips of holes.

If you have a spare XBee module, you can insert the module into the sockets to keep the spacing right. Otherwise, keep the headers in place with a piece of tape

Flip over the board and hold the XBee/headers in place with one finger to keep them in place.

Then 'tack' the corners of the header with a small bit of solder, just to keep them in place.

Once they are tacked in place, remove the XBee module

Then go back and solder in each pin of the socket header.

Step 7: Make It! Solder It! Part 5

You can now replace the XBee module!

The module is pretty much complete at this point. You can continue to customize the bottom header strip or go check out the user manual!

You can continue by adding straight header to the breakout strip at the bottom if you'd like.

Or you can solder the header flat against the back of the adapter, so that it sticks out along the edge

Another option is to use right-angle header (not included) and solder it in as shown (or on the reverse side)

Step 8: Use It! Modules

Now what?

Here is a list of topics on how to use the XBee in your project

1. Which module to use?
2. How to wire the module to your project / computer
3. Connecting, configuring and upgrading an XBee
4. Setting up point-to-point communication, the simplest wireless link
5. Creating a wireless Arduino programming/debugging link
6. Reference

Which XBee radio module is right for you?

Introduction

There are about half a dozen different XBee modems. Its a good idea to at least review the differences between them so that you can make sure that you have the right power, range and network compatibility for your project

For the examples on the site, I use the XBee 802.15.4 modules. These are low cost ($20), reasonably low power and are the most popular XBees used by hobbyists for simple wireless communication.

Families

There are half a dozen 'families' of XBee & it's important to know the differences

Name: XBee 802.15.4
Frequency: 2.4GHz
Network type: point-to-multipoint
Max Range (Pro): 300' (1 mile)
Notes: most popular, cheap
Convertable to...: XBee DigiMesh 2.4
Distributors, antenna type: Digikey (Wire $19), Digikey (Chip $23) Mouser (Wire $20), Mouser (Chip $19)

Name: XBee DigiMesh 2.4
Frequency: 2.4GHz
Network type: mesh
Max Range (Pro): 300' (1 mile)
Notes:
Convertable to...: XBee 802.15.4
Distributors, antenna type:

Name: XBee Pro 900
Frequency: 900 MHz
Network type: point-to-multipoint
Max Range (Pro): 6 miles
Notes:
Convertable to...: XBee DigiMesh 900
Distributors, antenna type:

Name: XBee DigiMesh Pro 900
Frequency: 900 MHz
Network type: mesh
Max Range (Pro): 6 miles
Notes:
Convertable to...: XBee 900
Distributors, antenna type:

Name: XBee XSC Pro
Frequency: 900 MHz
Network type: both
Max Range (Pro): 15 miles
Notes: long range
Convertable to...:
Distributors, antenna type:

Name: XBee ZNet 2.5 "Series 2"
Frequency: 2.4 GHz
Network type: mesh
Max Range (Pro): 100m (1 mile?)
Notes: legacy, not suggested
Convertable to...: XBee ZB
Distributors, antenna type:

Name: XBee ZB "Series 2"
Frequency: 2.4 GHz
Network type: mesh
Max Range (Pro): 400' (1 mile)
Notes: ZigBee
Convertable to...: XBee ZNet
Distributors, antenna type: Digikey (Chip $21) Digikey (Chip $21) Mouser (Chip $21) Mouser (Wire $21)

The XBee 900 and XBee DigiMesh 900 operate at 900 MHz and so they cannot communicate with the 2.4 GHz frequency XBees!

The DigiMesh & ZNet 2.5 modules are preconfigured for mesh networking, not point-to-point or point-to-multipoint connectivity

The XBee 802.15.4 operate at 2.4 GHz but are not compatible with the ZNet/ZB/"series 2" modules!

If you just want to wirelessly send data from one place to another chances are you'll be most happy with the low cost XBee 802.15.4

Pro?

For some of the families, the module is available in both a low-power and Pro version. The Pro version often has an extra amplifier for longer range. However this means that the power required to run the modules is also a lot higher! The adapter can be outfitted with either kind of module but research and testing is often necessary to determine which one is suitable for your needs

Antennas

There are three different antenna-options available for the XBee radios:

1. Chip
2. Wire
3. UFL
4. RP-SMA

The chip and wire antennas are already on the board and don't require any work on your end. The UFL and RP-SMA options are just connectors, they require an antenna tuned to the correct frequency and with the proper connector in order to function!

Unless you are doing something that requires a special antenna for directed or high power transmission, the chip or wire antenna options will be just fine

Step 9: Use It! Wiring

Introduction

This section will introduce and explain each of the breakout pins on the XBee adapter. And also show some ways to wire the board up for use with a computer or microcontroller

Pinout

This image shows the pinout for the XBee adapter

1. 3V pin - this is either an input power pin (if 5V is not provided) or an output from the 250mA regulator if 5V is provided
2. DTR - "Data terminal ready" this is a flow control pin used to tell the XBee that the microcontroller or computer host is ready to communicate
3. RST - this pin can be used to reset the XBee. By default it is pulled high by the 10K resistor under the module. To reset, pull this pin low.'
4. Ground - common ground for power and signal
5. CTS - "Clear to Send" this is a flow control pin that can be used to determine if there is data in the XBee input buffer ready to be read
6. 5V - this is the power input pin into the 3.3V regulator. Provide up to 6V that will be linearly converted into 3.3V
7. RX - This is the XBee's serial recieve pin. Serial data is sent on this pin into the XBee to be transmitted wirelessly
8. TX - This it the XBee's serial transmit pin. Serial data is sent on this pin out of the XBee, after it has been transmitted wirelessly from another module
9. RTS - "Ready to Send" this is a flow control pin that can be used to tell the XBee to signal that the computer or microcontroller needs a break from reading serial data.
10. see pin #1

Connecting to a computer

Often times, wireless modules are used as a bridge between a computer and a microcontroller or sensor. The XBees must also be connected to a computer to perform firmware updates and its often easier to configure the modules (changing the baud rate, configuring network IDs, etc) this way as well.

By far the easiest way to connect to a computer is to use an FTDI cable - use either 3.3V or 5V. These cables have a USB to serial converter chip molded into them and are supported by every OS. Thus configuring or upgrading or connecting is really trivial. Simply plug the cable into the end of the module so that the black wire lines up with GND. There is a white outline showing where the cable connects.

Another method of connecting is using a USB or serial breakout board. Each breakout board is going to be a little different so check the documentation. Make sure the transmit/receive pins are not swapped, etc.

Finally, it is possible to use a de-chipped Arduino to connect an XBee to a computer. Basically, this is just using the FTDI chip on the Arduino to pass the serial data. First, gently pry the microcontroller from its socket using a small flat screwdriver or similar. Try to make sure the pins don't get bent. Put it in a safe place. Preferably in an anti-static bag.

Then connect the +5V pin on the XBee to the 5V line on the Arduino. Do the same for Ground. The TX line from the XBee connects to the TX line on the Arduino (because we're replacing the microcontroller, not talking to it). Same with RX.

If you are planning to try and upgrade the modem - which is pretty common, connect the RTS line to the right hand solder dot to as shown. That's the best connection you can get to the RTS line. If you're not upgrading, then you can skip this wire

Step 10: Connecting, Configuring & Upgrading

Introduction

Once you have the XBee connected to a computer, you can experiment with connecting, configuring and upgrading the modules to the latest firmware.

Connecting

First, follow the wiring information in the previous section to connect up the XBee module. Note that if the module has correct power, the green LED should be blinking. If it isn't, check the wiring and verify that the XBee is getting power

You'll need to figure out which serial port (COM) you are using. Plug in the FTDI cable, USB adapter, Arduino, etc. Under windows, check the device manager, look for "USB Serial Port"

Next you'll need to open up a terminal program. Windows comes with Hyperterminal, so just use that. Its under
Start->Programs->Accessories->Communications->HyperTerminal.
If you are running a different operating system just use whatever terminal program is available for it, such as ZTerm, minicom, etc. Make sure you understand how those work since a confusion could cause a big headache

When you open it up, it should ask you for a new connection. Lets name it "xbee"

Next You will select the COM port from the drop down menu, in my case its COM4.

Next, set the properties. Make sure you select 9600 bps, 8 bit, No parity, 1 stop bit and no flow control. Some programs may call this (9600 8N1). If the XBee has been configured for a different baud rate, of course, you should use that.

You will get a blank screen that says "Connected" in the bottom left corner. Now, change the setup by selecting File->Properties and then going to the Settings tab and clicking the ASCII Setup button. Make sure you are sending line ends with line feeds and also echoing local characters

Now type in +++ (three plus signs) in quick succession. If the XBee is connected up properly you will get an OK in response

If you got an OK that means the XBee is powered and wired up correctly! If its not working, check:

  • Try again, be sure to wait 10 seconds between each attempt at typing in +++ and type the +'s quickly
  • Is the module powered? Green LED should be blinking
  • Are RX & TX swapped?
  • Do you have the correct baud rate? By default it should be 9600 baud 8N1 no hardware handshake but if it has been used for something else the baud rate might be different.

Next try typing in +++ (receive OK) and then AT and press return to get another OK This is basically how we can configure the XBee, by sending it AT commands (they all start with AT for ATtention). After a while, the XBee times out of configuration mode and goes back to pass-through connection mode. So if you want to get back to config mode, just type in +++ and it will start responding again.

Configuring with terminal

XBee's can be configured directly using a terminal program, or via a program such as Digi's XCTU program - which is specifically designed to make configuration easy.

For example, here are two examples of how configure the module's baud rate.

Using a terminal, you can change the baud rate using the ATBD command with a number afterwards that selects which baud rate to use:

  • 0 = 1200
  • 1 = 2400
  • 2 = 4800
  • 3 = 9600
  • 4 = 19200
  • 5 = 38400
  • 6 = 57600
  • 7 = 115200

-> +++ (get into AT mode)
<- OK
-> AT (check if xbee modem is responding)
<- OK
-> ATBD (get current baud rate as above)
<- 3 (9600)
-> ATBD 4 (set baud rate to 19200)
<- OK
-> ATBD (check again)
<- 4
-> ATWR (write the baud rate change to flash)
<- OK

Then reset the module, either by pulling the reset pin low for a second or removing power (unplugging cable, etc) To connect now, set the terminal to use 19200 baud, otherwise the module will not respond! You can set it back to 9600 baud by giving it the command ATBD 3 and then ATWRiting it to the flash

Configuring with X-CTU

Digi/Maxstream wrote a little program to help configure XBees, its also the only way I know of to upgrade them to the latest firmware. Unfortunately it only runs on Windows

After installing and starting the program, select the COM port (COM4 here) and baud rate (9600 is default). No flow control, 8N1

To verify, click Test / Query

Hopefully the test will succeed. If you are having problems: check that the XBee is powered, wired correctly, the right COM port & baud rate is selected, etc.

The test will respond with the firmware version. Now we will change the baud rate for the modem using X-CTU

Go to the Modem Configuration tab. This is where the modem is configured and updated

Click on Modem Parameters -> "Read" to read in the current version and settings

You may want to skip ahead and upgrade the modem now, since it can be confusing if you dont have the latest firmware on it

Scroll down in the settings pane until you find the Serial Interfacing -> Interface Data Rate setting. Click on the setting and select 4 for 19200 baud.

Once that is selected, click on Write to program that setting in place. Don't forget to 'reboot' the module by power-cycling it or pulling the Reset pin low. Next time you want to connect, make sure to change the COM port setup to 19200 or you wont be able to talk to the module!

Upgrading with X-CTU

Theres a good chance your XBee is not running the latest firmware & there's a lot of features added, so next up is upgrading!

Go to the Modem Configuration tab. This is where the modem is configured and updated

Click Download new versions... and select to download the latest firmwares from the Web

Once you have downloaded the newest firmware, its time to upgrade!

Click on Modem Parameters -> "Read" to read in the current version and settings

Now you will know for sure what function set, version and settings are stored in the modem

Select from the Version dropdown the latest version available

Check the Always update firmware checkbox

And click Write to initialize and program the new firmware in!

Thats it, now you have the most recent firmware for your modem. You should now uncheck the Always update firmware checkbox. If you have problems, like for example timing out or not being able to communicate, make sure the RTS pin is wired up correctly as this pin is necessary for upgrading. FTDI cables are already set up for this so you shouldn't have a problem

Step 11: Point-to-point Communication

Overview

The most basic way to communicate using the XBee modems is point to point. That means one modem communicating with another modem. Serial data goes in one XBee, is transmitted wirelessly, and goes out the other & vice versa.

If you just want a wireless link - between two microcontrollers, computers, Arduinos, etc. then start here!

Setting the network ID

For this simple network, we want two modems to talk only to each other. That means that if you're in a school, lab or workshop other people's XBee's can interact with yours causing some major confusion

A good way to avoid this is to set the network ID (otherwise known as the PAN - Personal Area Nework - ID) to a unique value. By default all XBee's use PAN ID #3332. The ID is 4 bytes of hexadecimal and can range from 0000 to FFFF

Changing the PAN is easy. If you want to do it with X-CTU simply select a new ID and Write it to the module

If you are using a terminal to connect, use the ATID command to set and check the PAN ID

-> AT (check if xbee modem is responding)
<- OK
-> ATID (get current PAN)
<- 3332 (default, or something else)
-> ATID 3137 (set new id)
<- OK
-> ATID (check again)
<- 3137
-> ATWR (write the change to flash)
<- OK

Connecting to Arduino or Boarduino

Lets set up an example where the computer is going to talk to a microcontroller project such as an Arduino or Boarduino. If you're using a different microcontroller or communicating between two microcontrollers, its going to be pretty similar

Start by first setting up the PAN ID and baud rate for the two modems. For this example I will assume that they are set up for the default baud rate of 9600

Conncet one module to your microcontroller. First connect +5V and Ground to provide power. Make sure the XBee's green LED is blinking. Next connect the RX line (input) of the XBee to the TX line (output) of the microcontroller and vice versa. For the Arduino/Boarduino below I will be using a "Software Serial" program and use pin #2 as the RX and pin #3 as the TX. This allows me to use the default hardware USB serial port without conflicting. (For example, I can still upload a sketch)

Now connect the other module to a computer using an FTDI cable or similar.

Open up a terminal to the computer's XBee and start typing into it - whatever you want. You should see the red LED on the other modem light up, indicating data is being received. If you don't see the red LED light up, check that you have compatible modules, matching baud rates and PAN IDs.

Now install the NewSoftSerial library & upload the following sketch:

#include <NewSoftSerial.h>

NewSoftSerial mySerial = NewSoftSerial(2, 3);

void setup() {
pinMode(13, OUTPUT);
Serial.begin(9600);
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
mySerial.println("Hello, world?");
}

void loop() // run over and over again
{

if (mySerial.available()) {
Serial.print((char)mySerial.read());
}
if (Serial.available()) {
mySerial.print((char)Serial.read());
}
delay(100);
}

This will set up a point-to-point 'tunnel' between the two XBees. What is typed into the terminal at the computer will end up in the Arduino's Serial Monitor. Try it out!

Step 12: Wireless Arduino Programming/serial Link

Introduction

If you have an Arduino project where the dev board is stuck inside a machine, or attached to the rafters or is inaccessable in some other way, a wireless programming/debugging link will save you tons of time. This tutorial is an extension on Rob's version. In this tutorial, no extra firmware or hardware (other than a capacitor) is necessary. Just use the default bootloader. I use a 'classic' Arduino but of course this can be easily adapted to any version or clone.

You will need 2 XBee adapter kits, 2 matching-protocol XBee modules, an FTDI cable (or other FTDI breakout board, if you can wire it up correctly) as well as a 0.1uF ceramic capacitor, 10Kohm resistor and NPN transistor. The resistor and capacitor can vary quite a bit if you don't have exact values

This tutorial was updated Feb 22, 2009 to make it more robust...it seems to work a lot better with the fixes!

Step 1. Configure the transmitter

One XBee will act as the 'reset transmitter', it will be attached to the computer via an FTDI cable and wireless send programming commands to the receiver. Lets set this one up first

Connect up the transmitter adapter with XBee modem to your computer using the FTDI cable

And start X-CTU, just like on the configure page.

Once you've connected/tested that you can communicate with the modem, go to the configure tab and read in the current setup

Then set the following:

The PAN ID should be some 4 digit hex number that will only be used by these two modems - to prevent confusion

Set the baud rate to 19200 if you're using an Arduino with a 168 chip or older '328p chip. You can check your Arduino documentation to figure out which baud rate to use

Or 57600 if you're using a more recent Arduino with '328p chip

Next we'll set the Packetization Timeout. This is what determines how long to wait before sending the characters over. We're doing some 'bulk transfer' when sending 10K programs over, so you'll probably want this number high like 10

Set pin D3 to be a digital input

And set the Digital IO change detect to FF. Technically you can set it to 0x08, which is the mask to listen for only D3 but this certainly works fine.

Now the transmitter is set up to send the current status of pin D3 to any listening modems.

Now solder in a tiny jumper between the RTS pin and D3. This will tie the status of D3 to the status of the RTS pin which is can be configured to be used as the 'arduino reset pin'

Finally setup the FTDI cable so that the RTS pin will reset the Arduino. For Mac/Linux it will already be done but if you're using Windows you'll need to make a slight change to the driver preferences. In the Device Manager, select the USB COM port

Then right click and select Properties

Click on the Port Settings tab, and click on Advanced...

Make sure Set RTS On Close is selected. Click OK.

Step 2. Configure the receiver

Now we will set up the other XBee so that it will listen to changes on pin D3. Connect it to the FTDI cable and read in the current configuration just like the first one.

The PAN ID should match the transmitter's

Set the baud rate to 19200 or 57600 to match the transmitter, again

Next we'll set the Packetization Timeout. This is what determines how long to wait before sending the characters over. We're doing some 'bulk transfer' when sending 10K programs over, so you'll probably want this number high like 10

Set pin D3 to be a digital output, default high.

Set the I/O Output to Disabled. This will prevent the receiver from displaying the status update in the serial line and instead just toggle the matching pin.

Finally, set I/O line passing input address to FFFF. If you set up unique addresses for the receiver and transmitter xbees, of course you should change this to match but FFFF will match all addresses.

Now write the changes to the receiver XBee.

Step 3. Wire up the receiver

The transmitter XBee connects directly to the FTDI cable/computer and the receiver is wired to the target Arduino. Here I use a half-sized breadboard and rubber band since not much space is necessary. Solder a wire from pin D3 on the receiver XBee adapter, so that you can plug it into the breadboard. This is the mirrored reset line from the transmitter Xbee.

Xbee's are pretty weak and dont have the oomph to reset an Arduino on their own, so we need to wire it up to a transistor which will do the heavy lifting of pulling the reset line down. Pretty much any small NPN transistor will work just fine here. Put a 0.01uF to 0.1uF capacitor in series with the wire from the XBee, and connect the other side to the NPN transistor base. The emitter of the transistor connects to ground. Put a resistor around 10K between the base and emitter. This will pull down the base to keep the Arduino from resetting accidentally.

The collector then goes the Arduino's reset line. Make sure the grounds are all connected, and that the XBee is wired from the Arduino's 5V line

Now power the Arduino either through the USB cable or from a DC supply. That's it! Now you can reprogram it and also watch the serial monitor from more than 100 feet away. Don't forget the serial monitor -must- be at the same baud rate as programming because the XBees can only talk at their configured baud rate.You can also use AVRdude 'out of the box' which I prefer because you get a nice little progress bar. Simply go to the directory where your sketch is stored and look for the .hex file in the applet subfolder

Step 13: Use It! Reference

Command Reference

Configuring radios to pass DIO

This is how to set up two radios so that pin signals (high or low) from one radio will be passed to the other

In this instance, we will show how to set up sending from to another, but having bi-directional communication should be similar

On the transmitter radio:

1. Under I/O Settings, set the pins that will be transmitted to "3 - DI" (data in)
2. Set IC - DIO to FF (this will make it look at all the pins and transmit when they change)
3. Set sample rate to 0 (unless you want synchronous updates)

On the receiver radio:

1. Set the corresponding pins to "4 - DO (LOW)" or "5- DO (HIGH)"
2. Under I/O Line Passing set "Input Addresses" to 0xFFFF (allow any radios)
3. Set UI - I/O Output enable to Disabled

Changing baud rates

You can change the baud rate using the ATBD command

  • 0 = 1200
  • 1 = 2400
  • 2 = 4800
  • 3 = 9600
  • 4 = 19200
  • 5 = 38400
  • 6 = 57600
  • 7 = 115200

-> AT (check if xbee modem is responding)
<- OK
-> ATBD (get current baud rate as above)
<- 3 (9600)
-> ATBD 4 (set baud rate to 19200)
<- OK
-> ATBD (check again)
<- 4
-> ATWR (write the baud rate change to flash)
<- OK

Setting a pin direction

Use ATDx where x is the pin number from 0 to 8

  • 0 = Disabled
  • 1 = Special purpose:
CTS pin (pin D7 only!)
RTS pin (pin D6 only!)
Association Indicator (pin D5 only!)
  • 2 = Analog input (pins 0 thru 5 only)
  • 3 = Digital input
  • 4 = Digital output, default is low (0)
  • 5 = Digital output, default is high (1)

For example to set pin D4 to be a digital input

-> AT (check if xbee modem is responding)
<- OK
-> ATD4 (get current pin state)
<- 0 (disabled)
-> ATD4 3 (set pin to digital input)
<- OK
-> ATD4 (check again)
<- 3
-> ATWR (write the change to flash)
<- OK

Changing the PAN ID

By default all XBee's use PAN ID #3332. The ID is 4 bytes of hexadecimal and can range from 0000 to FFFF. XBees will only send/receive data to other modems on the same PAN

Use ATID #### where #### is the 4 digit hex ID

For example to set the PAN ID to 3137

-> AT (check if xbee modem is responding)
<- OK
-> ATID (get current PAN)
<- 3332 (default, or something else)
-> ATID 3137 (set new id)
<- OK
-> ATID (check again)
<- 3137
-> ATWR (write the change to flash)
<- OK

Changing the Retry Rate

Use ATRR to change the rate from 0 to 6 (default is 0). A higher retry rate such as 6 will provide a more 'rugged' connection but if you prefer to drop packets as long to get better response, set this to 0

Changing the Packetization Timeout

Use ATRO to change the rate from 0 to FF (255 in hex) the default is 3. The PT sets how long to wait before sending serial characters in a wireless packet. If you are sending lots of data, use a higher timeout to make sure there's more sent in each packet. If you're not sending a lot of data and want better response rate, set it to 0.

Step 14: Resources and Downloads