December 6, 2009

Grokking Arduino

Now that I've constructed from scratch a testbed with a stable 5 VDC power supply, used it to power the ATMega168, added a rs232 interface, external timing, blinky blinky LED's an so forth, I decided perhaps I could now partially comprehend just what's going on with the all-inclusive Arduino platform. So I ordered an Arduino Duemilanove from Sparkfun to get a closer look. I set out to find out what all the hubbub was all about. After all, it's just a prebuilt AVR sled, right?

I first took a look at the hardware. If you look closely, you will see a lot of familiar stuff. Let's see, I see an AVR. I see a FTDI rs232 interface, with nifty SMD RX and TX LEDs. I see a power interface, voltage regulators with a couple electrolytics and a diode. I see a 16 Mhz crystal. I see a reset switch. I see some pin headers. So far, this thing has everything we built on our breadboard. Well, OK it has a few extra nifty hardware fetatures. Number one in my book is the USB interface. Notice two voltage regulators? Makes sense, we can power from our wall wart or alternately from the same USB interface we use to program. That is pretty nice. No more hacking 18ga wire spaghetti to the MOSI and MISO pins. Of course a biggy is the ATMega328 - It's a drop in replacement for the ATMega168, but with twice the program space. I also see some nice analog and digital I/O pinouts. I see an IC marked "358 G35A" - is that an op amp? It's over near the analog inputs, so I suspect that's the case. Let me know if I missed anything.

I spent some time readying my laptop to use all the Arduino environment goodness, and in doing so stumbled upon the why this thing is so cool. Sure the hardware is nice, but the Open Source Arduino development environment is the real jewel here. I had been spending my cycles manually driving avrdude and avr-gcc with my ATMega168/breadboard setup, which is fine for some with technical leanings, but what the Arduino folks did with their "sketch" programming environment was to abstract most programming tasks into something akin to snapping Legos together. And they open sourced the entire thing (I was on the verge of making my usual kneejerk dig on the Java programming language that Sketch was designed in, but it's so cool, I am going to let it be)! Now I haven't dug incredibly deep on this, but I get the idea. Of course this means they may have just successfully opened up a technology wide open for use by those who could care less about the inner workings, and more about creating cool shit. I may want to dig into C code, but now it seems that's a choice, not a requirement. Way cool. Way cool.

I was going to go into detail, explaining to you Internet readers all the crap I had to do to to get the environment working on my Ubuntu 8.10 (Intrepid) system, but it's late and probably largely irrelevant. Just a few notes before I part: Remember that you need avr-gcc 4.3.3 or better because 4.3.1 and older jacks up calculations with long ints on the 328. I solved my problems just by uninstalling all my AVR tools, logging into AVRFreaks and replacing them with the AVR tools DEB package supplied by them to address the issue. Or you could run Jaunty, or a Mac, or hell even Windows. However you do it, you have to check this out. Playing with Arduino is going to be excellent fun. In fact, I am going to show it to some of my artist pals to see what they do with it. I know what I'm going to do with it. Something big.

Arduino Development Environment ( (Sketch + tons of extra libs n stuff)

No comments: