XBee: Making your first application – 2

Post image of XBee: Making your first application – 2
Filed in Articles , Featured , Tools , XBee 10 comments

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

  • Two XBee Modules with Development Boards
  • RS232 (Serial Port) Connection
  • X-CTU - Download

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;

XBee connection to X-CTU - Click to enlarge

XBee connection to X-CTU - Click to enlarge

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;

X-CTU Connect Settings - Click to enlarge

X-CTU Connect Settings - Click to enlarge

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;

X-CTU - Connection OK - Click to enlarge

X-CTU - Connection OK - Click to enlarge

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.

  • In X-CTU go to “Modem Configuration” tab and press “Read”. This tab shows the internal configuration of XBee module. Since we are setting up P2P connection, we need to exchange the Addresses of XBee modules with each other.
  • “Function Set” is the firmware inside XBee. It is responsible for different topologies and configurations.  For Module A we will use ZNET 2.5 ROUTER/END DEVICE AT. Select the Function Set from the drop-down menu and press Write. It will download the new function set into module A.
X-CTU - Changing Firmware

X-CTU - Changing Firmware

  • For Module B select ZNET 2.5 COORDINATOR AT and download it too.
  • Now both the modules have their respective firmware inside, all we need is to set the target module address.
    • Module A will have address of B in its DESTINATION field.
    • Module B will have address of A in its DESTINATION field.
    For Example;
    XBee - Communication Test Setup

    XBee - Address Exchange

    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.

    X-CTU - Address Update

    X-CTU - Address Update

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;

XBee - Loopback Test

XBee - Loopback Test

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.

Module B - Loopback Connection

Module B - Loopback Connection

In X-CTU go to Range Test tab and select the checkbox under RSSI. Click Start to run the test.

X-CTU - Communication and Range Test

X-CTU - Communication and Range 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 =)

Posted by hamzaazeem   @   27 September 2009 10 comments
Tags : , , , ,

Share This Post

RSS Digg Twitter StumbleUpon Delicious Technorati


  • Jtuhtan


  • shb

    salaams..did all the tests uptill step 2...All is gud alhamdolillah....
    Now abt step 3...
    u mean to say that Module B should'nt be inserted in anything..i just hav to connect its pin 2 and 3 using any connector and keep it in air..then try the loopback...right...i-e the range test...

  • creativeelectron

    That is good .

    Yes you have to connect Rx and TX of Module B. This way the data sent by X-CTU will return back to it, and it will be able verify it. Because C-CTU knows what its sending and receiving. On the basis of this it will tell the quality of your data received.

  • shb

    ok..i'll try that...

  • hamzaazeem

    Please post the question in our forums. To access XBee section please follow http://creativeelectron.net...


blog comments powered by Disqus
Previous Post
Next Post