FIGURE 2. An LCD screen and multi-state
LEDs provide internal state information
— in this case, low motor voltage (red
LED, left, and LCD), but adequate main
voltage (blue LED, right). Control buttons
are not shown.
components and microcontrollers. One
of my favorite processor boards —
the ATMega128-based Mavric-IIB —
features a watchdog timer. This
independent timer can be used to reset
the microcontroller if the program
executing on the controller hangs.
Using the watchdog timer, you can
assure that the microcontroller resets
in a controlled manner following a
power glitch, robot impact with
something in the environment, or a
variety of other causes.
The less powerful but easier to use
Parallax BS2 and related chips don’t
provide this independent watchdog
timer function. However, safety routines needn’t reside exclusively in the
microcontroller. Consider the Parallax
HB- 25 motor controller, which has a
communications timeout function that
stops motor activity if it doesn’t receive
a refresh pulse every four seconds or
less. With the timeout function
enabled, the HB- 25 will render the
robot immobile following an accident
or component failure that results in the
loss of refresh pulses.
Although several motor controllers
support a timeout feature, most
components require custom safety
subroutines to automatically disable
autonomous functions. The basis of
operation can be a specified time of
inactivity or sensor data, such as a tilt
reading from an onboard accelerometer.
Physical Sensors
Software subroutines assume
functional sensor-microcontroller
communications, but this assumption
frequently doesn’t hold following a
mishap. For this reason, it’s a good
idea to supplement soft safety
subroutines with hard wired physical
sensors that are independent of
microprocessor operation.
I like to install a hard tilt switch
across the control input of solid-state
relays that control motor current. The
physical tilt switch cluster shown in
Figure 1 is composed of four mercury
switches, each accompanied by a 1K
series resistor. When the tilt of the
robot platform is greater than the
angle defined by the position of the
mercury switch on a given axis, the
microcontroller control signal is
shunted to ground, thereby opening
the relay output circuit.
A more compact circuit can be
constructed with an accelerometer, but
it can be rendered useless if the
microcontroller is damaged or runs into
FIGURE 3. Schematic of an optically-isolated analog voltage sensor that
drives LED indicators, as well as the
digital input of a microcontroller.
SERVO 01.2007 53