Hardware Reference
In-Depth Information
Step 2: Programming
the Microcontroller to Use
the XBee Module
RF connection
XBee module #1
XBee module #2
OK! Now you're ready to get two microcon-
trollers to talk to each other wirelessly via
XBee radios. For now, you're going to leave one
XBee connected to your computer via the USB
adapter. Once you confirm that's working, you'll
replace your computer with a second Arduino
and XBee. Figure 6-14 shows a diagram of what's
connected to what in this step. In Step 3, you'll
remove the personal computer and replace it
with a second Arduino.
Serial TX/RX
Serial TX/RX
USB adapter
or serial port
Microcontroller
USB TX/RX
Figure 6-15 shows an XBee module attached to a
regular Arduino using the Arduino wireless shield.
Figure 6-16 shows how you'd do it if you were
using just an XBee breakout board instead of a
shield. Note that the XBee is attached to a 3.3V
regulator. The XBee's serial I/O connections are
5-volt tolerant, meaning they can accept 5-volt
data signals, but the module operates at 3.3
volts. The Arduino Uno and newer models have
a more robust 3.3V regulator that can power the
XBee, but it doesn't hurt to add a dedicated one,
as shown here.
Personal
computer
Once your module is connected, it's time to
program the microcontroller to send data through
the XBee. In this program, the microcontroller
will configure the XBee's destination address on
startup, and then send an analog reading when
the reading on analog pin 0 changes significantly.
At right, above
Figure 6-14
XBee #1 is connected to the microcontroller. XBee #2
is connected via USB or serial to the PC. This enables a
wireless link between the PC and the microcontroller.
At right, below
Figure 6-15
Arduino and wireless shield with potentiometer attached
to analog pin 0. This circuit is the same as the one shown
in Figure 6-16, but it's without the LED on pin 9. The LEDs
attached to the XBee are built into the shield.
 
Search WWH ::




Custom Search