Zig Bee is a standard wireless communication technology that transfers data over ISM radio bands. It operates on 2.4 GHz worldwide and at other ISM frequencies in select countries. The communication protocol is commonly used for making personal area networks for applications like home automation, wireless office networks, and sensor-based data networks. The ZigBee modules are commonly used for connecting low-power embedded devices that need to operate in a small area at low data rates. A ZigBee module operating on 2.4 GHz band has the data rate of 250 Kbps.
Any ZigBee or X-Bee module can operate in two modes of operations – AT command mode and API mode. AT command mode is a transparent mode of operation as the data communication in AT mode is strictly controlled and managed by passing string commands to the module. That is why this mode is also referred as “Transparent mode”. In AT command mode any data sent to the X-bee module is directly fed to Data output pin which means that without buffering, the data is immediately sent to the remote module identified by the PAN ID.
When an X-bee module is in AT command mode, the user can configure it by using AT commands and by placing X-bee initially in AT command mode It can be easily configured using any microcontroller or microcontroller board. So, initially setting the module to AT command mode allows to programmatically control the data communication.
In AT mode, AT commands can be sent through Serial port (UART) by a microcontroller or PC. AT mode is most useful in point to point communication or in simple networks, but is not recommended for larger networks. AT mode is quite useful when destination address or the target device is not to be changed often. In a large network, nodes need to interact with multiple targets within the network which make use of AT mode cumbersome. So the AT mode should be used for only small networks with fixed target devices or for point to point communication applications.
When X-Bee module operates in AT command mode, the module setting can be configured using AT commands. To configure module in AT command module from a PC, any HyperTerminal application on can be used. Recently use of other terminal applications like “CoolTerm” has also become popular. It is same as HyperTerminal but is quite advanced application compared to the HyperTerminal. Another desktop application X-CTU can also be used. In this project, a ZigBee module will be connected to the PC via RS-232 cable or USB to RS-232 converter cable and be using ‘CoolTerm’ application, various AT commands will be tested on the module. The module will be interacting with the desktop application through the serial port and on passing AT commands, will respond with appropriate string messages or error messages.
Components Required –
1) X-Bee Modules – 2
2) Arduino UNO
3) Breadboards
4) Connecting Wires
5) FTDI USB to Serial converter cable
6) PC
Circuit Connections –
An X-Bee module is a 20-pin module with the following pin configuration –
Pin Number | Name | Direction | Description |
---|---|---|---|
1 | VCC | – | Power Supply |
2 | DOUT | Output | UART Data Out |
3 | DIN/CONFIG | Input | UART Data In |
4 | DO8 | Output | Digital Output 8 |
5 | RESET | Input | Module Reset |
6 | PWM0/RSSI | Output | PWM Output 0 /RX Signal Strength Indicator |
7 | PWM1 | Output | PWM Output 1 |
8 | Reserved | – | Do Not Connect |
9 | DTR/SLEEP_RQ/DI8 | Input | Sleep Control Line or Data Input 8 |
10 | GND | – | Ground |
11 | AD4/DIO4 | Either | Analog Input 4/ Digital I/O 4 |
12 | CTS/DIO7 | Either | Clear To Send Flow Control/ Digital I/O 7 |
13 |
ON/Sleep | Output | Module Status Indicator |
14 | VREF | Input | Voltage Reference for Analog/Digital Inputs |
15 | Associate/AD5/DIO5 | Either | Associated Indicator/ Analog Input 5/ Digital I/O 5 |
16 | RTS/AD6/DIO6 | Either | Request to Send Flow Control/ Analog Input 6/ Digital I/O 6 |
17 | AD3/DIO3 | Either | Analog Input 3/ Digital I/O 3 |
18 | AD2/DIO2 | Either | Analog Input 2/ Digital I/O 2 |
19 | AD1/DIO1 | Either | Analog Input 1/ Digital I/O 1 |
20 | AD0/DIO0 | Either | Analog Input 0/ Digital I/O 0 |
For connecting the module to PC, FTDI USB to Serial converter cable can be used. The converter cable has four pins – VCC, Ground, RX, and TX. These pins should be connected to the X-Bee module in the following manner –

Another way of connecting the X-Bee module with PC is connecting it via Arduino board. The PC and Arduino board can be connected by a USB cable. The RX and TX pin of the Arduino can be connected to the Tx and RX pins of the ZigBee module and Reset pin of the Arduino UNO can be grounded. Now by loading the ‘Bare Minimum’ Arduino Sketch on the board, it can be used for serial communication with the X-Bee module.
Running X-Bee AT commands:
After circuit connections, the AT commands can be sent by typing them on the ‘CoolTerm’ application. The AT commands for ZigBee modules have the following structure –
AT [ASCII command] [Parameter (optional)] [Carriage return]
To enter into the AT mode, three consecutive ‘+’ symbols (+++) need to be sent. The user needs to wait after pressing “+++” for few seconds until the module sends back a response “OK”. The ‘OK’ response means module has entered into the AT mode. After this, any AT command can be sent to configure the module, but after entering AT command unlike sending “+++”, every AT command requires pressing enter at the end of the command. AT commands are divided into categories like Address commands, Network commands, Security commands, RF interfacing commands, Serial interfacing commands, I/O commands, Diagnostic Commands and Options commands. Some of these commands are listed in the table below –
S.No | Command | Description |
---|---|---|
1 | +++ | To enter into the AT command mode |
2 | AT | It is used to check communication link exist or not between X-Bee and computer. |
3 | ATID | It will help to see present PAN ID in use by the Radio; it can be defined between 0X0000 and 0XFFFF. And we can assign new ID also. |
4 | ATSH/ATSL | Every X-Bee Radio device has it unique 64-bit address, it cannot be changed. We can read higher part of the address as well as lower part also by using SH and SL commands. |
5 | ATDH/ATDL | This will help to assign and to show destination address. We can see and assign new address by sending these commands. Also, we can see the lower and higher part of the Destination address by using DH and DL. |
6 | ATWR | This command will help to write the new changes in X-Bee configuration. It will overwrite current configuration with the new configuration. After configuring we must write it by using this command, otherwise, it cannot save new changes, and will continue with current settings. |
7 | ATCN | If we send this command then, X-Bee Radio will drop out of the AT command mode. |
8 | ATMY | MY ID: it will show X-Bee 16-bit address in the non-hexadecimal form. |
9 | ATD0- ATD7 | These commands will help in I/O configuration from pin0 to pin7. |
10 | ATP0 & ATP1 | These commands will help in I/O configuration of the pins 10 & 11. |
11 | ATIR | It will set the sample rate of the I/O pins. This rate is set in milliseconds in hexadecimal notation. When are sending this command we have to send sample rate in milli-hex value. |
12 | ATIT | It is iteration tailor command. it will set the number of samples taken from the D I/O pins before X-Bee transmitting them. The buffer will store the samples, and it can store up to 90 bytes. The highest value we can pass using this command is 44. |
13 | ATIA | It is Address command; it will help to enable the pinout modes to be updated from the other X-Bee Radio. |
14 | ATRE | It is reset command if we send this command it will Reset configuration to factory settings. |
15 | ATCT | It is options command “Command mode timeout”. It will set or read the inactivity time after X-Bee module Automatically exit from command mode. |
16 | ATPR | It will help to configure internal 30K pull-up resistor on pins that have been configured as input pins. To turn on the pull-up resistor set it as ‘1’, and to turn off set it as ‘0’. |
The AT commands listed in the table above are the basic AT commands and most important for interacting with the X-Bee module. The complete set of AT commands can be found in X-Bee data sheet.
Let’s test the AT commands on X-Bee module. The following approach will be undertaken for testing the AT commands on X-Bee module –
1. First, run AT commands to check default configuration.
2. Run AT commands to change the configuration.
3. Run AT commands to Reset to the default configuration.
4. 1. Checking default configuration.
5. In this step, some AT commands to read default configuration will be sent. For example, type the following commands for checking the mentioned configuration parameters –
6. ATID – to check PAN ID
7. ATD0 – to check D0 I/O pin status.
8. ATIR – to check sampling rate of I/O pins Etc.
9. The X-Bee module responded with the following messages for the AT commands passed –

2. Changing configuration.
To communicate with other X-Bee module individually or in network X-Bee module need to be configured. Some of the default settings from default factory setting can be changed using AT commands. During test, following AT commands to change configuration settings were sent to which the module responded with the following messages –

By passing the above mentioned AT commands, the lower byte of the Destination Address is set to 10 and Source Address is set to 11. The pin 0 is configured as ‘3’ and pin 5 is configured to ‘4’. The sampling rate (IR) for I/O pins is set to 14, where 14 is hexadecimal value equivalent to 20 milliseconds. Finally, internal pull-up resistors are turned OFF by setting ‘PR’ as ‘0’. After configuring, the settings must be saved by sending ATWR Command.
3. Resetting default configuration.
To reset X-Bee with default settings simply send the command ATRE which will restore the default factory settings. After resetting, the restored settings can be verified using the AT-commands for checking the configuration parameters.
In this project, it has been now learned that how ZigBee module can be connected to a PC and a serial application can be used to set the module in AT mode and how various AT commands can be passed to the module. In the next tutorial, ZigBee module will be used to read analog data and send the data to another module.
Project Source Code
Project Source Code
###
//Program to
###
Filed Under: Electronic Projects
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.