In the previous tutorial, the analog I/O line was passed between two X-Bee modules. In this tutorial, X-Bee modules will be used to read and transmit digital data. X-Bee modules are often used with microcontrollers that can pass data to the module as digital data. Even the module itself is capable of detecting digital data from sensors and switches, as it has 8 digital input/output pins. For reading or writing digital data, these pins or any of these pins can be configured for read or write operation.
Required components –
1) X-Bee Modules – 2
2) Arduino UNO
3) Test boards
4) Connecting Wires
5) FTDI USB to serial converter cable
6) PC
7) change
Circuit Connections –
In this project, two X bee series 1 (S1) modules are used. One module serves as the Transmitter and the other as the Receiver. Both modules will be PCs connected to pass AT commands and monitor data transfer. An X-Bee module is a 20-pin module with the following pin configuration –
To connect a Zig-Bee module to the PC, an FTDI USB to serial converter cable can be used. The converter cable has four pins – VCC, Ground, RX and TX. These pins must be connected to the X-Bee module as follows –
Another way to connect the X-Bee module to the PC is to connect it via the Arduino board. The PC and Arduino board can be connected by a USB cable. The RX and TX pins of the Arduino can be connected to the Tx and RX pins of the Zig-Bee module and the Reset pin of the Arduino UNO can be grounded. Now, by loading the 'Bare Minimum' Arduino Sketch onto the board, it can be used for serial communication with the X-Bee module.
Both modules need to be powered by 3.3V batteries. According to the pin configuration of the X-Bee modules, the positive terminal of the battery must be connected to pin 1 of the module and the negative terminal to pin 10 of the module.
The X-Bee module to be used as a transmitter will be powered by a digital input through a switch connected to pin 20 of the module. Pin 20 of the X-Bee is analog input 0 and also digital I/O 0. It needs to be configured as a digital input by passing the appropriate AT commands. Pin 20 will be connected to ground by default, so the default logic read by the pin will be LOW. When pressing the switch, the pin will short circuit with VCC, thus reading a logic HIGH. Therefore, the switch will be connected to pin 20 in pull down configuration.
The X-Bee module to be used as a receiver will have an LED connected to pin 20 of the module. On the receiver module, pin 20 will be configured as a digital output instead of a digital input.
How the circuit works –
AT commands will be used to configure both modules. The transmitter module will be configured to read digital data and pair with the receiver module to pass the data to it. Commands will be transferred via the 'CoolTerm' application on the PC. In the transmitter module the following configuration parameters must be changed –
1) PAN ID
2) Low Destination Address
3) Origin address
4) Data I/O pin 0 (20th pin)
5) I/O sampling rate
These parameters will be set to the following values using the AT commands –
1) PAN ID = 3332
2) Lower destination address = 0x22
3) Source address = 0x24
4) Data I/O pin = 0x03 (passing 0x03 sets the pin for digital input)
5) I/O sampling rate = 0x1E (30sec)
The following AT commands are passed to change the configuration parameters of the transmitter module –
The receiver module will be configured to pair with the transmitter module and output digital data on pin 20 in accordance with the data transmitted from the other module. On the receiver module, the following configuration parameters must be changed –
1) PAN ID
2) Low Destination Address
3) Origin address
4) Data I/O pin 0 (20th pin)
5) Define ATIA
These parameters will be set to the following values using the AT commands –
1) PAN ID = 0x3332 (Setting the PAN ID equal to the transmitter address pairs the two modules)
2) Destination address low = 0x24 (Receiver's DL address must be the same as transmitter's source address)
3) Source address = 0x22 (the transmitter's destination low address must be the same as the receiver's source address)
4) Data I/O pin = 0x04 (passing 0x04 sets the pin for digital output)
5) Set “ATIA” as the transmitter source address (24) so that pin 20 of the receiver follows changes to pin 20 of the transmitter.
ATIA is the address command. Helps enable pin output mode updates from the other X-Bee radio.
The following AT commands are passed to change the receiver module configuration parameters –
After configuring each module, the settings must be saved by sending the ATWR command and finally exit AT mode using the 'ATCN' command. After configuring the modules and saving the settings, if the transmitter module switch is pressed, the LED connected to the receiver module starts to glow and when the switch is released, the receiver module LED also turns off.
Not just a single pin but all digital input/output pins can be configured on the X-Bee modules for digital data transfer.
Project source code
Project source code
###
//Program to
###