time. Driving servos into their mechanical stops can damage
them. Proceed cautiously. Also be aware that if the battery
discharges too far, erratic servo operation can occur. Turn
off the power immediately!
Okay, we’ll now power-up Loki’s controller with ONLY
servo #0 connected. Next, turn on the servo power, being
careful to hold up Loki by the body, and WATCH YOUR
Issue the command #0P1600<CR> from the terminal.
Servo #0 is the right knee; it should move a little. This is the
basic servo command. You should experiment with the
servo command to familiarize yourself with it and to check
out the other servos, as well. Try some other positions, such
as 1800 and 700. Add T1000 to the servo command, or
issue it by itself to set the move time at 1,000 ms (default).
Try other move times.
You’ll find out that the servos have limits assigned to
their travel. For example, 700 and 1779 are the limits for
servo #0. There are similar limits for the other servos. These
limits prevent Loki from kicking himself.
As mentioned earlier, with the servo horns only
allowing rough squaring, we save a calibration value for
each centered servo position. The servos can be finely
adjusted from a terminal program by setting up your
terminal program to send the strings #nP+ 25<CR> and
#nP- 25<CR> when buttons are pressed. These buttons can
then be used to jog the joint up or down to the required
position; ‘n’ is the servo number and the ‘ 25’ is the amount
to move. Change the amount to suit your taste. The goal
is to have the feet flat on the table, parallel, and about
1/2” apart. Record the location of all four servos (offsets
are 0 at this point).
After getting the servos where you want them, the
calibration values are sent to Loki’s controller via the
command #n PO nn <CR>. The servo number is n, and the
centered position is nn. All four servo offsets can be sent
in one command, if desired. The offset values will be
calculated and stored in EEPROM. The centered or “left foot
forward” position of Loki’s legs will be normalized to 1500
with the offsets. A position of 0 results in the servo going
to sleep (PWM pulses cease).
Loki’s First Steps
Now that we’ve got the servos moving, we can take a
little walk! A C1<CR> command will command a single gait
cycle, and K1 will initiate a continuous walk. The walk can
be stopped by a R<CR> command. Note that Loki always
finishes out his gait cycle to the left foot forward posture.
This is to ensure that the feet are in a known position,
which minimizes the possibility of Loki getting his feet
A C3<CR> Partial Right Turn or C5<CR> Partial Left Turn
can also be executed. Three will be needed to complete a
full 90 degree turn.
Loki Crosses the Pond — Part 2
With a terminal connected, the U (ultrasonic sensor)
and I (IR sensor) commands can be issued from a terminal
to conveniently test Loki’s sensors. Note that distances less
than about 4” are invalid for the IR sensors.
Issuing walk commands with the servo power turned
off can also be used to view the range values and various
walk sequence states on a continuous basis.
After Loki is successful in taking a few walks, the
autonomous mode can be tried. Press SW3 to start Loki.
Objects should cause Loki to turn. An object too close will
cause Loki to shut down.
Other Board Uses
I found the QuikFlash board a very useful and
convenient board to use. It is also inexpensive and perfect
for other small robots. I’m already looking at it for another
Up to eight servos could easily be accommodated with
additional connectors. Although Loki is a legged bot, one
could also drive R/C servos modified for continuous rotation
and use them to build a small wheeled robot (I’m a leg
man, personally.). The navigation portion of the software
would be a little different, but the section of the code
driving the servos would probably be the same. And don’t
forget robotic arms! Just add software.
This is only the beginning for the controller board and
Loki! A custom control board for Loki is envisioned, which
would eliminate the need for hand-wiring servo and sensor
connectors in the prototype area.
On the software side, it is anticipated that more
behaviors will be added, and improvements made over the
rudimentary “rules” that currently suffice for subsumption.
Sequence entry to the EEPROM is at its infancy, to say the
least, and currently no fast download of sequences from a
terminal is available. SV
Loki and author Alan, KM6VV.
SERVO 07.2008 57