Topics

► Games

► Sound & Music

► Clocks

► GPS

► Tools

► Tutorials

By processor

► ATtiny85

► ATtiny84

► ATtiny841

► ATtiny2313

► ATtiny861

► ATmega328

► ATmega1284

About me

  • About me

Feeds

RSS feed

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:

ATtiny85.jpg

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:

BeginnersKit.jpg

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 [1], or from Proto-PIC in the UK [2].

In addition to this I'd recommend:

  • A set of jumper probes to connect between the Tiny AVR Programmer and your own circuits [3]
  • A mini breadboard, to build circuits without the need for soldering. I use the ones shown above from SparkFun [4] or HobbyTronics in the UK [5].
  • A set of precut jumper wires. I particularly recommend the Pololu ones [6] 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 [7].
  • 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 [8] or Proto-PIC in the UK [9]).

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 [10].

Step one - program the on-board ATtiny85

The first step is to upload a program to the ATtiny85 on the Tiny AVR Programmer board.

Beginner1.jpg

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:

Beginner2.jpg

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:

Signal ATtiny85 Pin
Reset 1
GND 4
MOSI 5
MISO 6
SCK 7
+5V 8

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!

Beginner3.jpg

If you want to change the program simply remove the battery, plug the jumper leads back in, and upload a new program.

What next?

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.

  1. ^ Tiny AVR Programmer on SparkFun.
  2. ^ Tiny AVR Programmer on Proto-PIC.
  3. ^ Jumper Wires Premium on Proto-PIC.
  4. ^ Breadboard - Mini Modular on SparkFun.
  5. ^ Mini Breadboard from HobbyTronics.
  6. ^ 140-Piece Wire Kit on Pololu.
  7. ^ 140 Piece Jumper Wire Kit on HobbyTronics.
  8. ^ Coin Cell Battery Holder - 20mm on SparkFun.
  9. ^ Coin cell holder - 20mm on Proto-PIC.
  10. ^ Tiny AVR Programmer Hookup Guide on SparkFun.

blog comments powered by Disqus