section, you will see the SH and SL values obtained earlier
with the ATSH and ATSL commands in the Terminal
window. You will change other settings through a menu of
choices or by keying in a value.
After you make changes in the Modem Configuration
window, click on Write to load them into your XBee
module. To return an XBee module to its “factory fresh”
settings, click on Restore. I recommend you “restore” a
module when you change settings to ensure you start with
all parameters returned to their default states. Then, click
Read to obtain the default information.
Example 2: How to Set Up
Digital I/O Communications
Suppose you have a remote device (an LED, motor-drive, solenoid, and so on) you want to control with XBee.
Before two XBee modules can communicate, they must
know each other’s identity. You could use the eight-byte
serial number, but XBee modules let you use “short” two-byte addresses instead. A Destination Low (DL) address
identifies the destination of a transmission and a Source
Address (MY) identifies the source of a transmission. You
set those values via the X-CTU software.
For two XBee modules, I used the settings shown in
Table 1 which include other values I changed for my LOCAL
and REMOTE XBee modules. The IA (Input Address) value
Table 1. XBee module settings for a one-bit remote control.
5 - DO HIGH
of FFFF, for example, lets information received by an XBee
module change the state of its I/O pins. The Node Identifier
(NI) lets you name each module. I recommend you also put
a small label on each XBee module to easily identify them.
My LOCAL and REMOTE labels indicate a module near my
lab PC and one a few feet away powered with a separate
supply or two 1.5 volt D batteries.
Local Module: The setting 3-DI (digital input) for the
D3-DIO3 parameter on the LOCAL module sets the AD3-
DIO3 input pin (pin 17) so it will accept a logic-1 or logic-0
input. A switch connected between this pin and ground will
control the corresponding pin on the REMOTE module. The
IR (Sample Rate) value determines how often the
transmitter will sample the digital signal at the AD3-DIO3
pin, and the IT (Samples before Transmit) value sets the
number of samples the transmitter will take before it
transmits them. I set the Sample Rate to one second (3E8)
and the Samples value to one. Thus, the transmitter takes
one sample of the logic level on the AD3-DIO3 pin every
second and transmits it. You can set the IT value as short as
a few milliseconds if you want a faster response.
Remote Module: The REMOTE module has the same
IA setting (FFFF). The D3-DIO3 setting of 5-DO HIGH for its
AD3-DIO3 pin (shown in Table 1) causes this signal to act
as a digital output. The HIGH designation places this output
in the logic-1 state when the module receives power. This
output corresponds to the AD3-DIO3 input on the LOCAL
module. When the AD3-DIO3 output on the REMOTE
module becomes a logic-0, the LED turns on.
If you have two XBee modules, change the
configurations to those shown in Table 1 for each module
and connect them as shown in Figure 4. When you change
the switch setting at the LOCAL module, the LED at the
REMOTE module will turn on or off accordingly, but with a
delay as long as one second. As an experiment, change the
IR value for the LOCAL module to 100 hex for a faster
response at the LED.
Each ADx-DIOx input has a “weak” pull-up resistor
between the input and + 3. 3 volts. Thus, if you do not
connect anything to a digital input pin, that pin goes into a
logic-1 state. The XBee module enables the pull-up resistors
by default. You can disable them if you choose by using a
Note that in this example, the
REMOTE module never transmits any
information about its I/O pins back
to the LOCAL module. In the next
example, you will see how to use a
remote module to initiate
communications and transmit
information to a local module.
FIGURE 4. XBee circuit for remote control
of a digital output.
46 SERVO 01.2013