Arduino
The Arduino is a little board that can serve as the core
of an embedded control project.
Arduino boards are based on a family of Atmel ATMEGA controllers.
Typical versions have a USB communication section,
but there are ways to do ethernet.
Best of all, they are cheap.
You can buy a basic Arduino for $20.00.
I like them a lot.
I would like them a lot more if they weren't so flakey
(see the section below entitled "issues").
Development on Fedora Linux
I have twice set up a development system for the arduino
on Fedora, and both times it was tricky.
You would think that an open source project like the arduino
would just work smoothly on an open source platform like linux,
but my experience has been otherwise.
With Fedora 14 and later, just do:
yum install arduino
See my specific notes on
Then we move on to the first of many ...
Issue 1 - Blink demo compiler bug
It wouldn't be so bad, except that the traditional demo to start any
new embedded programming project is the "blink an LED" project.
It is as traditional as "Hello World" in the world of conventional programming.
So to start a new system with uncertain development tools and hardware with
a buggy trivial demo is disheartening and discouraging.
I spent most of a day chasing irrelevant things because the blink
demo would not blink (the LED would just stay on after the image downloaded).
Of course, I assumed this was my fault, being new to all of this.
It turns out this is or was some kind of bug in the AVR compiler chain:
When I introduce an spurious global variable, it all works fine.
There is evidence that a fixed version of the compiler has been
placed among the Fedora 15 packages.
Issue 2 - Yet another compiler bug
Some years ago I went through a nightmare project with PIC controllers
and a horrible buggy C compiler. If Arduinos are like that was, I will
be out of here pretty quickly.
For details on this one, see this link.
Issue 3 - avrdude: stk500_recv(): programmer is not responding
This is an exceedingly cryptic (and common) error.
What it means is that the communication link to the Arduino is not
doing what it is supposed to.
The stk500_recv() part of the error is stupid and irrelevant
and can safely be ignored. This message is coming from the avrdude
program, stk500_rcv is some function in that program that we don't care
about, and all we do care about is that the "programmer" is not responding.
The message is additionally confusing because to most peoples way of thinking
we don't have a programmer. But the avrdude programmer is treating the arduino
as a programmer (or if you look at it another way an arduino has a built in
programmer), so this is the message you get.
The first time I got this error, I deserved it.
I was ignorantly trying to use IO pins 0 and 1 for my own purposes,
which you cannot do if you are also using the USB (as you essentially
always will be with an arduino), so there you are. Move my IO to pins 2 and up
and everything is fine.
Subsequently, I began getting this error for unpredictable and unknown reasons,
which ultimately turned out to be:
Issue 4 - bad hardware
Before I describe what was wrong with my Duemillanove board, I will tell
you about a trick that is sometimes recommended to fix things when an
arduino gets in some mess and cannot respond as a device programmer.
It seemed to fix my problem once, but I think that was just coincidence.
The following "rain dance" style fix may be useful when you have an
arduino that keeps giving the stk500_rcv error:
- Unplug the arduino from USB.
- Press and hold down the arduino reset button.
- While holding down reset, plug arduino back in.
Now to describe my bad hardware. The clue was that pressing the reset
button seemed to do nothing. If I had code running, and pressed the button,
it just kept on running. I thought this button was some unique and weird
button special to the arduino. I was wrong. I got the duemillanove schematic
and probed around and discovered that the button itself was fine, but that
it was not connected to the reset pin on the ATmega328 chip. I soldered on
a little wire to connect it up, and voila! All of my problems went away.
Well, all of my recent stk500_rcv error problems anyway.
There are quite a few reports on the forums about faulty arduinos, so it
certainly pays to be suspicious on these lines. I am told that manufacturing
may soon be moved from Italy to China, so we can expect a dramatic improvement
in quality control.
Development with Makefiles instead of the IDE
I want to do this mostly so I can use the editor of my
choice (and deeply ingrained habits), this is definitely possible,
see the info at this link.
Arduino Background information
There is a whole family of Arduino modules.
I have an Arduino Duemilanove with an ATmega328 chip
(some older Duemilanove have the 168 chip).
I also have an Arduino NG rev C, which is based on the
ATmega168 chip.
All of these boards are based on
Atmel 8 bit AVR risc microcontrollers.
The devices used are "megaAVR" family parts:
- ATmega8 16 Mhz, 8K flash, 1K SRAM, 0.5K EEPROM, 6 or 8 channel 10 bit ADC, 23 IO pins.
- ATmega168 20 Mhz, 16K flash, 1K SRAM, 0.5K EEPROM, 8 channel 10 bit ADC, 23 IO pins.
datasheet
- ATmega328P 20 Mhz, 32K flash, 2K SRAM, 1K EEPROM, 8 channel 10 bit ADC, 23 IO pins.
datasheet
The ATmega168 chip is used in the obsolete Arduino NG that I have. The ATmega8 chip was used in the
original Arduino USB module. The current production units all seem to use the ATmega328P chip.
These chips do no have native USB, but use a serial to USB converter chip.
Older modules use the FT232B.
The modules I have use the FT232R (by FTDI) and other modules
(such as the Arduino UNO) probably use something else.
Development Tools
This is always the crucial thing in any microcontroller project.
There is a gcc based C cross compiler, supplied FREE by the chip vendor (Atmel).
Feedback? Questions?
Drop me a line!
Tom's Computer Info / tom@mmto.org