ATtiny-Based Beginner's Kit
28th June 2014
One of the most popular starting points for building microcontroller-based projects is the Arduino Uno, the board based on the popular Atmel ATmega328 and supported by the free Arduino development environment.
However, I'd like to suggest an alternative beginner's kit that costs less, and is in many ways more fun and more educational. My alternative is based on the ATtiny85, which with just 8 pins is one of the smallest microcontrollers in Atmel's AVR range:
Despite its diminuitive size it's packed with capabilities, and apart from having fewer I/O pins it can do most of what the ATmega328 in the Arduino Uno can do. And you can program it from the same Arduino IDE used with the Arduino Uno.
Here is my recommended kit of parts:
The heart of this kit is the Tiny AVR Programmer from SparkFun, a programmer board that fits directly into a computer's USB port, and allows you to program an ATtiny85 in the on-board socket, or in an external circuit using jumper leads. It can also be used to program other AVR chips, such as the ATtiny84 and ATmega328. It's available from SparkFun , or from Proto-PIC in the UK .
In addition to this I'd recommend:
- A set of jumper probes to connect between the Tiny AVR Programmer and your own circuits .
- A mini breadboard, to build circuits without the need for soldering. I use the ones shown above from SparkFun  or HobbyTronics in the UK .
- A set of precut jumper wires. I particularly recommend the Pololu ones  as they are coded with the resistor colour code so you immediately know which wire to pick. They're available from HobbyTronics in the UK .
- A spare ATtiny85 (one is already included with the Tiny AVR Programmer).
- A few additional components for making projects: an LED, a push button, a piezo buzzer, a 220Ω resistor to use with the LED, A CR2032 3V lithium battery, and a breadboard-compatible battery holder (available from SparkFun  or Proto-PIC in the UK ).
The total cost of all these components is about £25 or $40.
Before starting, read the SparkFun tutorial for information about setting up the Arduino IDE to work with the Tiny AVR programmer .
Step one - program the on-board ATtiny85
The first step is to upload a program to the ATtiny85 on the Tiny AVR Programmer board.
Set up the Arduino IDE by selecting ATtiny85 (internal 1 MHz clock) from the Board submenu on the Tools menu.
Connect the Tiny AVR Programmer with an ATtiny85 in the socket to a USB port.
Open the Blink example from File -> Examples -> 01.Basics.
Change the first line of the program to:
int led = 0;
because the LED is connected to I/O line 0 on the Tiny AVR Programmer.
Click the Upload button.
If all is well the LED on the Tiny AVR Programmer board should blink once every two seconds.
Step two - program an ATtiny85 on the breadboard
The next step is to build a simple circuit on the breadboard for the Blink project. You only need the ATtiny85, LED, and 220Ω resistor:
Remove the ATtiny85 from the Tiny AVR Programmer.
Connect the 220Ω resistor from VCC (pin 8 on the ATtiny85) to the positive side of the LED (the longer leg), and the negative side of the LED to I/O pin 0 (pin 5 on the ATtiny85)
Now connect the Tiny AVR Programmer to the ATtiny85 on your breadboard, using the jumper leads.
You only need to connect six of the eight connectors:
Connect them from the sockets on each side of the IC socket on the Tiny AVR Programmer to the corresponding pin of the ATtiny85 on the breadboard. The circuit on the breadboard will be powered via the 5V from the USB port.
You can then download the program to the ATtiny85 on the breadboard and the LED should flash.
Step three - create a stand-alone circuit
The third step is to disconnect the Tiny AVR Programmer, and add a battery holder and battery. You now have a stand-alone version of your simple Blink application!
If you want to change the program simply remove the battery, plug the jumper leads back in, and upload a new program.
Here are some suggested projects you could make with these components alone:
- An egg timer - beep the speaker after five minutes (or ten if you like yours hard-boiled).
- A reaction timer - beep the speaker after a random delay, then see how long until the player presses the button. Light the LED if they achieve better than 160ms (the mean for college students).
- A musical doorbell; play a tune through the piezo speaker when the button is pressed.
- A bath level alarm - use wires connected to an analogue input to detect the water level and beep the speaker when the desired level is reached.
- A clock that beeps the time in morse code when you press the button - you'll need to calibrate the ATtiny's internal clock for accurate time.
- ^ Tiny AVR Programmer on SparkFun.
- ^ Tiny AVR Programmer on Proto-PIC.
- ^ Jumper Wires Premium on Proto-PIC.
- ^ Breadboard - Mini Modular on SparkFun.
- ^ Mini Breadboard from HobbyTronics.
- ^ 140-Piece Wire Kit on Pololu.
- ^ 140 Piece Jumper Wire Kit on HobbyTronics.
- ^ Coin Cell Battery Holder - 20mm on SparkFun.
- ^ Coin cell holder - 20mm on Proto-PIC.
- ^ Tiny AVR Programmer Hookup Guide on SparkFun.
blog comments powered by Disqus