This is only a preview of the July 1999 issue of Silicon Chip. You can view 36 of the 96 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Items relevant to "A 10µH to 19.99mH Inductance Meter":
Items relevant to "An Audio-Video Transmitter":
Articles in this series:
Items relevant to "An X-Y Table With Stepper Motor Control; Pt.3":
Purchase a printed copy of this issue for $10.00. |
Microcontroller Fun:
The Hexapod Robot
Hexapod? It’s a weird name for a weird looking animal.
It “walks” on six legs. How on earth can something
walk on six legs? Build it and find out!
By Ross Tester
84 Silicon Chip
The kit unpacked: the large yellow sheet contains the mechanical components to be assembled onto the Hexapod body.
The three servos and their actuator arms are at the top – the circular actuators already fitted are discarded. The manual
on the left is for the BASIC Stamp controller, the manual on the right is for the robot itself.
T
he Hexapod Walker is a fasci
nating little kit which will pro
vide a lot of enjoyment – not
only in building it but seeing what
it does. And it will give you a good
insight into basic robotics (and you
will see shortly that basic plays a significant part!) plus computer control.
When completed, the Hexapod
Walker also looks like a large insect.
In operation it looks somewhat like a
large insect, whirring along as it somewhat clumsily moves along one step
at a time. But it’s no accident that the
Hexapod looks like an insect: that was
obviously the designer’s idea. In fact,
options are given in the instructions
to make it look even more insect-like.
What you get
The Hexapod Walker kit is supplied
as a number of bags of “bits” and
the walker components themselves
stamp-ed from a large-ish sheet (about
300 x 200mm) of bright yellow plastic,
about 3mm thick.
The Hexapod “body” is of the
same material but about 7mm thick.
Incidentally, if you want to change
the colour (bug black, maybe?) it can
be spray-painted with acrylic lacquer
such as auto touch-up spray paint.
The bags of bits contain almost all
the components you need to put the
robot together. For example, there are
three servos (the type used in most
radio controlled cars/planes/boats,
etc), along with various control arms
to suit. You’ll only need one type of
arm so the rest can go into your junk
box – just in case.
There’s another bag containing a
small PC board (about 37 x 57mm)
and all the components you’ll need
to build the BASIC Stamp robot controller. Did we forget to mention that’s
how the robot is driven? Sorry!
Yet another bag contains “hardware” – Nylon screws and nuts, a
couple of battery holders, some rubber
feet, tinned copper wire and so on,
with all the above housed in a large
bag which also contains an assembly
manual and microcontroller manual,
along with a program floppy disk.
What you don’t get
There are a couple of things you’re
going to have to buy, scrounge or otherwise procure before you can build
the robot. We’ll warn you about them
now because when we started to put
the kit together it was after the local
shops had closed and we had to wait!
The most important thing is some
double-sided foam adhesive. This is
sold by hardware stores for sticking
photos, mirrors and anything else to
walls. It’s also available from large
supermarkets. We used a packet containing 32 mounts pre-cut into 10 x
20mm rectangles. It’s a handy way
to buy them (ours were “Permastik”
brand and cost about three dollars for
the packet).
You’ll also need some super glue
– not just ordinary super glue, but
the gel variety. Super Glue Gel gives
a slightly longer working time and
is less likely to stick your fingers together. But like ordinary super glue,
it does go off fairly quickly and it can
stick your fingers together if you let
it. We used Selleys Fix’n’Go Supa
Glue Gel – a 3g tube also cost about
three dollars.
A sheet of sandpaper is also required to smooth the edges of the robot
components where they break away
from the carrier sheet.
JULY 1999 85
The kit requires two power
pins (the gap between the pins
sources – a 9V battery for the
is very small).
processor and 4 x 1.5V “AA”
Don’t place the ICs in their
cells (6V) for the servos. None
sockets yet.
of these are supplied in the
The pin spacing for the
kit. Alkaline batteries would
three sets of header pins is
of course be preferable.
also very close, so be extra
As far as tools are concareful when soldering these
cerned, you will need a sol(especially the middle row
dering iron (with a nice fine
of the three-way set!). The
tip) and solder (electronic
short-er pins go through the
type, of course!), a PhilipsPC board to be soldered.
head screwdriver and a pair
Place and solder in the RJ11
of pliers with cutting blade (to
connector (it can only go one
cut and bend the wire).
way) followed by the two
One option which is almost The assembled First Step BASIC Stamp controller. It
3-pin semiconductors (these
essential (unless you want to is programmed from a PC via the large socket on the
could, with difficulty, be inright which looks like a telephone connector.
make your own) is the proserted incorrectly!).
gramming cable: a short cable
Finally, insert the 18-pin
fitted with a standard computer parallisted in the manual are actually sup- and 8-pin ICs into their respective
lel port plug one end and an RJ-11 plug plied. The way the bags are sealed
sockets. This is one area where a lot
(what looks like a modular tele-phone
of problems occur; you have to ensure
it would be very surprising to find
plug) the other. Be warned: it’s NOT to anything missing (but stranger things all the IC pins are inserted into their
be plugged into the telephone socket; have happened. . .)
mating sockets. It’s easy for pins to
this is the plug which enables you to
Start by placing and soldering in the be bent in this process, so take care.
program the Hexapod from your PC.
You have now finished the controlresistors except R4 & R5 (10kΩ). These
Oh yes, you need a PC of some sort, are not required in this version of the ler board. After thoroughly checking
too (just about any IBM-compatible kit. They won’t do any harm but they your soldering and component placewill do). In fact, it’s a perfect appliment, put it to one side while we get
will drain the battery slightly.
cation for that old XT gathering dust
Next, fit and solder the three capac- on with the fun bit: the robot!
in the back shed!
itors (one is an electrolytic, so watch
Building the robot
its orientation) and then the ceramic
Starting construction
Unfortunately, the instruction manresonator (not polarised).
You can start with either the robot or
Both ICs are provided with sockets; ual for the robot is a little disjointed
the microcontroller board – but seeing
the 8-pin socket for the EEPROM and and some important information is
we’re an electronics magazine, we’ll
the 18-pin for the PIC processor. Care- unclear. So we will try to cover that
start with the controller.
fully solder in the sockets, making here.
First, verify that all the components sure you do not bridge between the
The first step, according to the man-
Fig.1: the circuit diagram of the Hexapod’s microcontroller which
itself is programmed from a PC via the modular programming port,
CN1. While the output header has labels for four servos (0-3), only
three are used in the kit. Other pins can be used for microcontroller
I/O – RB6 and RB7 can have bumper microswitches fitted if you wish.
86 Silicon Chip
The first steps in assembling the
Hexapod are the mounting of the
servos on the underside of the base
panel (Fig.2, left) and the gluing in
place of the vertical leg supports and
spacer bracket (Fig.3, right).
ual, is to centre the servos by applying
a 1.5ms pulse every 10-15ms.
How? You need to do it via the
controller board you have just finished
and by running a program on your
PC which downloads the appropriate program to the controller board.
Great if you’re into BASIC programming; hardly the stuff beginners or
even the average kit constructor will
get their head around quickly.
If you wish to do this correctly, you
should jump over to the “programming” section at the end of this article
and follow the instructions there. But
if you’re like us, in a hurry to get the
robot going, you can cheat a lot and
centre the servos by eye. Sure, it won’t
be exactly correct but our kit worked
doing it this way, so what the heck?
Screw one of the servo actuators
onto the servo arm with the screw
provided. Turn the servo actuator all
the way clockwise and place a reference mark on the servo arm at the end
point. Turn the actuator all the way
anti-clockwise and place another ref-
erence mark on the servo arm at that
end point. Half way between those
two marks will be close enough to the
midpoint for our purposes. Repeat for
the other two servos.
Now it’s time to carefully break all
of the components from the carrier
sheet. We didn’t have any difficulty
doing this – just take your time and
don’t force any pieces. If necessary,
help them a bit by cutting with a knife.
The largest piece is, not surprisingly, the robot “body”. There will also be
four identical back-and-forward legs,
two identical up and down legs, eight
leg support brackets, two identical
vertical leg supports and a leg support
spacer. Smooth any carrier sheet remnants from all the components with
sandpaper before continuing. Put all
of the legs and support pieces to one
side for a moment.
Now we have to fit the servos to
the robot body with double-sided adhesive foam. First, with a pencil and
straight edge, mark a centre line right
down the length of the body (there are
reference marks each end to help you
do this). Then mark one line across
the body (exactly at right angles to
the first line) 85.5mm from the front
and another 25.5mm from the back.
Next you will need one of the servos, one of the slim actuator arms (not
the circular ones) and the actuator arm
retainer and screw.
Place the servo on its side with the
shaft pointing towards you and the
wires emerging from the right end.
Keeping the servo shaft in mid position, place the retainer onto the shaft
and screw the arms on so the actuator
points 90° straight upwards. Tighten
the screw holding the actuator arm in
place, making sure you don’t move
the servo off mid position. Once all
servos are in position you won’t have
access to this screw, so make sure it
is right first!
In fact, it’s a good idea to do a “dry
run”, placing all the servos without
adhesive to make sure you understand
how they all fit together.
When ready to permanently mount
Next comes the mounting of the support
brackets (Fig. 4, left) and the fitting of
the legs (Fig.5, right). Note the way the
holes in the support brackets all face
towards the middle legs.
JULY 1999 87
Once all the legs are fitted, you need to bend the pushrods from
the wire supplied so that the servos can drive the legs. The two
diagrams here show how those pushrods are fitted. When you
get to this stage, your robot is mechanically complete – all you
need to do now is add the electronics and batteries.
the first one, attach a couple of adhesive foam tabs to the underside of the
servo and fix it exactly to the centre
of the robot body so that its back lies
along the line you ruled closest to the
front of the body. When mounted, its
actuator points down (away from the
robot body).
The other two servos are prepared
and mounted in a similar way, except
that when mounted, the servo actuators point straight up with the servos
back-to-back along the centre line.
Their back edges follow the line you
ruled towards the back of the robot
body. This means the adhesive foam
pads actually stick to opposite sides
of the servos.
Now you have to make the vertical
leg supports, using the two support
pieces with their central spacer.
Before gluing, place the two vertical
legs in position with their two Nylon
nuts & bolts.
It’s vital that you don’t get any glue
on the legs themselves, otherwise they
won’t be able to move. When this assembly is dry, glue it to the TOP side
of the robot body (it fits into notches
on the body). Again, keep glue away
from the legs.
Next come the horizontal leg support “hinges” which are glued directly
to their respective legs. You will note
that there are two holes on the hinges
– these holes must be aligned in the
same direction for each hinge.
The hinges on the front legs have
their holes to the rear; the hinges on
the back legs have their holes to the
front.
It’s also important that the hinges
88 Silicon Chip
are assembled exactly in line with
each other – placing the Nylon bolt
through each will line them up for
you.
Finger-tighten all of the Nylon nuts
and bolts and glue the hinges to the
legs, making sure you don’t get glue on
the faces of the hinges or on the base.
Now all the legs and their fittings
are assembled, it’s time to make the
pushrods which connect the legs and
their respective servos together. This
is done with the tinned copper wire.
Be careful here: there is just enough
supplied to do the job.
Before using the wire, it’s a good
idea to straighten it by nipping one
end in a vice and pulling the other
end hard with a pair of pliers.
The legs can be mounted at 90° to
the body, which is most efficient, or
they can be mounted at, say, 10 degrees offset – which looks more like a
bug! It’s up to you which way you go.
Cut two 200mm lengths and mark
them (with a Texta or similar) at 30,
80, 130 and 180mm. Bend the wire at
90° at 30mm and push the longer end
through the two holes in the centre
leg brackets. Push the other end right
through one of the pair of holes in a
front leg hinge set and bend it back to
make it captive in the hinge set.
Bend the wire at the 80mm and
130mm marks about 15° in a horizontal direction, with the mark at 180mm
at 90° in the vertical direction. The
free end then passes through a pair
of holes in the rear hinge set and is
bent over underneath to make captive.
Snip the ends off the wire to make sure
they don’t foul anything as the legs are
moved backward and forward.
The other piece of wire, for the
opposite side, is prepared the same
way. Exact angles are less important
than making the two pieces of wire
symmetrical.
The rear legs connect to their respective servos with short (83mm)
lengths of the same wire. These go
through the other holes in the rear
hinges and connect to one of the
holes in the servo actuators. We used
the second hole from the top which
seemed to work pretty well.
The centre legs connect to the centre
hole in the remaining servo with the
remaining length of wire. It must be
bent in an elongated “S” shape as per
the diagram. Naturally, you will have
to thread the wire through some of the
holes before bending – the angles are
too acute to allow it to pass through
otherwise.
Now see if you can move the front
legs by gently pushing on the rear legs
and vice versa. Don’t push too hard
because you’re also turning the servo.
Wiring the beast
It really is starting to look like a
beast, isn’t it?
The controller PC board and 4 x AA
cell holder are glued to the top side
of the body with the same adhesive
foam we used to glue the servos in
place (lucky there were 32 foam tabs
in the pack!). The 9V battery holder is
glued to the underside of the body in
front of the vertical leg servo.
Now we have to run the wiring
from the servos to the controller – and
here’s where you can come unstuck.
We believe the instructions are not
clear enough in telling you which
way around the 3-pin servo plugs go
on the header pins. The circuit diagram in the “First Step” manual has
the wire colours shown but doesn't
tell you which way around they go
on the socket – and they could be
placed either way around. The wiring
diagram in the kit manual is not 100%
clear, either. It would be too easy for
anyone not familiar with electronics
to get it back to front. And then there
is the dire warning about not getting
it back to front . . .
In all cases, the black wires in the
servo connectors go to the header pins
closest to the edge of the PC board.
This makes the red wires go to the
middle pins while the yellow wires,
the ones which receive direction information from the controller, connect
to the pins closest to the controller IC.
It is also possible to get the wrong
servo on the wrong set of header pins.
The left servo goes to the pins labelled
Servo-0, the right to the pins labelled
Servo-1 and the middle to the pins labelled Servo-2. When mounted, both
their actuators point up, alongside
the body. The servos are taken care
of, now for the power wiring.
In the kit we built, two power
switches were included which make
it very easy to turn power on and off.
The alternative is to whip a battery
out but that is sometimes not quite so
easy with the thing going walkabout!
Wiring the battery connectors to the
switches is the easy part. Connecting
the switches and negative supplies
to the PC board – well, that wasn’t
quite so simple. We could only find
two header connectors supplied in the
kit – one red, one black. And there are
four connections to make: +9V, 0V,
+6V and 0V. What to do?
We cheated. We cut the header
connector leads to a suitable length,
giving us four header connectors.
These we soldered to suitable lengths
of insulated hookup wire and connected those to the switches and battery
holders. Of course we also insulated
the soldered joins.
We’ve been assured by the suppliers
that more connectors will be supplied
in future kits so this problem should
not occur.
The switches themselves are the
standard mini toggle switches, complete with nuts and washers. However, we found that they were such
The battery holders and the
microcontroller PC board
are attached using doublesided foam tape.
Be careful to
keep wiring away
from the pushrods
or legs.
a snug fit into the two holes right at
the back of the robot that no nuts or
washers were required. That bit is
up to you.
Finally, we used a couple of cable
ties to tidy up all the wiring. Because
the servo leads can’t easily be shortened, there is a fair amount of excess
wire around. And the last thing you
want is a wire dragging along the
pushrods as they move back and forward, back and forward . . .
The penultimate step is to check
your wiring and all clearances, making sure that the legs move in unison
with each other.
If all is OK, insert the 9V battery and
the four AA batteries and switch on.
Hopefully, nothing at all will happen!
Programming it
That’s because you haven’t programmed the Stamp controller yet,
so the beast hasn’t got a brain to tell
it what to do.
The first thing to do is to load the
supplied software into a directory
on your hard disk drive (it will work
from floppy if you must!). Make a
directory called stamp1 and copy
all the files from both the “stamp1”
and “Hexapod” directories on the
supplied floppy disk to that directory.
Connect the supplied cable to your
computer’s parallel (printer) port and
the RJ-11 socket on your robot. You
OK, How Does Hexapod Walk?
The principle behind walking
with the 3-servo robot is simple. One of the servos is used
to provide vertical lift to legs
1,3,5 or 2,4,6. The other servos
provide the horizontal shift for
the left legs, 1 & 3, or the right
legs, 4 & 6. By cycling through
the sequences to the right the
robot can walk forward, reverse
or turn left or right.
To walk forward, follow the
sequence 1,2,3,4 then repeat.
To walk backwards, follow the
sequence 4,3,2,1 then repeat.
The same rule applies to turning
sequences. You can experiment
with the amount of throw for the
servos and the type of feet with
different floors.
JULY 1999 89
These are the screens you should see on your PC: above, we
have loaded stamp1.exe and then pressed “ALT-L” to list
the available PBASIC programs. Selecting “WALK.BAS”
loads the program to make Hexapod walk. This is displayed
in the screen top right. Pressing “ALT-R” will download
this to your Hexapod, as shown bottom right (assuming, of
course, that the cable is connected AND the 9V supply is
turned on). Turning on the 6V supply should start
Hexapod walking. It’s wise to disconnect the cable first,
though! Turning off the power switch or even removing
the batteries will not alter the program: it will stay in the
robot’s memory for at least 40 years or until it is replaced,
which ever comes first . . .
will need to turn the 9V supply on
but the 6V supply doesn’t need to be
on yet (in fact, it’s more convenient
not to have it on unless you want to
be chasing the little beast all over the
place!).
Run the stamp1.exe program. This
brings up the screen shown above.
Load the appropriate BASIC program.
Alt-L will list the available files for
you; Alt-H will give you a list of
valid commands. After loading the
program, press Alt-R to download it
to the controller on your Hexapod. It
will begin running automatically – as
soon as you turn the 6V supply on, the
legs should start to move.
If it doesn’t, you will probably already have received a “hardware not
found” error on your screen. Check
that the 9V battery is OK, that it is
turned on and that there is power getting to the board. You can also check
that the on-board regulator is working
by measuring the voltage between pin
6 and pin 8 on header H1 – you should
get very close to 5V.
If this doesn’t work, make sure that
the cable is properly plugged into
both your parallel socket and the RJ11
socket on the robot. If all else fails,
go over your soldering once again and
check the placement and polarity of
the components on the board.
Assuming that everything is now
working properly, disconnect the
programming cable. Next time you
turn Hexapod on, he/she/it will go
90 Silicon Chip
lumbering away again, exactly as
before. That’s because the program
stays in memory until erased (or
another program is loaded, which is
effectively the same thing).
In fact, the manufacturers of the BASIC Stamp say that if you come back
in 40 years time and turn the Hexapod
on, it will still have the program in
memory. We think you might need
some fresh batteries, though!
What to do next
Once you are completely satisfied
with Hexapod’s operation, we suggest
once again tightening up the Nylon
Where To Get It:
Our Hexapod Robot Walker Kit
came from the Australian distributors of Lynxmotion products, RobotOz, 7 Felgate Place, Warwick,
WA 6024. Phone 08 9243 4842;
fax 08 9246 1563, email kits<at>
robotoz.com.au
Recommended retail price of the
kit, including the BASIC Stamp
microcontroller, is $320.
The optional infrared proximity
detector sells for $65 and the programming cable $10.
For more information, visit the
RobotOz website www.robotOz.
com.au The kit is manufactured
in the USA.
Assembly drawings in this article
courtesy Lynxmotion, Inc.
nuts & bolts (finger tight), then melting them slightly with your soldering
iron. We found in operation the nuts
continually working loose – and every
now and then poor old Hexapod
would “throw a leg”. An alternative
to melting (and therefore damaging)
the nuts and bolts would be a tiny
dab of glue.
There are quite a few programs to
try out on the disk which make the
robot do various things. Or if you have
web access you can try downloading
others from the manufacturer’s website, www.lynxmotion.com
You can also add other hardware
to your robot: an optional infrared
sensor is available which stops the
robot hitting objects. A cheaper option
is to fit a couple of microswitches
to the front of the robot as bumper
switches, connected to I/O pins 6 and
7 of the header socket. If the robot hits
anything, the switches tell the legs to
stop walking.
In this case, those two resistors
(R4, R5) we said to leave out at the
beginning, need to be fitted!
Remember, too, that the controller
on the robot is a full-blown PBASIC
Stamp microcontroller, not dissimilar
to that we used in the article “Getting
Going With BASIC Stamp” in the
January 1999 issue of SILICON CHIP.
You can write PBASIC programs or
download loads of them from websites
to do a whole lot of things apart from
SC
move your robot’s legs!
|