Loki Crosses the Pond — Part 2
the new position over the time period allocated for the
move. An increment in position for each servo frame is
calculated for each servo to be moved. Each frame we
increment each servo position as required. The result is a
smooth transition of position for the servos. And it all runs
in the background! The new positions, of course, come
from the servo commands parsed. The code also reads and
parses the canned sequences. The action of turning on a
servo output line for the time determined by the second
timer results in a PWM (pulse width modulated) signal
suitable for controlling R/C servos.
Before powering up Loki, make sure his legs are
positioned left foot first and he is standing up. This is the
starting position, and all of the canned move sequences
both start and stop here.
Initially, both the servo and the controller board power
switches should be off and the battery disconnected.
Remove the PIC chip U3 if installed. It is recommended that
the servos and sensors be unplugged at this time.
You may now connect the battery and turn on the
controller power switch, and observe the LED power
indicator come on. Measure +5V on the output terminal
of the 5V regulator REG1.
Turn the power off and insert the PIC (the end with pin
1 and the little notch faces the three LEDs). When you turn
the power back on, you should again observe the LED power
indicator come on and still read +5V on the output of the
regulator. The “heart beat” LED D2 should be flashing once
a second, which indicates that the program is running.
Power down again and connect either a checked-out
Bluetooth module (TTL) with a viable wireless link to the PC
or install a MAX232 level converter chip into U1 (any
Loki in a posture.
56 SERVO 07.2008
Bluetooth module should be disconnected) and a 1:1 three-wire DB9 cable to the PC. Run a suitable terminal emulator
program such as T2 or Docklight (even Hyper Terminal). Loki
expects a 115K baud rate, no parity, and no handshake. Set
your terminal software (and Bluetooth if used) accordingly.
(Because of the variety of Bluetooth modules available, no
detailed description of using the Bluetooth or SmiRF will be
Assuming the terminal program is configured properly
and the Bluetooth (if used) is operational, then you should
observe the sign-on message “Loki 1.0 here!” when the
board power is turned on. Insure that you are familiar with
Bluetooth before attempting to use it! I suggest you try
RS-232 first (I did).
In case no sign-on message is seen, and assuming you
have the proper voltages and the chip(s) in right, you
should first check out communications. It is normally easier
to start off with a simple RS-232 serial cable known to
work. If no message is seen upon power-up of the board,
disconnect the RS-232 cable and plug in a loopback plug
into the end of the cable instead. You should see your
keystrokes echoed through the loopback plug. In the case
of Bluetooth, the Tx and Rx jumper leads (blue) can be
unplugged from the controller board and connected
together with a small piece of .025” header pin. This
“loops” the Rx out of the Bluetooth module and right back
in. This is a typical way of checking out a terminal program
and cabling, and also the Bluetooth. After verifying the
communications, standard troubleshooting techniques
apply. Check for shorts, grounds, damaged traces, and the
like. Pins are easy to bend over on the IC chips. Mind the
polarity of the electrolytic caps, LEDs, and diodes.
On your terminal, send the string REV<CR>. <CR> is a
RETURN keystroke. It is often represented as ‘\r,’ as well.
Loki should reply with “Loki 1.0 here!” This is the message
also seen on power-up, but it is a good fast test of a valid
two-way connection to the terminal. And with Bluetooth,
it’s nice to have a quick way to verify that you’ve still got
You are now ready to send some initial servo
commands to Loki to test him out. Insure Loki’s legs are
positioned with the left foot first. (Loki always puts his left
WARNING! Servos can rapidly jump when first turned
on. Positioning the feet as mentioned will minimize any
undesired jerking motion of the feet upon application of
KEEP YOUR FINGERS CLEAR of Loki’s feet when
I recommend connecting and testing one servo at a