Jump to content

How to Connect an Arduino to an XBee Radio

+ 4
  ProfessorShiny's Photo
Posted Feb 07 2011 01:59 AM

Solderless breadboards and XBee breakout boards provide an easy way to link your Arduino board to an XBee. While the XBee has many pins, it takes only four of them to create a working connection so that your Arduino can communicate wirelessly, using its built-in serial communications protocol.

Remember that the XBee pins are spaced 2 mm apart, so the XBee can’t be placed directly into a breadboard. A basic breakout board is the least expensive adapter for connecting to an Arduino (for example Sparkfun parts BOB-08669 with PRT-08272 & PRT-00116). You can also use an XBee Explorer as a breakout board (Sparkfun WRL-08687), but keep in mind that the pins are arranged differently. The four connecting wires will provide power, electrical ground, transmit, and receive. The table below shows the pin connections between Arduino and XBee, and the image below shows them on an XBee breakout board.

Pin connections between Arduino and XBee

XBeeArduino
VCC or 3.3 V3V3
TX or DOUTRX or 0
RX or DINTX or 1
GNDGND


Breakout board pins for serial connection to Arduino

Attached Image


Remember, if you are using the XBee Explorer you’ll connect the same pins but their physical layout will be different, as shown below.

XBee Explorer pins for serial connection to Arduino

Attached Image


After plugging your XBee into a small breadboard, you can use different colors of hookup wire to make the connections between your Arduino and XBee. Once connected, the Arduino uses serial commands to send information out via the XBee, and to read in any information that’s received. This is how our doorbells will operate.

Arduino connected to an XBee radio, using a solderless breadboard and hookup wire

Attached Image


Building Wireless Sensor Networks

Learn more about this topic from Building Wireless Sensor Networks.

Create distributed sensor systems and intelligent interactive devices using the ZigBee wireless networking protocol and Series 2 XBee radios. By the time you're halfway through this fast-paced, hands-on guide, you'll have built a series of useful projects, including a complete ZigBee wireless network that delivers remotely sensed data. This resource- and reference-packed book is ideal for inventors, hackers, crafters, students, hobbyists, and scientists.

See what you'll learn


Tags:
2 Subscribe


3 Replies

-1
  Catmando's Photo
Posted Feb 09 2011 05:45 AM

If you follow these instructions you risk your radio. According to Digi the inputs on the XBee modules are NOT 5 volt tolerant.

http://www.digi.com/...detl.jsp?kb=160

Many sources do supply breakout boards that have appropriate level shifting:
Sparkfun
Adafruit
Parallax
Off the top of my head.
0
  spclk's Photo
Posted Feb 09 2011 06:24 AM

Which is why the article specifies using the 3V3 pin on the Arduino
0
  ProfessorShiny's Photo
Posted Feb 09 2011 09:50 AM

Some clarifications:

1. The stated concern is about the RX and TX lines, not the VCC power supply here. The VCC power supply is what runs the module and must be 3.3V or the module will not function properly!

2. The communication (RX/TX) pins definitely operate off of a 5V signal with the Arduino. I've seen this a lot and done this a lot and it certainly keeps things simple. That said, there's nothing wrong with adding a level-shifting circuit, definitely for commercial applications where you would want to keep the module stable across its entire temperature range, etc.

3. Level shifting could be done with:
  • a resistor-based voltage divider which will work but will also slow down signal rise and fall times significantly. For most cases this won't be a problem, but it might affect the integrity of fast signals over long wires.
  • a Zener circuit (with a resistor for level-shift) is better but the part isn't one most people have lying around, and it's not stocked say, at Radio Shack
  • a diode circuit like the two in the schematic below uses easily available parts and the diodes can be any common silicon rectifier type

http://faludi.com/bwsn_book/images/5V-3.3V_level_shift_circuit_for_TX-RX.png
Attached Image