Hardware Reference
In-Depth Information
NOTE: Air out your workspace as soon as you've tested the sensor.
You don't want to poison yourself making a poison sensor!
ATMY1, DLFFFF\r
ATID1111, D02, IR64\r
ATIT5, WR\r
To test whether the XBee is reading the sensor correctly,
connect its TX pin to the USB-to-XBee serial adapter's TX
pin, its RX pin to the adapter's RX pin, and connect their
ground lines together. Make sure there's no XBee in the
socket when you do this. You're just using the adapter to
connect to this circuit. Then plug the adapter into your
computer and open a serial connection to it. Type +++ and
wait for the OK . Then type ATIS\r . This command forces
the XBee to read the analog inputs and return a series of
values. You'll get a reply like this:
For the monkey radio, the configuration is:
ATMY2, DL1\r
ATID1111, P02\r
ATIU1, IA1, WR\r
And for the Arduino's radio, it's:
ATMY3, DL1\r
ATID1111, IU1, WR\r
1
200
3FF
The Circuits
Once you've got the radios configured, set up the circuits
for the sensor, the monkey, and the Arduino. In all of these
circuits, make sure to include the decoupling capacitors
on either side of the voltage regulator—the XBee radios
tend to be unreliable without them.
Don't worry about what the values yet; all that matters is
that you're getting something. You'll see the actual values
as the project develops later.
The sensor circuit
The gas sensor takes a 5V supply voltage, so you need
a 5V regulator for it, a 3.3V regulator for the XBee, and a
power supply that's at least 9V to supply voltage to the
circuit. A 9V battery will do, or a 9-12V DC power adapter.
Figure 7-5 shows the circuit. The gas sensor's output
voltage should stay below 3.3V under the most likely shop
conditions, but test it before connecting it to an XBee.
Connect and power the circuit, but leave out the wire con-
necting the sensor's output to the XBee's analog input.
Power up the circuit, and let it heat for a minute or two.
The circuit takes time to warm up because there's a heater
element in the sensor. Measure the voltage between
the sensor's output and ground. You should get about
0.1 volt if the air is free of volatile organic compounds
(VOCs). While still measuring the voltage, take a bottle
of something that has an organic solvent (I used hand
sanitizer, which has a lot of alcohol in it), and gently waft
the fumes over the sensor. Be careful not to breathe it in
yourself. You should get something considerably higher—
up to 3 volts. If the voltage exceeds 3.3V, change the fixed
resistor until you get results in a range below 3.3V, even
when the solvent's fumes are high. Once you've got the
sensor reading in an acceptable range, connect its output
to the XBee's analog input pin, which is pin 20. Make sure
to connect the XBee's voltage reference pin (pin 14) to 3.3
volts as well.
The monkey circuit
To control the monkey, disconnect the monkey's motor
from its switch and connect the motor directly to the
circuit shown in Figure 7-6. The monkey's battery pack
supplies 3V, which is enough for the XBee radio, so you can
power the whole radio circuit from the monkey. Connect
leads from the battery pack's power and ground to the
board. If your monkey runs on a different voltage, make
sure to adapt the circuit accordingly so that your radio
circuit is getting at least 3V. Figure 7-7 shows the modifica-
tions in the monkey's innards. I used an old telephone cord
to wire the monkey to the board.
The cymbal monkey circuit takes the variable output that
the radio received and turns it into an on-off switch. The
PWM output from the XBee radio controls the base of a
TIP120 transistor. The monkey itself has a motor built into
it, which is controlled by a TIP120 Darlington transistor
in this circuit. When the transistor's base goes high, the
motor turns on. When it goes low, the motor turns off. The
motor has physical inertia, however, so if the length of the
pulse is short and the length of the pause between pulses
is long, the motor doesn't turn. When the duty cycle (the
ratio of the pulse and the pause) of the pulse width is high
enough, the motor starts to turn.
 
Search WWH ::




Custom Search