Out of the box, XBee modules are configured to work in transparent mode. What this means is that we can connect a device that talks to an RS232 serial connection using an XBee module without any real hardware or software development
The following projects are currently coverd on this page:
The simplest project to undertake with a pair of XBee modules is simple replacement of a serial cable.
In my train room, the computer sits on one side of the room, and the layout sits on the other. In order to connect the two while construction progresses, I previously was required to use a cable to connect with the layout. A long cable in the middle of the floor is a tripping hazard, so this cable link had to be removed.
For this project, you need the following components:
One XBee module and the XBee Explorer USB are connected to the PC.
The remaining equipment is installed at the train layout's computer interface. The interface I used here is a Lenz LI100F configured to communicate at 9600bps. Both the LI100F and the XBee Explorer serial are configured as DCE (Data Communications Equipment) devices. These devices are intended to be connected directly to an RS232 serial port on a computer, and not to another DCE device.
In order to connect the two devices, we were required to reverse the transmit and receive pins through the cable going between them. This is accomplished using a Null modem, which allows two DCE devices (or two DTE (Data Terminal Equipment (e.g. computers) to communicate with each other directly.
Additionally, both the LI100F and the XBee Explorer Serial have 9 pin female D-SUB connectors. We need to use a cable with two male ends to connect the two devices. Alternately, a male to male gender changer can be used.
Once connected, the computer communicates to the LI100F as though there were a serial cable running between the two locations.Configuration Information:
The The XBee modules can be configured to communicate through it's serial port at 1200,2400,4800,9600,19200,37400,57600, and 115200 bps. This should allow matching it's speed to most serial interfaces.Alternative parts
The droids.it 990.006 XBee DTE Serial Board may be a suitable replacement for the null modem and XBee Explorer Serial in this project. I have not used this combination personally, and cannot comment further on how else this affects the parts list.
The first real project I undertook with the XBee modules is connecting an RFID module, the CORE-ID20, to an XBee module. The XBee module then forwards the data on to the base connected to the computer. The CORE-ID20 is a self contained RFID chip which will read 125KHz RFID tags.
The circuit here can largely be seen as two independent circuits: the RFID chip circuit, and the XBee circuit. The two circuits are connected through the Data 0 pin (pin 9) of the CORE-ID20 and the TX pin of the XBee (pin 3).
When an RFID tag is detected, the LED controlled by transistor Q1 is turned on. Data can be read from the serial port using any standard method. I used a software script distributed to the RFID for Model Railroading Yahoo group, which runs within JMRI's jython interpreter.Construction Notes:
I first constructed this circuit on a breadboard using the Sparkfun Breakout Board for XBee Module to mount the XBee and a Sparkfun RFID Reader Breakout board. The circuit was then transferred to a Radio Shack 276-170 circuit board, which has the same layout as a breadboard.
The Xbee runs at 3.3V and the CORE-ID20 runs at 5V, so a voltage regulator and a voltage divider circuit are used to run the two units together from a single 5v source. Using an XBee Explorer Regulated would reduce the number of required soldered connections. This option may be considered in a future revision of the circuit.