![]()
In the previous post we learned about hardware interfacing of XBee. In this part we will learn about testing the communication and programming.
Tools Required
Step 1 – Module Connection Test
Now we have two XBee modules, refer one as “A” and other as “B”. Connect module A with serial port of your PC through the development board. The diagram below explains the connection;
Note: There is no difference in Module A and Module B. Both are same, we just named them to differentiate for better understanding.
Connection is being made, now run X-CTU. X-CTU is software for configuring and testing XBee modules.
At the startup you will see PC Settings tab. This tab requires the information needed for serial connection to your XBee module. Select the COM Port to which XBee is connected. The other settings remain same i.e. Baud, Flow Control, Data Bits, Parity and Stop Bits. These are the defaults settings comes with XBee. Check the screenshot below;
After selecting the COM Port press “Test/Query” button. It will test the XBee module and confirms that connection is OK. If everything goes fine the following dialog box will be shown;
Step 2 – Settings and Firmware
Communication between the modules and PC is OK, now we should proceed towards establishing communication link between both the modules.
There are many networking topologies offered by XBee protocol. Since this article targets beginners we will setup a Point-to-Point communication.
Source Addresses can’t be changed while Destination Addresses are variable. Source addresses are fixed to specific module.
Write the destination addresses for both the modules and make sure that PAN ID is same in both modules. Click Write to download the new settings.
Step 3 – Communication Test
Till this step, we have tested the modules and setup the communication settings. Now we check the real wireless communication between the modules. X-CTU has built-in communication and range test. The range test sends a data packet and expects the same packet to be received. We will connect module A to PC and send packets through X-CTU. Module B will not be connected to any device but its Rx and Tx will be joined electrically. So whatever module B receives will be sent again. The following diagram shows the procedure;
As you can see, the ultimate result will be that whatever is sent to module A will come back. If the test goes right it will ensure that everything is perfectly setup.
To create a loopback connection, we have to put a jumper between the Rx and Tx pins of Module B’s DB9 Connector. Pin 2 and Pin 3 will be connected to each other.
In X-CTU go to Range Test tab and select the checkbox under RSSI. Click Start to run the test.
If your screen looks like the above then congratulations you have successfully setup communication link between both the modules. Now you can connect both the modules to separate PCs and check the communication using Hyper Terminal.
Once the modules are setup and configured properly, there is nothing left. All the hassles of wireless communication will be handled by XBee itself.
In the next part we will go a step further and use other built-in function of XBee till then enjoy the seamless wireless communication.
Happy XBeeING =)