Arduino, the Basic Stamp killer

Parallax’s Basic Stamp is the mainstay for hobbyists wanting to add intelligence to everyday devices. A new system called Arduino provides the benefits of the Basic Stamp at a greatly reduced cost, increased speed, and is entirely open-source.

arduino vs basicstamp chips

A Little Background

Tiny computers surround your life. In your coffee maker, remote control, vacuum cleaner, telephone, and clock radio, these little computers (aka microcontrollers) are getting smarter and cheaper and becoming more pervasive every day. They can be had for less than a dollar. And you can program them as easy as you can write a web page.

To program microcontrollers in the old days (i.e. a few decades ago), the requirements were an expensive development environment costing thousands of dollars and a professional electrical engineer. In the early 1990s, Parallax had the idea of embedding a simple BASIC interpreter on a microcontroller, mounting it on an stamp-sized module, and providing lots of add-on devices, excellent documentation, and example circuits and code. The friendly Basic Stamp created a whole new market of hobbyist-oriented microcontroller devices and the standard by which other such devices are judged.

The reasons why the Basic Stamp was a hit are obvious in retrospect. BASIC is an easy computer language to pick up. People without knowledge of computer programming can pick it up quickly. Parallax’s wonderful examples showed how with just a handful of extra parts and a few lines of code you could create all manner of smart objects. In an afternoon you could create your own robots, games, data collectors and toys. In the process you’d learn about microcontroller techniques.

Basic Stamp Issues

The Basic Stamp does have a few downsides:

  • Expensive — The Stamp itself is $50 and to program it you really need a development board for another $70. Even without the dev board, a $50 part makes you reluctant to use one for every room of the house, let alone for every appliance in your house.
  • Slow — The Basic Stamp re-interprets your BASIC program each time it’s run, placing a limit on the fastest it can do things. Time-critical are beyond its capability.
  • Low Memory — There’s not much room in a Basic Stamp for anything but simple programs.
  • Closed — If you want to modify the BASIC interpreter in the Stamp to add new commands or remove the ones you don’t use, or even learn how it works, you’re out of luck. It’s closed nature meant for the longest time only Windows PCs could program Basic Stamps.

Enter Arduino

Arduino solves most of the above issues with the Basic Stamp. The most noticable is cost:

arduino vs basicstamp

Getting to the “Hello World” of microcontroller projects, the blinking LED, on Arduino costs $32 compared to the $119 for a Basic Stamp. This is perhaps a little unfair because the Basic Stamp board contains a full bread-boarding space. A similar setup for Arduino would cost about $60, still a 2x savings (and can made cheaper if you want). A more telling cost comparison is the “consumable” cost. If you accidentially blow out the chip on each board how much does it cost to replace it:

arduino vs basicstamp chips

The standard Atmel AVR ATmega8 chip used on the Arduino board can be obtained for less than $4. The Basic Stamp must be obtained from Parallax and costs $50.

This order-of-magnitude cost reduction opens up entirely new avenues for embedding intelligence. Where before it would be economically infeasible to have a 100-Basic Stamp project, with Arduino and an AVR programmer like the $34 AVR-ISP, you can program as many ATmega8 chips to work with Arduino as you like.

What is Arduino

Arduino is two things:

Like the Basic Stamp, Arduino solves in a simple, elegant way the usual difficult problems of microcontroller programming (setting up a working board, talking to the board, making compilable code) With a Arduino board, doing a blinky light “hello world” takes less than 5 minutes. For example, below is the same functioning code for Basic Stamp and Arduino.

Basic Stamp Arduino
'{$STAMP BS2} 
'{$PBASIC 2.5}
OUTPUT 14
DO
  HIGH 14
  PAUSE 1000
  LOW 14
  PAUSE 1000
LOOP
int ledPin = 13; 
void setup() {
  pinMode(ledPin, OUTPUT);
}
void loop() {
  digitalWrite(ledPin, HIGH);
  delay(1000);
  digitalWrite(ledPin, LOW);
  delay(1000);
}

The differences are minimal. However unlike the Basic Stamp, with Arduino you can use real GCC C code to implement your algorithms and access all the hardware of the AVR chip.

Go Forth and Hackify

Try out Arduino. Go to SparkFun.com and buy an Arduino board, then download the software and start playing. Check out the many examples or visit the playground to see how people are hooking up their Arduinos to the world.

Note the above thoughts are not unique to me. Several others have made similar observations. Tom Igoe of ITP, especially, gave a much more detailed analysis at the Sketching in Hardware ’06 conference.

76 Replies to “Arduino, the Basic Stamp killer”

  1. Outlander, I totally agree. I was a Basic Stamp user for about a decade. If yo are comfortable with BASIC and you can solve your problems with a Basic Stamp, you shouldn’t stop using it. It’s a great tool. Parallax has a lot of great documentation on how to use it.

    I became frustrated with the Basic Stamp when I wanted to go beyond that. There was no way to get “under the hood” with the Basic Stamp: it was all closed up and proprietary.

    The nice thing about Arduino’s “version” of C is that it hides most of the nuttiness of C and is pretty much equivalent to the BS2 language for Basic Stamp-like tasks (as seen in the code comparison above). But Arduino also lets you get down into the internals of the chip to change how it works, extend the language with various libraries to deal with various types of input and output devices, and is totally open so you can learn for yourself how it works.

  2. You are missing the entire point of the “BASIC” Stamp. And that is the “BASIC” part of it. C/C++ is a very difficult language to learn, especially for us who learn 68K or x86 ASM back in the day over 15-20 years ago. C/C++ is an object oriented language and is extremely difficult while BASIC is simple and for some reason seems to go hand in hand with people that learned line-by-line ASM first and can’t learn C/C++.

    If you want a line-by-line approach that is easy to read, easy to understand, and easy to decode, than go with the BASIC Stamp. If however you like heart ache, long hours figuring out what each (,:,.,{ means, and a lack of official support than go with an Arduino

    For me, if I can’t use a GOTO, or a JUMP to a certain line of code, than it’s not for me :) line: 010, 020, 030 for life!

  3. One of the big benefits of Arduino is that it’s open-source and cross-platform: Linux, Mac OS X, and Windows.

  4. Hi Josh,
    Once you’re familiar with the equivalents in C on an AVR for BS2 commands, the translation is pretty easy. But just like human translation, sometimes certain idioms will have to be rephrased. This is where Arduino is nice: it has a vocabulary very similar to the Basic Stamp, but also lets you use the lower-level and more powerful C statements if you need to. One way to approach your task is to download the Arduino source code and see what happens when the function “digitalWrite(pin, HIGH)” (the Arduino equivalent of BS2’s “HIGH pin”) is called.

  5. How can you translate a BS2 code in to AVR or C++? I saw that you have the same program in both BS and Arduino. How can you translate those programs? In my case I need to translate the code for a Parallax GPS to be used on an ATMega32.

  6. Humandoido, the BS1 is woefully underpowered compared to what the BS2 can do, and the BS2 is similarly underpowered compared to Arduino. There are several open source Arduino-clones for around $19 that are equivalent in functionality to a real Arduino. But I love the BS2, and I use it still occasionally.

  7. You can blink LEDs and run many projects using the Basic Stamp board for only $19. There’s a ton of free support, for many projects!!! Please check the Parallax web site at http://www.parallax.com and look for the BS1 board. It’s a complete development board with solderless breadboard, comes with the Basic Stamp microprocessor, power regulation, and really it’s the ultimate Arduino Killer. hehe…

  8. Hi A.Franco,
    Adobe Flash is not needed to use any part of Arduino. You may see the work “flash” used with Arduino, but it’s referring to the “flash memory” that’s inside of Arduino to store the sketches you write. It’s just like the memory in a flash thumb drive. The terminology can be a bit confusing.

    Arduino is entirely open source. All you need is an Arduino board to get started, and you can even build one of those yourself, as the board design is also open source. In fact, because of this, there are many different flavors of Arduino board, if you have particular application needs.

  9. Hi, Tod I wonder if you can tell me about flash and arduino? My main question is do I need to pay for a flash utility/program or it is part of basic software that can be dowload for free.
    I want to try arduino with flash but can’t really afford paying for a full installation of Adobe.
    THXs alot, cheers.

    A.Franco

  10. Hi Tod. Thanks for the great article. We are going to make a PCB for a “M8 Stamp”. Hope you can drop by sometime. Here is an application note about using an Atmega8 with Basic for AVR.

    http://www.digikits.com/avrisp_cd/avrisp_user_guide.htm

    For only $2.60 you can buy an Atmega8. The USB ISP programmer cost only $35.50 (shipped). You can build as many “M8 Stamp” as you need for only $2.60 plus some other low cost components. You only need two resistors, one LED, one Atmega8 and a circuit board to make a “M8 Stamp”.

    Comparison: For this “M8 Stamp”, you don’t need a “development baord”,because the atmega8 is serial programable. For Arduino, it cost $32.00 plus shipping. You have to use the Arduino to program the M8 on the circuit, then you put the M8 onto your target circuit. For Basic Stamp, here is what I think: If you can build a “M8 Stamp” for $2.60 (plus some low cost components), why spend some much for a slower version like Basic Stamp?

  11. For IR messaging I think you mean 36,38, or 40 kHz, not MHz. And yes, the hardware PWM channels can easily go that fast. Most folks I know that do IR message receiving use something like a Sharp GP1U58X to do the 40kHz carrier decode and their parse the resulting serial protocol with a UART or by hand. No PWM needed. If you’re sending IR messages, you need a ~40kHz carrier wave you can switch on/off rapidly. You can do this with a PWM signal that you toggle, or an external oscillator you switch with a transistor.

  12. Is it possible to set the hardware PWM generators parameters to get a 36, 38 or 40 MHz frequency with a variable pulse width? Need only one of them for obstacle avoidance or IR messaging. The other 2 need to be used for motor controll.
    Thanks.

  13. Lady ADA has a website you can get to from makezine. She has hacked bootloaders you can look at/use/hack. They may help guide you to a solution.

  14. Got a step-through for using the STK-500 for programming up the ATMega168 for the bootloader. I’m having a wee difficulty in getting this bootloader in, and it’d be nice to “compare recipes”, so to speak…

Leave a Reply

Your email address will not be published. Required fields are marked *