The first little bit of this article will talk about how I came around to hacking with microcontrollers. It
will probably come off as self-centered, but I feel that I can't adequately describe what I'm talking about
without describing how I got there. I will try to keep this part as short as possible.
In the beginning, I had no computer. Instead, I had a soldering iron and books. Instead of writing programs, I
drew schematic diagrams. Instead of compiling programs, I wired circuits up on a breadboard. Instead of using a
debugger, I used a multimeter and a logic probe. Instead of prebuilt libraries like GTK and libc, I had
I enjoyed this. I was even, strangely enough, happy when I got my first jolt of 120V across my hand. It was a
stern reminder that electricity is not to be trifled with and that it can, and sometimes will, bite back when
you're trying to tame it. This was the first major highlight of my electronics experience - this stuff is
Some time after my hands-on experience with 120V, I used my Commodore Vic-20 to create a game show-style buzzer
system for something that my Jr. High school was doing. I soldered some wires to the user IO port on the Vic-20,
soldered some switches to the other end of the wires, and wrote up a little program to poll the IO port and show
you who buzzed in. Sure, it was fairly lame, but I was the only kid in that school who could have pulled that
stunt. This was the second major highlight of my electronics experience - this stuff is amazingly cool when it's
Then my interest in electronics wanned as components increased in price and my income remained steady at
next-to-nothing. So I got more into programming. The Vic-20 had long since fried from various modifications I
made, so my days of doing neat stuff with the user IO port were relegated to my memories and I was stuck in the
world of software only. Granted, this was fun, but it never bit me, not like electricity had anyway. The world
of software has no teeth and can't bite in a physical way like electricity can, the most it can usually do is gum
your files to death (unless you get some big company mad at you - then THEY bite!). Also, software seemed purely
abstract, even though it did useful and amazing things, it still had a very nebulous, non-physical, quality about
it. Fortunately, it was very easy to program and debug, much easier than building and debugging electronic
circuits was. Overall, I was quite happy writing software, even if it didn't "feel" quite as real as building
About a year ago I got to thinking "Wouldn't it be nice if I could do again what I did with my Vic-20? Wouldn't
it be great if I could, once again, combine hardware and software into something useful and physical?"
Enter the Microcontroller
One day, I remembered a PC Magazine article that I read about a microcontroller and how someone used it to
determine the winner of a model car race when both cars finished at nearly the same time. Ok, it was one of those
opinion pieces that they run, possibly by John Dvorak, but it still contained useful and accurate information when
it came to this topic. Eventually the name of the microcontroller surfaced out of the murky depths of my memory.
The microcontroller was called the "Basic Stamp." The Basic Stamp is made by Parallax, which also makes and sells other types of microcontrollers.
The Basic Stamp comes in four major
The Basic Stamp comes in a number of shapes and sizes:
- Basic Stamp I - this is the bare bones one. Limited program space, not very fast, but cheap.
- Basic Stamp II - This is a higher end one - there is more space for your program and it runs significantly
faster than the Basic Stamp II
- Basic Stamp IIsx - this one is even faster than the Basic Stamp II and has even more program space
- Basic Stamp IIe - This is midway between the Stamp II and IIsx. It provides the increased program space of
the IIsx, but not the increased speed and power consumption.
Regardless of the packaging, you can see that a Basic Stamp consists of a PIC microcontroller, an EEPROM, and a
little bit of support circuitry - there are pictures here. In addition, you can buy the
Stamps in various kits, which include prototyping areas, easy access to the IO lines, and a proper serial port so
that you don't have to make your own serial cable.
- One features a Basic Stamp I plus prototyping area on something a little bigger than a 9-volt battery
- Another features a Basic Stamp I on something that looks like a SIMM, except with pins instead of a row of
- Yet another form features a Basic Stamp II on a 24-pin carrier. It is the size of a standard 24-pin
integrated circuit and houses the Basic Stamp interpreter, EEPROM, voltage regulator, and other support circuitry.
Programming the Basic Stamp
The first step to programming the Basic Stamp is to realize that there is no operating system, since it's not
needed. There is no dynamic memory allocation because you don't need it. Of course, if you want to, for example,
use an external memory board and write routines to manage the memory you are free to do so. Just because it
doesn't exist in the Stamp by default doesn't mean it can't be done. The environment on the Stamp is more
barebones than the smallest Linux distribution you can imagine, and can probably be outmatched by a graphing
calculator. These are the limitations of the microcontroller world.
To write a program for the Basic Stamp, you use some software on the PC which handles editing, compiling, and
downloading the program to the Stamp. Downloading is done through a serial port if you are using a Stamp II and a
parallel port if you are using a Stamp I. As far as I know, there is no open source software for developing Stamp
programs, but I'm sure that if there is a need somebody will write such a thing.
When a program is running on the basic stamp, there are two ways that it can interact with its environment. The
first, and easiest, is the debug command, which sends data back to the host computer through the serial
port. As the name implies, this should only be used for debugging. Another gotcha of the debug command is
that it does not work for the Stamp I. The second is to read and write to the IO lines. This can be accomplished
by commands like serin and serout, which can be used for serial IO, pulsin and pulsout
which can send or receive a short pulse on an IO line, along with specialized functions like rctime, which
is designed to time an RC network, and x10out, which is specifically designed for sending commands to an
X10 powerline interface module.
Since the environment of this chip is generally a larger circuit, many of the commands make sense. For example,
serin and serout are perfectly suited for interfacing with the Matrix Orbital displays that were made so popular in the Linux world by
lcdproc. Through various modules built by Parallax and other
companies, the Basic Stamp can control everything from LED and LCD displays to infrared range finders, servos, and
other things that could serve to build anything from an autonomous robot to an industrial manufacturing system
using a Basic Stamp as the brain. Some examples of this are shown on Parallax's Customer Applications page.
Some of the modules that are sold for use with the Basic Stamp and other microcontrollers include things like the
StampMem module, which is useful
for storing data that is gathered over a long period of time, and the Pocket Watch, which can serve as a
real time clock. Of course, if you desire more accuracy, an Atomic clock reciever module is
I think the Basic Stamp is a good way to learn about microcontrollers and embedded systems in general, and also a
good way to experiment with hardware and the interaction between hardware and software. I also think that this is
a good place to start for the software hacker that wants to learn about hardware but doesn't know where to start -
it lets them keep their software programming skills and apply them to new and interesting things.
The Basic Stamp certainly isn't the only microcontroller of this nature out there, but it is a fairly popular one
and a good place to start for someone who wants to expose themselves to the world of microcontrollers.
- Parallax - the manufacturer of the Basic Stamp and various addon
modules. They have a lot of documentation and sample programs available at their site.
- HVW Technologies - a company in Calgary, Alberta, Canada, that supplies
Basic Stamps and related stuff. Not much use to those outside of Canada, but a good place to see what's
- Parallax's Distributor Page
- more useful to those outside of Canada, a list of all distributors of Parallax products.
- LOSA - List of Stamp Applications. If you're
interested in what people have done with the Stamp, this is the place to start. People have done everything from
rotating LED clocks to controlling a system to feed a cat through a tube using the Basic Stamp!
- Parallax's Customer
Applications page - a few high-end applications of the Basic Stamp
- Questlink - While not specifically Stamp related, has loads of
information about electronic components, including purchasing and data sheets.