The Arduino platform has a lot of advantages. It’s designed so that artists and hobbyists can do lots of cool stuff. There are plenty of tutorials for beginners, and the standard hardware means that incompatibilities won’t add extra confusion when learning microcontroller programming. Getting started is inexpensive — for $25ish, one can get a relatively self-contained hardware prototyping platform. Also, Arduino was carefully designed to have a smooth transition to more specific hardware in production — the hardware is open, and there isn’t any vendor lock-in.
However, there are also many benefits to reaching beyond Arduino. Much useful hardware isn’t available in a “shield” package (and what is tends to be expensive compared to just the components), and changing the hardware allows more flexibility in price, power, and size. Also, using C and its tools allows more options than the Arduino environment alone. (And it’s fun to learn how things work at a deeper level!)
Unfortunately, once you try to move a step or two outside of the Arduino ecosystem, beginner-friendly documentation gets thinner. The information is there if you know how to find it, but many questions have to be answered at once, upfront.
I have been using “raw” AVR microcontrollers for some personal projects, and I’m going to describe are some tools and resources I’ve found useful. (There are also non-AVR microcontrollers, like PICs, but I’m going to ignore those because they have less in common with Arduinos.)
What Arduino Provides
First, though, it’s worth noting what’s actually in an Arduino: there are two ATmega328P chips (yes, two: the second handles USB communication), a voltage regulator (to clamp input power to 5 volts), attachments for barrel-jack and USB power, a PCB with convenient labels for the GPIO pins, capacitors to smooth out voltage spikes, and some LEDs and miscellaneous parts.
What would a bare minimum project need, though? Instead of two ATmega328Ps, a single ATtiny84 might suffice. They’re a lot cheaper ($1, vs. two $3-ish chips), but they still have a decent amount of GPIO pins and other resources. It will still usually need a voltage regulator (such as the LM7805) and capacitors, and you can never have too many LEDs.
Still, that only adds up to $2-3 dollars worth of hardware. (Once you have a couple projects going, paying $25 per Arduino adds up!) To provide a self-contained platform, every Arduino has to include a bunch of functionality that you really only need to buy once. (There are cheaper Arduino variants without some of this hardware, such as the Arduino Pro Mini, but they’re still around $10 range.) Most notably, you need an In-System Programmer (ISP), AKA, the device that flashes your compiled programs onto the microcontroller. You can use an Arduino as an ISP for other AVR microcontrollers (see the ArduinoISP sketch), you can get an inexpensive kit like a USBtinyISP (what I use), or a more expensive device like an AVR JTAGICE, which also allows step-by-step debugging and other advanced features.
Once you start choosing custom hardware, you have to learn to sift through millions of options. Hobbyist retailers like Sparkfun can be very helpful here — they narrow a seemingly infinite menu to a representative set of choices and have handy discussion threads about items in their catalog. Still, they are a reseller, and there is inevitably some markup. Parts are often cheaper if you buy direct from industrial suppliers like Digi-Key or Mouser, and there are usually steep discounts when items are bought in packs of 10, 25, or more. (Commercial fabricators often buy reels of 10,000 or more units at a time, remember.)
The problem with suppliers like Digi-Key is the paradox of choice. You want to buy a white LED? They have 12,592 kinds available… which did you have in mind? The search options contain dozens of cryptic abbreviations. Still, if you rule out options that are sold with a minimum quantity of 10,000, have a lead time of weeks (are not in stock), or are usable at extreme temperatures (and cost extra), that usually narrows things down.
Also, components tend to vary in their package. Through-hole components are easy to work with — they can be plugged into a breadboard, or have their leads go through perfboard or a PCB and soldered in place. (Through-hole ICs are also called “DIP”.) Surface-mount components (e.g., SOIC) are designed to lay flat on a board. While surface-mount soldering takes a bit more precision, it is still a very learnable skill, even if you don’t have Jordan Schaenzle to teach you. Other packages, such as BGA, can be significantly harder to work with by hand and are designed solely with mechanical assembly in mind.
Another crucial skill is learning to read data sheets. This is how you learn which wire means what, what registers to set / check for useful functionality, voltage limits, and so on. Charts like this become important as you hook things together, and most chips are too small to have labels. Data sheets also include details about registers, which are important when programming.
Finally, in order to program the chips, you’ll need a C compiler and runtime. Fortunately, AVR-GCC and AVR-libc are free and available for most major platforms. After you compile your projects, you can flash them onto the chips with AVRDUDE, a command-line AVR Downloader and UploaDEr.
Also, I will be presenting at Strange Loop this Thursday morning, speaking on data compression and the heatshrink library. See you there!
There’s only one 328P chip there. The USB handler is a different device.
You’re right – I double-checked the Uno schematic, and it’s an ATmega16U, not an ATmega328P. Those add about the same cost to the overall bill of materials, though.
Comments are closed.