always include a 1K resistor in series
between the two pins. At 5V, this
limits the current flow to 5 mA which
prevents any potential damage to
your project.
Then We Get to the
Meat and Potatoes
When your new EZ range finder
arrives, you can use the schematic in
Figure 3 to install it on your TankBot’s
breadboard. The only aspect of the
circuit that requires explanation is the
100 µF electrolytic capacitor across
the EZ1’s power and ground lines and
the 100Ω resistor in series with the
Vcc line to the EZ1. This is the
combination that MaxBotix
recommends to minimize the power
line noise created by our servomotors.
This noise can be considerable and
can have a negative effect on the
reliable operation of the EZ1, so don’t
forget to filter the power line noise in
any project that includes an EZ1.
Figure 4 is a photo of the EZ1
circuit installed on the TankBot’s
breadboard. As you can see, I have
also left all the IR object detection
circuitry on the board — when you
have finished working with the two
EZ1 programs that we will discuss
shortly, you can experiment with
combining the IR object detection and
ultrasonic range finding functions into
one program. (You didn’t think you
were going to escape without a
homework assignment, did you?)
We will be using two programs
this month: EZ1Term.bas
and EZ1HotSauce.bas.
Download both of them
from the SERVO website
(
www.servomagazine.
com) and print them
out for reference in the
following discussion. Our
first program (EZ1Term.
bas) is a simple test for the
MaxSonar range finder. It
repetitively inputs the
analog distance data from
the EZ1, doubles it to
convert it to inches (as
discussed earlier), and outputs
the data to the PICAXE
Programming Editor’s Terminal
Window. Once you have installed
the EZ1 circuit on your TankBot,
just download EZ1Term.bas to
the bot’s 14M, open the
Terminal Window (under the
PICAXE menu, or just press the
F8 key), and observe the results.
Don’t run the TankBot’s motors
yet — we’ll get to that shortly.
To test my EZ1 setup, I
left the programming cable
attached to my PC and placed
my TankBot on the floor with the
0 end of a 12 foot tape measure
aligned with the front of the EZ1
sensor. For an object to detect, I
used a handy hot sauce bottle
(Doesn’t everyone have several of
them laying around?) because its
3. 5 inch width is as close as I could
get to the 3. 25 inch dowel MaxBotix
used for its testing of the EZ units
(see
www.maxbotix.com/down
loads.html).
Using this setup, I learned a
couple of interesting things. First, the
distance data reported by my EZ1 was
consistently two inches less than the
actual measurement. I’m not positive
about the cause of this discrepancy
but the five volt regulator on my
BrainAlpha board is actually putting
out about 4. 9 volts, which may
account for it. In any case, I took the
easy way out and just added two to
all my readings (but not in the version
of the program that you downloaded)
Figure 3. Schematic of the EZ1
rang-finding circuit.
now my reported distance to an
object is consistently within one inch
of the actual measurement, out to a
distance of eight feet. Between eight
and 10 feet, the EZ1 data is about
two inches off.
Secondly, when I began my
Figure 5. TankBot embarking
on a hot sauce hunt.
Figure 4. EZ1 Circuit Installed
on the Breadboard.
SERVO 07.2009
69