STAMPAPPLICATIONS
PUTTING THE SPOTLIGHT ON BASIC STAMP PROJECTS, HINTS & TIPS
■ BY JON WILLIAMS
CONTROL VIRTUALLY ANYTHING ...
VIRTUALLY
WHEN THE SX MICROCONTROLLER was developed, the core philosophy was
to create a chip fast enough and clean enough that most specialized peripherals
could be made “virtual,” that is, created in code. And when SX/B was developed,
the core philosophy was to create a compiler with such clean output that it could
be used as a self-teaching guide for those wanting to learn assembly language.
It may have taken me a while to catch on to the assembly stuff, but I think
these promises have been met, and this month’s project brings them together
into a neat little device that just might save an old PC from the junk pile.
Ithink that most regular readers
know I’m an actor (see www.jon
mcphalen.com) which means I have a
built-in interest in the movie business.
And as much as I enjoy my work in
front of the camera, I also love
working with the myriad technical
magicians behind the scenes. Because
of this, a DVD purchase for me is
usually based more on the “extras”
material than the movie itself. When I
was young, my parents had hoped
that learning the secrets of Hollywood
movie-making would dissuade me
from my desire to act when, in fact, it
had quite the opposite effect. A tour
of Paramount Studios when I was a
teenager sealed the deal for me and
I’ve known all my life that some how,
some way, I would be involved with
movies and television.
The truth is that unless a movie is
just horrible, I can completely lose
myself in it and shut off that portion of
my brain that knows how it was done.
This goes for all movies — even those
without people. One of those movies
that caused me to have a, “I want to
do that ...” reaction was Team
America. Now, this kind of movie is
not for everybody; Matt Stone and
Trey Parker are well known for their
18 May 2007
bawdy, adult humor; the kind of stuff
that South Park is made of — and
made famous for.
And no, my reaction was not,
“Hey, I want to do raunchy comedy!” It
was, “Hey, I want to build a [small]
animatronics control system.” If you’ve
seen Team America, you know that all
of the characters are puppets —
marionettes, in fact. What you may not
know is that inside each of the puppet’s
heads were nine mini servos to control
the facial movement. Imagine that: The
puppet heads were a bit smaller than
the size of a softball and yet they
held nine servos! Servo control was
done through a piece of specialized
software, originated by Gilderfluke (the
provider of the servo controllers) and
heavily modified by the production
crew for that enabled real-time control
when required. In my opinion, the
Team America puppets and their
control demonstrate the tremendous
skills of the craftspeople and engineers
at The Chiodo Brothers CBFX unit.
So, I have had for some time now
the desire to build a small animatronics control board that I could run from
a PC — and I have finally got past a
learning curve with the SX and done
it. This month, I’m going to show you
what I did. In the process, my goal is
to show you how to combine virtual
peripherals (VPs) when you have a
project than needs more than one
and, especially, when those VPs must
run at different rates.
THE SPECS, PLEASE ...
As always, it’s best to know where
we’re going before we start on the
journey. The goal for this project was
to have a PC-driven controller board
that could manage eight digital
outputs and eight standard servos.
The digital outputs would be buffered
by a ULN2803 so that they can drive
lamps, relays, and other moderate-current devices. The servos will be the
standard hobby type and will be
refreshed every 20 milliseconds.
Based on these specifications, the
hardware design is really simple, and
that’s a good thing. This board
becomes somewhat generic and a
change of code gives it a change of
personality — always a useful trait in a
microcontroller circuit. As you can see
in Figures 1 and 2, we have a power
supply, an SX28, a simple RS-232
interface, and the ULN — nothing to it.
And due to the small parts count, the