ATtiny

The same folks who make the Atmega328 microcontroller at the heart of the Arduino Uno board also make a line of super low-cost microcontrollers that cost just a few dollars each. There are various models in the ATtiny range but by far the most useful and least expensive for embedded projects is the ATtiny85.

Using an Arduino Uno as a programming device you can easily download software written in the Arduino development software and download it to an ATtiny85 to leave permanently embedded in your next project.

The ATtiny85 is an incredibly bare-bones chip but with some surprising features. Here’s a run-down of what this 8-pin chip brings to the table:

ATtiny85 Pinout

1 Reset (or Pin 5 or Analog 0)
2 Pin 3 (or Analog 3)
3 Pin 4 (or Analog 2)
4 Ground
5 Pin 0 (with PWM)
6 Pin 1 (with PWM)
7 Pin 2 (or Analog 1)
8 VCC (Power input – typically 5v power)

As you can see these 8 pins often do double duty, serving as digital input/output pin or analog inputs, etc. In addition when downloading sketches from the Arduino into the ATtiny85 these same pins are used for programming functions.

Out of the box ATtiny85 chips run at 1mHz, one million machine language instructions per second. Compare that to the 16mHz rate of an Arduino Uno. Using a special programming technique an ATtiny85 can be set to run at 8mHz. Why would you ever want to leave your ATtiny85 running at 1mHz? It uses less power of course! If you don’t need the extra speed keep your ATtiny running slow.

In order to load and run a simplified Arduino program onto an ATtiny85 chip you will need the following:

A computer running the free Arduino software
The equally free ATtiny add-on software
An Arduino Uno board
A solderless breadboard and hookup wires
An ATtiny85 microcontroller chip
A 10uf electrolytic capacitor

That’s literally the minimum to get started. If you already have an Arduino starter kit you basically need to add just the ATtiny85 chip and the 10uf capacitor to get up and running!

In addition you can hook up 3 LEDs to additional Arduino Uno pins to see the ATtiny85 programming process as it happens:

Pin 9: Heartbeat – blinks while the programmer is running
Pin 8: Error – indicates something has gone wrong
pin 7: Programming – shows communication is happening

Alternate ATtiny Cores:
The default core written by MIT is a bit limited, offering PWM on only two pins, no tone functions to drive a speaker, etc. Luckily the internet is full of other core options including one widely used from the kind folks at Google.

Powering the ATtiny85:

Two AA or AAA batteries in series supplying around 3v.
A 9-volt battery and a 7805 voltage regulator supplying 5v.
How about a CR2032 3V button battery for an ultra-small profile?

Project Ideas:
http://letsmakerobots.com/node/39790
http://ttjcrew.com/2011/09/18/rfid-tag-cloning/
http://www.embedds.com/very-simple-low-power-fireflies-based-on-attiny-micros/