Thursday, August 8, 2013

Understanding the Arduino platform (You don't need a separate Arduino board for everything you build)

From time to time, I've heard some objections about using the Arduino platform to build things because of the costs. Arduino prices have come down, but it's also worth understanding you don't need an Arduino board for every project.
The Arduino is essentially a board that has an Atmel AVR ATmega328p microcontroller chip on it with a USB interface, power supply, clock crystal, and a lot of sockets for the pins in a (now) well known form factor that allows stacking additional board/modules called shields for additional functionality.
The older units had an FTDI USB serial interface chip on it which added significantly to the cost, but had some interesting alternative uses. Newer Arduinos use another Atmel AVR chip that has USB support built in, which winds up being less expensive than the FTDI chip.
The form factor (size of the board with pin sockets) makes it easy to get started and prototype but also adds to the cost.
The Arduino software environment also makes it significantly easier to get started with microcontroller programming.  There is an small, development environment for Windows/Mac/Linux which completely wraps the C/C++ compiler and chip programmer making it a simple push button operation to compile your sketch and program the chip.
The AVR microcontroller is essentially a full system on a chip, with an 8 bit CPU, a small amount of RAM, 32K of flash memory, a small EEPROM, and a TTL level serial interface.  There is even an internal oscillator so you don't have to use a separate crystal, or resonator, if you have an application where you don't need the timing stability offered by an external crystal.
Bare ATmega328P chips cost $2-4 in single quantities.  They come without any programming, so you need hardware to program the chip.
The Arduino gets around the need for having hardware to program the microcontroller chip by preloading a bit of firmware, a boot loader, that allows the chip to receive code over the USB/Serial interface and write it to the 32K flash to program itself.
An Arduino can be used to program bare AVR chips, so you can use one Arduino to create more Arduinos.
So the moral of the story, once you've built something using an Arduino, you don't have to dedicate a whole Arduino board to each device.  You can easily build your project with a bare AVR chip and only the supporting components you need for your projects.  Typically this can be done for less than $5.

Note: This post is another reply that I had sent to a mailing list that I thought would be worth preserving and sharing as a blog post.

No comments: