Sie sind auf Seite 1von 6

Xbee: Configuration & Programming

Roddy G. Posada

Contents
Introduction .................................................................................................................................................. 2
The Communication Idea .............................................................................................................................. 3
Configuration ................................................................................................................................................ 3
Connecting Xbee to PC .............................................................................................................................. 3
Using X-CTU............................................................................................................................................... 3
Other terminal consoles ........................................................................................................................... 5
Setting a ZigBee Network.......................................................................................................................... 5
Programming ................................................................................................................................................ 6
References .................................................................................................................................................... 6

1|Page

Introduction
Xbee is a brand from Digi International which represents a series of radio devices based on the
802.15.4-2003 standard. As of today, the Xbee modules present themselves with a wide range of
product designs to support a variety of needs in the field of communications.
The Internet source Wikipedia (http://en.wikipedia.org/wiki/XBee) has published that:
As of May 2011, the XBee radio family consists of

XBee 802.15.4 (also known as Series 1 hardware) The initial point-to-point (PTP), point-tomultipoint (PTM) radio running the IEEE 802.15.4 protocol
XBee-PRO 802.15.4 (a.k.a. Series 1) A higher power version
XBee ZB (a.k.a. Series 2) An XBee module that incorporates the ZigBee PRO Feature Set mesh
networking protocol
XBee-PRO ZB (a.k.a. Series 2) A higher power version
XBee ZB SMT A surface mount XBee running the ZigBee protocol
XBee-PRO ZB SMT A higher power version
XBee SE An XBee ZB module that incorporates the security cluster for the ZigBee Smart Energy
public profile
XBee PRO SE A higher power version
XBee PRO 900 A 900 MHz proprietary PTP and PTM radio
XBee PRO 868 An 868 MHz proprietary PTP and PTM radio for Europe
XBee PRO XSC A 900 MHz radio compatible over the air with the MaxStream (now Digi) XStream
radios
XBee-PRO DigiMesh 900 A 900 MHz radio with the addition of a sleeping mesh networking protocol
(DigiMesh)
XBee DigiMesh 2.4 Same as above, but at 2.4 GHz
XBee-PRO DigiMesh 2.4 A higher power version

Figure 1 Common Xbee Module source: Wikipedia

2|Page

The Communication Idea


For the Quad/Nano/Mini copter project the basic idea was to use the Xbee modules and some
sort of software and hardware to replace the enormous and expensive radio transmitters. I think this is a
lead in for the following sections. Explain how

Figure 2

Configuration
In order to configure an Xbee module we have to be able to talk to it. There are several ways
to communicate to an Xbee, such as, a direct connection using an Arduino as the interface between the
computer and module, or using a breakout board. The latter is the best option since the Xbee module
comes with a 2 mm header form factor that complicates its connection to any standard protoboard or
PCB that use 0.1.
When using a breakout board, it takes care of several issues that have to be considered when using
Xbee modules, such as, Input Voltage, Signal conditioning and Activity LEDs.

Connecting Xbee to PC
Check all connections; use the USB-miniB cable to plug the FT232 Breakout into a USB port on
your computer. The LEDs connected to the XBee should light up and stay on. The task here is to
configure/update the firmware on the Xbee to make it work as a Router/End Device or as a
Coordinator). Turn on the XBee module and open the software

Using X-CTU
X-CTU is a tool provided by Digi that helps in the programming of the wide series of Xbee units.
Once the software is installed, select the correct usb serial port where the Xbee module is connected.
The PC Settings also contains a Query button that will test the communication with the Xbee module
providing information about the firmware version if the communication is successful

3|Page

Figure 3

Figure 4

One of the most important parameters to setup is the baud rate, in simple term this is the
communication speed between Xbee module and the PC Software.

Figure 5

4|Page

In X-CTU , click on TAB "Modem Configuration" the program has the user interface for firmware
downloading and upgrading, also there is a section for Modem parameters and Profile setup.

Other terminal consoles


Xbee modules can also be directly configured by using any terminal console available in the
different operating systems Windows(HyperTerm, Putty, etc.), Linux (Console, X-term, etc) and Mac.
This configuration is done by using a series of AT commands that interact immediately with the
hardware.
The AT command reference and some examples can easily be found on the manual for the
device, which at the time of this document preparation is available at :
http://www.libelium.com/squidbee/upload/3/31/Data-sheet-max-stream.pdf

Setting a ZigBee Network


ZigBee is a protocol that uses the 802.15.4 standard. ZigBee defines three different device types:
coordinator, router, and end devices
A coordinator has the following characteristics: it

Selects a channel and PAN ID (both 64-bit and 16-bit) to start the network
Can allow routers and end devices to join the network
Can assist in routing data
Cannot sleep--should be mains powered.

A router has the following characteristics: it

Must join a ZigBee PAN before it can transmit, receive, or route data
After joining, can allow routers and end devices to join the network
After joining, can assist in routing data
Cannot sleep--should be mains powered.

A end device has the following characteristics: it

Must join a ZigBee PAN before it can transmit or receive data


Cannot allow devices to join the network
Must always transmit and receive RF data through its parent. Cannot route data.
Can enter low power modes to conserve power and can be battery-powered

ZigBee networks are called personal area networks or PANs. Each network is defined with a unique
PAN identifier (PAN ID). If multiple ZigBee networks are operating within range of each other, each
should have unique PAN IDs. In ZigBee networks, the coordinator must select a PAN ID and channel to
start a network.
Other critical parameters to setup are: Destination Address High, Destination Address Low, Source
Address, all this parameter have to be configured on both devices Router and Coordinator.

5|Page

Programming
/* Serial Test code
Sends "testing..." over the serial connection once per second
while blinking the LED on pin 13. Used for testing serial devices
such as the XBee.
Adapted from the SoftSerial Demonstration code
*/
#define ledPin 13
byte pinState = 0;
void setup() {
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
Serial.println("testing...");
// toggle an LED just so you see the thing's alive.
toggle(13);
delay(1000);
}
void toggle(int pinNum) {
// set the LED pin using the pinState variable:
digitalWrite(pinNum, pinState);
// if pinState = 0, set it to 1, and vice versa:
pinState = !pinState;
}

Connect the Arduino with the XBee Shield to your computer using a USB cable. Load the above sketch
on to the Arduino. With the coordinator XBee still connected to your computer via the FT232 Breakout,
you should see testing over in the Terminal tab of X-CTU.

References
1. http://www.digi.com/products/wireless-wired-embedded-solutions/zigbee-rf-modules/zigbeemesh-module/xbee-zb-module#overview
2. http://arduino.cc/blog/category/wireless/xbee/
3. https://sites.google.com/site/xbeetutorial/xctu
4. Practical Arduino Cool Projects for Open Source Hardware
5. Alasdair Allan, iOS Sensor Apps with Arduino
6. Beginning Arduino Programming
7. Arduino Cookbook
8. https://sites.google.com/site/xbeetutorial/xbee-introduction/zigbee
9. https://sites.google.com/site/xbeetutorial/example/arduino-test-program-for-xbee
10. http://www.jeremyblum.com/2011/02/27/arduino-tutorial-9-wireless-communication/

6|Page

Das könnte Ihnen auch gefallen