The V-shaped bottom has a piece of rubber band glued on
for traction. The legs are 1.4” long, 1.2” from the axle hole
to the bottom of the rubber tip, so they hang down 0.3”
below the bottom of the battery box. A front stop (paper
clip) prevents the free-swinging legs from going vertical.
This ensures the bot falls forward when the leg contacts
the ground. To walk straight, the servo alternates raising
the left and right sides. To turn, just one side is repeatedly
lifted. The servo should only lift high enough for the legs to
swing forward. A simple program which suddenly slams the
servo from side to side works, but it’s jerky and uses excess
battery power. Better to have software subroutines which
lift each side gently and return to center.
Figure 8.
A subroutine is a part of a program called with a
GOSUB command. The program execution jumps to that
code. A subroutine always ends with a RETURN command,
which makes execution jump right back to where the
GOSUB was called. Very handy!
Here’s the code used in the first video where it walks
straight for a few steps, turns a bit, then repeats:
servo 4,145 ‘ initialize servo center
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘ position
do ‘ start main DO loop
for b1=1 to 4 ‘ loop to walk 4 steps straight
gosub left ‘ jump to ‘left’ subroutine
gosub right ‘ jump to ‘right’ subroutine
next ‘ end of this for/next loop
for b1=1 to 5 ‘ loop to turn 5 steps
gosub left ‘ jump to left subroutine
next ‘ end of this for/next loop
loop ‘ end main DO loop
Figure 8 shows the parts I used, but robotics is about
improvising, so feel free to use what you have. A large
paper clip is a perfect fit in the servo horn holes. Make sure
the servo is in its center position when the horn and paper
clip are horizontal. Per Figure 9 and Figure 10, the servo is
glued to the battery door just above ground level with a
scrap plastic spacer. Bend the paperclip around the battery
box to make forward-facing horizontal feet on each side.
right: ‘ subroutine for right step
for b0=145 to 170 ‘ loop from center to
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘ right
servopos 4,b0 ‘ move servo
pause 10 ‘ pause 10 milliseconds
next ‘ end of this for/next loop
for b0=170 to 145 step -1 ‘ loop from right to
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘ center
servopos 4,b0 ‘ move servo
pause 10 ‘ pause 10 milliseconds
next ‘ end of this for/next loop
return ‘ end subroutine
The feet should both touch the ground at the same time,
and just clear the battery box when swinging. An additional
video with details is at www.youtube.com/watch?v=
_99Bq5mOFDs.
I used T-pins for my leg axles since they are stiffer than
paper clips; music wire would work too. The axles are
parallel to the ground; about 0.900” above ground level.
The legs are 5/16” dowel rods, drilled 1/16” for the axle.
left: ‘ subroutine for right step
for b0=145 to 125 step -1 ‘ loop from center
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘ to left
servopos 4,b0 ‘ move servo
pause 10 ‘ pause 10 ms
next ‘ end of this for/next loop
for b0=125 to 145 ‘ loop from left to
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘ center
servopos 4,b0 ‘ move servo
pause 10 ‘ pause 10 ms
next ‘ end of this for/next
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘ loop
return ‘ end subroutine
72 SERVO 11.2015