An Example Of Setup A ZigBee Network

Here will demonstrate an example about building the communication between XBee-Coordinator and XBee-Router.    Where the PC connects to Xbee-Coordinator through USB Port and its adapter for Xbee.     Then it will talk to another XBee-Router which connects to Arduino (ATMEL- ATMEGA328P) with NewSoftSerial Libray.     This ZigBee Network allows other XBee join this network.     Just like lots people enter a meeting room and talk to each other , having fun together.     For a private talking between two people , such as father and son , you should just use 802.15.4.

For a P2P communication application , such as remote control a robot through a Joystick or Gamepad , better just use 802.15.4.     I just grab and use what I have.   The possible application of this example is , using XBee to handle the wireless communication between a PC and Arduino.     So user can send commands from PC to ask Arduino generate outputs to control something , like servos and motors.      And Arduino can monitor the inputs , like temperature sensor , then send the readings back to PC user.

Further more , with a Web Server , it can achieve Internet Real Time Control and Monitor.

Another example , Internet Controlled Vehicle - Use an internet browser to control / monitor a Vehicle , which has an XBee installed and be able to talk to PC.

[ XBee Configuration ]
Since I got two XBees with modem type : XB24-B in my hand , so I'll just use them as this example.     Do NOT try this configuration on your XBee , if they are not modem type : XB24-B.     Else , you will just get one bricked XBee(two if you are not smart enough).

Let's begin :

The Target :
Using a PC send a message "Everything entered here..." to XBee-Coordinator on Serial Port COM21.     So it can talk to XBee-Router wireless.    This XBee-Router
connected to Arduino and will transfer the message to it.     This Arduino also connected to the same PC through Serial Port COM7.     And Arduino will send the message back to PC.

Hardware Configuration
( Read this carefully )
  1. Connect XBee-Coordinator to PC Serial Port COM21
  2. Connect Arduino to PC through Serial Port COM7
  3. Connect XBee to Arduino through IO pin2 and pin4 (using NewSoftSerial)
XBee Firmware Configuration in X-CTU
  1. Set one to Coordinator AT
  2. Set the other one to Router AT
  3. Set baud rate to 6 - 57600 for both of them
Done!

As you can tell from the XBee firmware configuration above and the capture below , except the Baud Rate I didn't modify anything else.    So , basically , you just need to pick up the right function sets for the XBee , then they are ready to go.    For avoid interfere from other XBee's default setting like what you did , you may need to modify this parameter PAN
(Personal Area Network) ID as well.

The two XBee can talk to each other with speed 115200.    However , in the case here , one XBee connected to the IO pins on Arduino.     Due to the limitation of Serial Port Simulation for Arduino , it can talk with speed up to 57600.     If both of the XBees connected to a PC USB port , then the baud rate can set up to 115200.


Use X-CTU [COM21] to configure both of them
This one is Coordinator , the next one is Router.
Copyright © 2010 bdragon All rights reserved.
bdragong@gmail.com
Comments