Wednesday, July 28, 2021
Home » Platforms » Basic Stamp Basics

Basic Stamp Basics

An introduction to the exciting world of robot programming

At the heart of many hobby robots lives a modern day success story, the BASIC Stamp microcontroller. This straightforward, fairly inexpensive unit has revolutionized the world of robotics since its introduction in 1992. The BASIC Stamp is the brainchild of Chip Gracey, a 37 year old computer enthusiast from Sacramento, California. Starting a company in his bedroom while a senior in high school, Chip parleyed his love of computers into Parallax, Inc., which sold over three million BASIC Stamp modules by 2002.

The Parallax Boe-Bot™ is a fully integrated educational kit suitable for hobbyists of all ages as well as students and educators.

This ubiquitous device is found in applications as diverse as artistic bridge lighting, automated doggie doors, mobile desk chairs and industrial wood chippers! This is in addition to a myriad of hobby and industrial robots including firefighting, rescue, and lawn mowing bots.

All robots include some combination of electronic inputs and human inputs. Even totally autonomous robots are given commands by people to act upon. Today’s automobiles are chock-full of microprocessors, even kitchen appliances like toasters and refrigerators use them. These translate the simple desires of the homeowner, like temperature or radio settings, into control signals for the machine. In a sense, these appliances are simple level robots.

The most complex robots do some of the decision making themselves, using extensive rules programmed into their computers. A guided missile, once initiated, seeks its target independently, even analyzing decoys and countermeasures to identify the “true” target.

Kitchen table roboticists, Morgan and Holden Berry, teach their Boe-Bot to be a line follower.

What is exciting for the hobbyist is that the BASIC Stamp microcontroller permits the programming of autonomous robotic behavior. Using a proprietary version of the BASIC software language called PBASIC, this miniature powerhouse helps home robot builders produce surprisingly smart machines. Check out the sidebar on Parallax’s Boe-Bot—there may be no better platform for exploring BASIC Stamp capabilities if you’d like to explore the exciting world of robot programming.


A microcontroller controls devices, measures sensor inputs and makes decisions. The BASIC Stamp is a digital device, meaning it stores and processes commands using the classic “1s” and “0s” like all digital computers. It is used with devices called sensors and encoders that translate stimuli in the real world into data that the BASIC Stamp understands.

Let’s say we want it to control a remote control car independently. One motor drives both back wheels, and the other turns the front wheels right or left. Our “program,” which will tell the car what we want it to do, might be something as simple as: “move forward three feet, then back up one foot.”

This sounds very simple, and could easily be explained to a five year old in exact words. At most, there might have to be some marks on the floor to show how far three feet is. So, how does one communicate this to the BASIC Stamp brain? First, a BASIC set of commands is established, as shown in Table 1.

[table id=1 /]

Next, these commands are used to program the car’s brain. The car has no idea how far three feet is. Its simpleton brain doesn’t even know there is an outside world. How can it understand what is meant by a linear measurement?

The key lies in calculations. If the car’s wheels are two inches in diameter, they would have to roll about six times to go three feet. The computer could be told how many revolutions the wheels must turn to traverse three feet. To solve this type of “open loop control” problem, the BASIC Stamp can count cycles from an encoder attached to the wheel (this would be a Hall sensor, for example, or a tachometer, either of which could count wheel revolutions). But there are other ways to do this as well. If it takes the car 1.8 seconds to traverse three feet, we can limit the motor run to 1.8 seconds. The “program” is shown in Table 2.

[table id=2 /]
The “program” above is fictional, of course. The BASIC Stamp uses a proprietary version of BASIC called “PBASIC” (Parallax Beginners All-purpose Symbolic Instruction Code). This language, developed by Parallax, along with a free editor program, is available for download and use at no cost.


Special electronics in the BASIC Stamp translates from the digital world to our analog reality, and vice versa. The BASIC Stamp has the ability to output a standardized “pulse stream” (analogous to the pulse streams that are used in RC equipment) that tells robotic devices what to do. Servos and motors are used in robotics and RC equipment to make things move.

Servos have an on-board chip that translates the standard pulse stream into appropriate voltages to drive, reverse and position the motor. In robotics, we often refer to these motors as “servomotors.” Many are capable of continuous rotation in either direction.

The conceptual commands in Tables 1 and 2 have been translated into PBASIC in Table 3. For the fun of it, let’s reconfigure the bot to be run on two motors, one on the right side and one on the left. This is a starting point for understanding the classic “tank tread” drive system used in many bots. This will run a car bot with two servomotors: left and right, and forward and backward. The right hand columns show comments for the users, and are ignored by the microcontroller since they start with the apostrophe symbol. These lines appear on your PC screen as you write the “code” that will program the BASIC Stamp.

[table id=3 /]

The two items above tell the BASIC Stamp that pin No.13 on the board is for the left motor, and No.12 is for the right. It also “names” the motors, LMotor and RMotor.

[table id=4 /]

These six lines tell the BASIC Stamp how many standard Radio Control system pulses to send to the motors. 750 pulses means “stand still.” 800 pulses means “go forward slowly.” 700 means “go backwards slowly.” Later, if we want to speed up our bot, we might make LForward and RForward equal to 900 or 1000 pulses. Because the motors are mounted in the robot car in mirror image fashion, the number of pulses to make the right motor move the bot forward is the reverse of that used to make the left motor drive the bot forward.

[table id=5 /]

The variables section sets up a place in the BASIC Stamp’s memory to store things. In this case, we want to count how many time increments it takes to run the motors.

[table id=6 /]

This is where the magic happens. The “FOR” command tells the program to send 90 pulses. Each pulse is 20 milliseconds long, so the bot will run for 1.8 seconds going forward.


Many BASIC Stamp kits come with sensors, so your robot can actually be aware of its environment. These include infrared, sonar, or mechanical devices that can sense lines, distance, or contact. The programs get more complicated, of course, but each step can be learned easily using the wealth of material on Parallax’s website, or on the sites of hundreds of schools and hobby enthusiasts working with BASIC Stamp technology. And if you want to jumpstart your mastery of PBASIC, start with Parallax’s Boe-Bot—it includes an excellent course that will provide you with the basic skills you need to program your future robots. 


Parallax, Inc. provides a wide range of hobby, educational and industrial robotics options. One of these is the Boe-Bot™ programmable robot kit. Designed for hobbyists, educators, and students, the kit provides a complete “robot curriculum in a box.”

The heart and soul of the Boe-Bot is the “Board Of Education.” This is the BASIC Stamp module’s carrier board. It contains the BASIC Stamp, a breadboard for experiment components, power conditioning, servo connections, and power switching. This board will work standing alone, for table-top experiments, or integrate with the robot chassis for mobile exploration of robotic concepts.

The robot kit contains an aluminum chassis, two continuous rotation servomotors, wheels and caster, battery holder, and mounting for the Board Of Education. Assembly of the robot kit takes less than two hours for students and considerably less for veteran builders. A wide range of electronic components for unique configuration of the Boe-Bot are also provided. These include infrared and contact sensors for object detection, as well as a speaker, hookup wire, and a double ended screwdriver.

The textbook is structured for use by students, ages 12 years or older, and also hobbyists of any age. It is divided into a series of lessons, starting with loading the software onto a PC, and ending with sophisticated line following, multiple bot coordination, and remote sensing applications. The programming language for the BASIC Stamp controller, PBASIC, is available through a free, downloadable editor which runs on Windows, Macintosh or even Linux. The Boe-Bot text contains the program code for all the experiments. The kits are available in either Serial or USB versions, to facilitate interface to personal computers.

Add-on kits are available to turn the Boe-Bot into a tanked vehicle, an insect walker, a gripper and to add an infrared remote control. Various sensor options include a compass, accelerometer, and sonar ranging.

Priced at about $179, with volume discounts available, this is a very affordable starter set for schools, families, or individuals who want to learn the basics about programmable robots. The hardware also adapts easily as expertise and interest grow, so the investment continues to be repaid, “with interest.”

Some material in this article is adapted, with permission, from Parallax’s website, —the editors


Parallax, (916) 624-8333

Words by Kevin Berry