Tiny AVR Programmer Hookup Guide

Pages
Contributors: jimblom
Favorited Favorite 12

Programming in Arduino

Everyone loves Arduino! The simplified language makes programming AVRs and more complicated microcontrollers incredibly easy. Unfortunately, Arduino doesn't have any built-in functionality to program tiny AVRs, but that doesn't mean we can't add it!

On this page we'll go over all of the steps necessary to enable ATtiny45/85 programming in Arduino, using the Tiny AVR Programmer.

Step 0: Install Arduino

If you've never used Arduino before (where have you been?!), make sure you follow our What is an Arduino? and Installing Arduino tutorials before continuing on.

What is an Arduino?

What is this 'Arduino' thing anyway? This tutorials dives into what an Arduino is and along with Arduino projects and widgets.

Installing Arduino IDE

A step-by-step guide to installing and testing the Arduino software on Windows, Mac, and Linux.

Step 1: Installing the ATtiny Add-On

The next step is to install the Attiny addon. The following steps in 1a and 1b will explain how to manually install the ATtiny board files for Arduino.

Step 1a: Download the ATtiny Addon

To manually add ATtiny's to the standard Arduino IDE Board menu, you'll need to add a few files that help define the hardware. The latest ATtiny hardware definitions are kept in a repository on GitHub.

You can download them from there, or simply click on the archived links below (note: There are different files depending on which version of Arduino you are using):

Extract the ZIP folder, and don't forget where you put it!

Step 1b: Move the attiny Folder

There should be an attiny folder living within the attiny-ide-1.x.x.zip file you downloaded. Copy that folder and paste it into a folder called hardware within your Arduino Sketchbook directory.

If you're not sure where your Arduino sketchbook is, open Arduino and go to File > Preferences. The Sketchbook location should be the topmost entry in the Preferences dialog. By default, the sketchbook is usually an Arduino folder within your home folder (e.g. C:\Users\userName\Arduino on Windows, or /Users/userName/Documents/Arduino on Mac).

If there's not a hardware folder already in your Sketchbook make one. After placing the attiny folder in there, your directory structure should look a little something like this:

attiny and hardware folder directory structure

Step 2: Open and Configure Arduino

Almost to the fun part! Open Arduino. If you opened Arduino in the last step, close it and restart it.

Under the Tools > Board menu, you'll find the effects of the attiny folder. There should be twelve new entires in the board list, which allow you to program ATtiny45's, 85's, 44's and 84's. Each microcontroller can be set to a variety of clock speeds -- internal 1MHz or 8MHz or external 20MHz.

If you're using a bare, previously untouched ATtiny85 select ATtiny85 (internal 1 MHz clock). Be careful selecting here, selecting the 8 MHZ option will only make your sketch run slow, but selecting the 20 MHz option can "brick" your ATtiny. Do not select the 20 MHz option unless you have an external clock attached!

Arduino board selection

Unlike other Arduino boards, you don't have to select a Serial Port when using the Tiny AVR Programmer. But you do need to select a Programmer. Under the Tools > Programmer menu, select USBtinyISP.

Arduino programmer selection

Step 3: Plug in the ATtiny

Getting close to blinking! When you plug the ATtiny into your Programmer, make sure you get the polarity correct. The small, etched circle on the IC should line up with the "notch" on the Programmer's socket and silkscreen.

ATtiny85 polarity dot matches notch location

To get the IC into the socket, you may need to bend the legs on each side inwards a tad.

Step 4: Upload Code!

Time for the Blink sketch! The Tiny AVR Programmer has an on-board LED, connected to the ATtiny, which we can use to verify that code on the IC is running. The LED is connected to pin 0 in the Arduino environment. Copy/paste this code into your Arduino window:

language:c
int blinkPin = 0;

void setup()
{
  pinMode(blinkPin, OUTPUT);
}

void loop()
{
  digitalWrite(blinkPin, HIGH);
  delay(500);
  digitalWrite(blinkPin, LOW);
  delay(500);
}

Then click the Upload button just as you would with any Arduino board. The code will compile, and then it should upload insanely fast. That's the wonders of direct in-system programming for you. If successful, the on-board amber LED should start blinking.

Uploading Code the Hard Way

If you’re looking for more control over your Tiny AVR Programmer – and the AVR it’s connected to – follow along the tutorial for the Pocket AVR Programmer. While the tutorial was written for the Pocket AVR Programmer, it is functionally the same for the Tiny AVR Programmer. Just make sure to connect to the respective ICSP pins on the target AVR chip.

AVRDUDE via Command Lin