piclist 2001\01\29\101758a >
Thread: PIC Robot Update
picon face BY : Tom Handley email (remove spam text)

  This is an update on my effort to design a PIC-based Robot. For those of
you following the earlier dialog with Dan, Steve, Roman, and others on this
subject, I finally have a good (re: great) mechanical platform. After
tearing apart VCRs, tape recorders, and little green men with no shoes and
no hair, I finally decided to just buy a decent gear box from Tamiya. Dan
and Steve already bought the dual motor Twin Gear box which offers ratios of
58:1 or 203:1. It became apparent that it would not have the torque to meet
my needs so I bought the "Worm Gear Box H.E" (High Efficiency), P/N: 72004,
which I'll describe in detail. Note, most vendors charge around $20 for this
but at Tower Hobbies ( http://www.towerhobbies.com ) it's $10.99.

  I had been `hacking' a Radio Shack R/C car that was made for speed, not
robotics. While I learned a great deal during the process, I wanted to start
from scratch with a dual motor, front-wheel-drive system with a single
castor rear wheel. Tank-style treads were also an option but it became
apparent that I would end up with a rather crude vacuum cleaner `clinching'
cat hairs off the rugs... My goal was simply to navigate around a single
floor and to provide a test-bed for various sensors.

  I had an old HeathKit Ultrasonic Intrusion Alarm with a `Book Cover' so
it could hide in your library (remember that kit? ;-). Anyway, it was a good
platform to test Ultrasonics as related to robotic applications. As a bonus,
it has two light gage aluminum (alyouminyum for our friends in the UK ;-)
covers measuring 9" x 6" with about a 1/4" L-bend around the edges. The
`gawds' must have been smiling on me as this was absolutely perfect for my
needs. I found a cheap castor wheel with ball bearings at the local hardware
store for around $3.

  After weeks of searching for a reasonably-priced motor/gear system to
suit my needs, the Tamiya Worm Gear box was ideal for my application. First,
I'm amazed neither Tamiya, nor Hobby stores really promote these motor/gear
boxes as they are ideal for robotics. There are several packages to choose
from. Back to the the Worm Gear box, it comes in a colorful box with a great
deal of detail (can I say that? ;-) on the box and simple instructions in
English and Japanese included with the kit. Yes, this is a kit but it's
trivial to assemble. It provides gear ratios of 216:1 and 336:1 which is
what I'm using. The motor is a Mabuchi F160-style but there was no part
number so I don't have the exact specs. It also supports Mabuchi F140-style
motors and includes an adapter to mount the smaller motor to the grear box.
I'm impressed with the attention to detail when it comes to the included
accessories. In addition the the housing, the motor, and gears, you get a
`star/crossbar' attachment, two levers, and a wheel with 6 holes for an
optical sensor. They also include a spacer tool molded into the plastic jig
that holds the parts. This is used to set the worm gear on the motor shaft.
To top it off, they include a lubricant for the gears. I wish they included
a little more of that but it was not a problem even after tearing the
assembly apart and modifying it for an IR sensor (see below). The main shaft
is 80mm with 6mm threaded on each end and a groove for included E-rings as
well as holes with spring-pins to mate with the external attachments. In
most cases, they included extra hardware. They even provide an extra shaft
and a `crude' plastic assembly to hold it. The extra shaft is identical with
the exception of lacking the holes for the spring-pins. Another nice,
although trivial touch, is the included Allen wrench to set the drive shaft
hex fitting that mates with the shaft gear. Again the motor is a Mabuchi
F160-style and operates from 3V to 4.5V. You can easily add your own motor
that fit's the F140/160 form factor and shaft diameter.

  After assembly and mounting the two gear boxes, my next priority was
some form of tachometer. I first looked at modifying the gear box to get an
optical pickoff from the higher speed gears but there was no room without
some precision mechanical work. I have a Dremel tool. The included wheel
with six holes mounts nicely on the unused end of the shaft but it turns too
slow for a tach. I tried `reverse gearing' to take the other ratio gear and
drive another gear for a higher speed but I was unable to fabricate a
housing with what I had on hand. It's still an option. I ended up going back
to the gear housing and moving back a gear, drilling 4 holes in the gear and
two holes in the housing with a matched IR emitter/detector pair. This feeds
into a LMC662 dual Op Amp with a rail-rail output. It's configured as a
simple comparator with a little hysteresis. At around 3V, I'm getting 9-10
PPS, too slow for a tach for a robot in a house but still useful for
distance measurements and long-term speed feedback. To turn with two motors,
you either shut off one and drive the other or drive one forward and the
other in reverse (pivot around a point). I prefer the latter and I've tested
both. If you decide to use a dual motor drive with a rear castor, spend a
few $ and get a good castor with ball bearings. This thing runs in reverse
in a straight line and I'm impressed. Actually, the differences between the
two motor's speed is so small that I really don't need a tach to keep it
going straight.

  As far as motor control, I had built several H-Bridges based on various
MOSFET configurations. Bipolar designs were not an option since I was
running off of batteries and I wanted efficiency. I won't join the MOSFET vs
BIPOLAR debate other to say that MOSFETs are more efficient and just as
reliable despite apparent failures in VCRs ;-). My favorite was two
P-channel and two N-channel HEXFETs but it was mainly designed for 6-24V
motors. Since these motors run off 3-4.5V, I went back to an all N-channel
design with a 12V switching regulator to provide gate bias and source
another 5V switching supply for 5V logic. I used TI devices with a 2V Vgs
for the low side of the bridge and since I had some HEXFETs with a 4V Vgs, I
used them for the high side of the bridge. All of the devices had built-in
diodes. The TI devices combined dual MOSFETs in one package with common
Drain and common Source versions which are ideal for this application but
for some `Lord only knows' reason, TI canceled the product and there is no
second source... I was fortunate to still have some engineering samples.
Though the design is an overkill for these Mabuchi motors, I can run up to
6A without a sink due to the low Rds. The board is 4x2" and in addition to
the H-Bridge, it supports the 12V and 5V supplies, the dual tach signal
conditioners, and a 3.3V/3A low-dropout linear regulator to provide a
constant voltage to the motors. This get's around the problem of low battery
conditions so I don't have to worry about that affecting the motor
performance. Note, these supplies are very efficient with extremely low
quiescent current. The motor supply is 4 AA batteries and is seperate from
the main Logic supply for the CPU and sensors which uses 6 AAs. Finally,
there is a 16F84 controlling the motors and monitoring the tach. Again, I
wanted to keep this modular. Right now the host CPU uses 4 lines to control
the direction and to turn the motors On and Off. This will end up as a
single serial line for motor control with another serial line for tach
feedback so the host CPU can use the data for distance measurements. With
the current tires, I get 16 pulses per revoloution and each revoloution is

  The current status of sensors are simple bumper switches made from stiff
steel wire and microswitches with levers. I've finished testing an IR sensor
with Left, Middle, and Right outputs. Basically, it uses the 40KHz Sharp
sensor with a 12C508 modulating Left and Right IR LEDs. Again, this is just
another module for the host CPU. I looked at several designs and one problem
that always comes up is that these sensors can be too sensitive. Some
designs fix or vary the IR LED resistor. I've found it easier to just
`de-tune' the modulator frequency. My design varies from 32KHz to 40KHz.

  The next step is adding the Ultrasonic sensors. They will be mounted on
an R/C servo. The one I have will do 180 degrees and is rather unusual in
that the pulse varies from around 0.8 to 2ms. It acts like a normal servo
within the typical 1 to 2ms range. This will be another PIC-based module.

  The host CPU is currently a 16F876. I have several `test beds' built on
MicroEngineering Labs' proto boards. I've drilled holes for boards
supporting both the 28-pin and 40-pin devices. My 40-pin proto board
supports a 16F877, a custom Lattice CPLD and 512KByte SRAM. Both boards
support a keypad and an LCD interface as well as an SPI port and auxillary

  The current state of software is rather crude. Right now the bot can
roam around, even climb the thick braided rugs on the hardwood floors,
bump into things, backup, and more often than not, get around objects.

  BTW, I named it Bozoterous or Bozo from an old Firesign Theater Album.
If you have not heard of that album, you are young, if you have, you are
an old fart like me ;-)

  - Tom

Tom Handley
New Age Communications
Since '75 before "New Age" and no one around here is waiting for UFOs ;-)

http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


See also: www.piclist.com/techref/microchip/devices.htm?key=pic
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) PIC Robot Update

month overview.

new search...