You are on page 1of 10

todbot blog


Random experiments, circuits, code, rapid prototyping examples, sometimes things to buy, and occasionally tunes by Tod E. Kurt. Reach me at tod [at]

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.

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 microcon troller 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:

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 breadboarding 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:

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:

A software programming environment, with a GUI and style based off of Processing, and a packaging of AVR GCC, AVR LIBC, and AVRlib. In many ways the Arduino environment is like WinAVR, but cross-platform. A hardware board, based on an Atmel AVR processor, arranged in a standardized way. Arduino isn’t restricted to just this board however, and many Arduino-compatible boards have been created

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

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 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. Posted by todbot on Monday, September 25th, 2006 at 10:18 am.

40 Responses to “Arduino, the Basic Stamp killer”
[...] [...] Left by technology guerilla » Blog Archive » Arduino, the Basic Stamp killer on September 26th, 2006 [...] todbot blog » Blog Archive » Arduino, the Basic Stamp killer (tags: DIY electronics projects robotics reference hacks) [...] Left by links for 2006-09-27 « Donghai Ma on September 26th, 2006 Righty, so what i’m not getting is whether i *need* the thirty buck board to run the four buck microcontroller or if i can make my own from, say, breadboard? That’s what makes PicAXE so beautiful: those small beauties (which cost between two and six bucks need almost no peripherials to operate. There’s even a healthy competition between PicAXE hackers on who can bend the most impressive stuff into a single film canister (remember those? :) ~rL Left by llaurén on September 27th, 2006 llaurén, you don’t *need* an Arduino board to use the AVR microcontroller. Similarly, you don’t need to use the Arduino software to program an AVR chip. Before I used Arduino, I built up my own AVR circuits, wrote C code using emacs and command-line tools, and programmed them with either the STK500 or AVRISP programmers. But the Arduino environment (both the software and the hardware) is a nice environment that encapsulates a lot of knowledge. In that way it’s very similar to the Basic Stamp: you *could* wire up your own PIC microcontroller and program it using a BASIC compiler, or you could just use the Stamp. I’ve got a few standalone AVR chips that I’ve programmed with the Arduino bootloader. I stick them into an Arduino board to program them then push them into a breadboard to use by themselves. But usually if I’m getting that serious, I’ll go a little further and program the chip with an ISP programmer. For me, Arduino’s about trying out an idea quickly, without having to wire up a bunch of circuitry. Left by todbot on September 27th, 2006 I read on makezine’s blog that there are schematics for a “$0.79″ programmer and I THINK it was supposed to be on this site but I’m having probs finding it. Any help?

Left by eric on September 29th, 2006 and as soon as I typed that last comment I realized I wasn’t on the official arduino homepage and when I went there, I found it…doh! Left by eric on September 29th, 2006 Just to clarify, you don’t need a programmer ($0.79 or otherwise) to program an Arduino board. You use the Arduino software on your computer to program the Arduino board over its USB connection. However, if you’d like to create new Arduino boards yourself, you’ll need some sort of programmer for AVR chips. The Atmel STK500 or AVR-ISP are both good choices because of the wide support and USBcompatibility. The “$0.79″ programmer requires a parallel port on your computer, which increasingly fewer computers have. Left by todbot on September 29th, 2006 [...] todbot blog » Blog Archive » Arduino, the Basic Stamp killer Hardware fun! I miss playing with hardware… (tags: electronics diy embedded hack hacks projects fun development microcontroller PIC avr arduino) [...] Left by links for 2006-09-29 on September 29th, 2006 use a friggen PIC, jeez. Left by bubba on October 4th, 2006 [...] And finally, for today… I was originally lookingat investing in a Basic Stamp 2 board and development thingy that enabled me to program small robot like things and so on, but as that was extortionally priced, I have now found an alternative, the Arduino. It is a cheaper board $32 as opposed to $119 and for the actual chip, $4 as opposed to $50, so definitely more worthwhile investing in. It is also open source, so it would be much better too, as it also runs natively on Mac (including Intel Mac I am led to believe) but if you’re remotely interested, check it out… for a simple independant overview and here for the main site… [...] Left by » Blog Archive » General Stuffs… on October 23rd, 2006 Basic programmable micro controllers predate the basic stamp. First to come to mind is the intel 8052AH basic chip which was released in 1980. Not as cheap as basic stamps but they are much more powerful then a stamp you can add memory up to 64K. Programming only took a terminal emulator program and text editor or even just a dumb serial terminal. The family is still in use and is known as the MSC-51 family the atmel 89X mcs-51 chips are fairly cheap and the basic interpeter has been released as freeware. Left by Membrane on November 2nd, 2006 [...] Arduino - Open source and cheap. [...] Left by EasyPic4 First Impressions :: Dammit Jim! on November 13th, 2006 Check out Bare-bones Arduino kits for $15 (qt 1) or Arduino boards and chips to build your own at

Open source hardware and software make Arduino a great option. Paul Left by Paul on April 11th, 2007 Hi you All, We need 14 to 16 bit ADC and DAC, 2X16 LCD, hardware and software for my Arduino brd. Thank you Joe Left by Joe Vu on June 23rd, 2007 The ARM line should be considered now, with single unit prices of $5, and a fast 32bit architecture, and built in A/D converters. They offer a much wider range of memory (upto 512K Flash and 64K RAM). A single board is available starting at $40 with pre-configured BASIC or C compilers. Left by brucee on August 22nd, 2007 Hi brucee, I’ve long wanted to get into ARM systems, and the Cordium boards you link to could be a good way. I am a bit put off by their site though, being so Windows-centric. I’ve heard folks programming ARM with GCC, and it looks like Cordium is just using GCC for their compiler, so maybe truly cross-platform development is possible. I could totally see the Arduino aesthetic extending to more larger microcontroller architectures like the ARM. But like some of the more advanced Arduino boards (like the Arduino BT), the cheapest ARM board are relatively expensive and if you blow the controller, you’re out of $40. I wish Cordium’s Stamp-like module was about $20 cheaper or I’d be all over it in a heartbeat. Left by todbot on August 22nd, 2007 Hi todbot, I’m quite new to the embedded world (OK, better consider me a total newbie). I’m thinking about Arduino as a starter kit (basic reasons are it’s price and open source nature, linux environment). Yet, there are some questions: 1. In what cases can this board suffice instead of a (much more expensive) ATMEL programmer board? 2. Are there any sort of debugging tools in there? Thanks in advance. Left by newbie on September 28th, 2007 Hi newbie, As for (1), the official Atmel programmer boards like the STK500 aren’t that much more expensive, like $75 or so, so you can get both an Arduino and an STK500. :) The Arduino only works with ATmega8 and ATmega168 chips, so if you want to work with other AVR devices, you’ll need to wire up your own circuit or use something like an STK500.

As for (2), it depends on what you mean by debugging. Most AVR chips support a thing called debugWire, which is lets you step through code running on a chip via a single wire connected to the RESET pin. The more advanced AVR chips support industry standard JTAG debugging. In both cases, you use the Windows-only AVRStudio to run the debugger. In general though for Arduino debugging, most code is small enough that people just put in appropriate print() statements or blink LEDs to indicate various code paths or conditions. For higher-speed debugging, it’s common to toggle a pin and look at the timing of that pin’s oscillations on an oscilloscope. Most people using Arduino don’t use real debuggers as the code is small enough to understand by inspection or simple print statements. Think back to when you first started programming and all the programs were a page in size. It was easier to just try the program out and see what happens than get a debugger involved. That’s the way Arduino is, just try things out! Left by todbot on September 28th, 2007 Thank you for the quick reply :) It clears things out a lot to me. I think I’m gonna go for both (plus a breadboard and other paraphernalia). Sad thing though that AVRStudio is a windows only application. I hope that we’ll soon see a linux version (or an open source clone). Btw, great blog. Keep on good work. Left by newbie on September 29th, 2007 Thanks! One of the big benefits of Arduino is that it’s open-source and cross-platform: Linux, Mac OS X, and Windows. Also, you can do most of what AVRStudio does using the open-source command-line components that Arduino uses to compile your code (avr-gcc & avr-libc) and program your chips (avrdude). Left by todbot on September 29th, 2007 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… Left by Dave on October 13th, 2007 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. Left by kd5jos on November 23rd, 2007 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.

Left by Gabriel on November 24th, 2007 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. Left by todbot on November 24th, 2007 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. .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? Left by DiGiKits on December 29th, 2007 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 Left by A. Franco on February 6th, 2008 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. Left by todbot on February 6th, 2008 I am enjoying an Arduino so much that I’ve put together some tutorials to help absolute beginners have the same fun. There’s also a “Getting started (setting up)” page. The material addresses many of the questions raised in the thread above. Tom Left by Tom Boyd on February 13th, 2008 Try PicAxe..cheaper and a lot easier. :) Left by vincent on April 15th, 2008 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 and look for the BS1 board. It’s a complete development board with solderless breadboard, comes with the Basic Stamp microprocessor, power regul tion, and really it’s the ultimate Arduino Killer. hehe… a Left by humanoido on September 1st, 2008 Humandoido, the BS1 is woefully underpowered compared to what the BS2 can do, and the BS2 is similarly underpowered compared to Ardui o. There are several open source Arduino-clones for around $19 that are n equivalent in functionality to a real Arduino. But I love the BS2, and I use it still occasionally. Left by todbot on September 1st, 2008 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. Left by Josh on September 8th, 2008 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. Left by todbot on September 8th, 2008 You should look into the C Stamp. It supports full ANSI C, but with a software infrastructure that makes its usage as easy as the basic stamp. It also has 48 pins and many peripherals, including 12 channels of analog2digital conversion. See Left by Dr. Orlando Hernandez on September 16th, 2008 [...] ?????????????????? What is [...] Left by ?????????????? ??? arduino « Ayarafun factory on November 12th, 2008 [...] ?????????????????? What is [...] Left by Ayarafun Factory » ?????????????? ??? arduino on November 16th, 2008

I still prefer the Basic Stamp. It’s easier to use. Left by Dr. Tom Berchman, ASP, PhD on December 6th, 2008 One of the big benefits of Arduino is that it’s open-source and cross-platform: Linux, Mac OS X, and Windows. Left by Peter on April 8th, 2009 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! Left by Outlander on June 2nd, 2009 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. Left by todbot on June 2nd, 2009