Hardware Reference
In-Depth Information
You'll be building three separate circuits for this project, so
the parts list is broken down for each one. Most of these
items are available at retailers other than the ones listed
here,.
• ATID1111: Sets the PAN.
• ATP02: Sets PWM pin 0 (P0) to act as a PWM output.
• ATIU1: Sets the radio to send any I/O data packets out
the serial port. This is used for debugging purposes
only; you won't actually attach anything to this radio's
serial port in the final project.
• ATIA01 or ATIAFFFF: Sets the radio to set its PWM
outputs using any I/O data packets received from
address 01 (the sensor radio's address). If you set this
parameter to FFFF, the radio sets its PWM outputs
using data received from any radio on the PAN.
Radio Settings
Connect one of the radios to the USB-to-XBee serial
adapter. You'll use this for configuring the radios only.
You've got three radios: the sensor's radio, the monkey's
radio, and the Arduino's radio. In Chapter 6 you saw how
to configure the radios' addresses, destination addresses,
and Personal Area Network (PAN) IDs. In this project, you'll
see how to configure some of their I/O pins' behavior.
For example, you can configure the digital and analog I/O
pins to operate as inputs, outputs, or to turn off. You can
also set them to be digital or analog inputs, or digital or
pulse-width modulation (PWM) outputs. You can even link
an output pin's behavior to the signals it receives from
another radio. (If you don't remember how to configure the
XBee, see Step 1 in Project 10).
The Arduino's radio listens for messages on the PAN and
sends them out its serial port to the XBee. This radio's
settings are the simplest, as it's doing the least. Its
settings are as follows:
• ATMY03: Sets the radio's source address.
• ATDL01: Sets the destination address to send only to
the sensor radio (address 01). It doesn't really matter,
though,as this radio won't be sending.
• ATID1111: Sets the PAN.
• ATIU1: Sets the radio to send any I/O data packets out
the serial port. This data will go to the attached Arduino.
The sensor radio is the center of this project. You'll configure
it to read an analog voltage on its first analog input (AD0,
pin 20) and broadcast the value that it reads to all other
radios on the same PAN. Its settings are as follows:
NOTE: If you want to reset your XBee radios to the factory
default settings before configuring for this project, send them the
command ATRE\r .
• ATMY01: Sets the sensor radio's source address.
• ATDLFFFF: Sets the destination address to broadcast to
the whole PAN.
• ATID1111: Sets the PAN.
• ATD02: Sets I/O pin 0 (D0) to act as an analog input.
• ATIR64: Sets the analog input sample rate to 100
milliseconds (0x64 hex).
• ATIT5: Sets the radio to gather five samples before
sending, so it will send every 500 milliseconds
(5 samples x 100 milliseconds sample rate = 500
milliseconds.
Here's a summary of all the settings:
Sensor radio
Monkey radio
XPort radio
MY = 01
DL = FFFF
ID = 1111
D0 = 2
IR = 64
IT = 5
MY = 02
DL = 01
ID = 1111
P0 = 2
IU = 1
IA = 01 (or FFFF)
MY = 03
DL = 01
ID = 1111
IU = 1
The monkey radio will listen for messages on the PAN, and
if any radio sends it a packet of data with an analog sensor
reading formatted the way it expects, it will set the first
pulse width modulation output (PWM0) to the value of the
received data. In other words, the monkey radio's PWM0
output will be linked to the sensor radio's analog input.
Its settings are as follows:
Make sure to save the configuration to each radio's
memory by finishing your commands with WR . You can
set the whole configuration line by line or all at once. For
example, to set the sensor radio, type:
• ATMY02: Sets the monkey radio's source address.
• ATDL01: Sets the destination address to send only to
the sensor radio (address 01). However, this doesn't
really matter, as this radio won't be sending.
+++
Then wait for the radio to respond with OK . Next, type the
following (the 0 in D02 is the number 0):
 
Search WWH ::




Custom Search