T³: Programming an ATtiny84A from Arduino

How to set up an Arduino as an in-system programmer (ISP) and program an Atmel ATtiny84A to blink

Favorited Favorite 3

I’m currently working on a project that requires a cheap, low-power microcontroller that’s programmable through Arduino and has a few more pins than the ATtiny85. That’s where I found the ATtiny84A. It has many of the same features as the ATtiny85, but has 12 I/O pins instead of six.

As it turns out, a lot of work has already been done to program ATtiny microcontrollers from Arduino, which makes this pretty easy. To start, connect an Arduino (UNO, etc.) to the ATtiny84A using the Arduino as ISP configuration. I’ll be using a 3.3V Arduino Pro Mini to keep everything nice and tidy on a breadboard.

ATtiny84A connected to Arduino Pro Mini as ISP

ATtiny84A connected to Arduino Pro Mini

Connect the Arduino to your computer, open the Arduino IDE and select File > Examples > 11.ArduinoISP > ArduinoISP.

Arduino as ISP

Select your Board from Tools (Arduino Pro Mini 3.3V in this case), choose the serial port and upload the ISP sketch to the Arduino. Note that in this first step, we’re programming the Arduino to act as an in-system programmer (ISP), which we’ll use to send compiled programs to our target microcontroller (ATtiny84A).

Once you have uploaded the ISP sketch, place a 10μF capacitor across RESET and GND of the Arduino board (watch the polarity – for electrolytic and tantalum capacitors, make sure the side with negative markings, “-”, is connected to GND). Many Arduino boards are configured to reset when avrdude (the tool that Arduino uses to upload code to Atmel AVR microcontrollers) begins communication across the serial line. We can prevent that from happening by adding the capacitor.

Arduino Pro Mini with 10uF capacitor to be used as ISP

10μF capacitor added between RST and GND on the Arduino Pro Mini

At this point, we have the Arduino configured as a programmer for the ATtiny. Now, to program the ATtiny from the Arduino IDE, we need to include some custom board definitions. Luckily, GitHub user damellis has already created them for us (specifically for the ATtiny24/44/84 and ATtiny25/45/85). All we have to do is include them in our IDE.

In File > Preferences, paste the following URL into Additional Boards Manager URLs.


Arduino Boards Manager URL

In Tools > Board > Boards Manager…, search for “tiny” and install the attiny boards' definitions.

Arduino Boards Manager

We can finally write some code for the ATtiny! Open a new Arduino sketch and copy in the following. Note that we connected the LED to pin 13, which is PA0, and corresponds to D0 in Arduino code (see the pinout diagram below).

const int led = 0;

void setup() {
  pinMode(led, OUTPUT);

void loop() {
  digitalWrite(led, HIGH);
  digitalWrite(led, LOW);

In case you were wondering how PA0 on the ATtiny84A matches with D0 on the Arduino, here is a diagram that will help:

alt text

ATtiny44/84 pinout courtesy of PighiXXX

Under Tools, select the following to make the ATtiny84A the target platform:

  • Board: ATtiny24/44/84
  • Processor: ATtiny84
  • Clock: Internal 1 MHz
  • Port: <The serial port attached to your Arduino>

Attiny84A as target board in Arduino

Upload the sketch, and you should be greeted by a beautiful blinking LED!

Blinky from an ATtiny84a

For more information on programming with ATtiny microcontrollers, check out these tutorials:

Tiny AVR Programmer Hookup Guide

A how-to on the Tiny AVR Programmer. How to install drivers, hook it up, and program your favorite Tiny AVRs using AVRDUDE!

Pocket AVR Programmer Hookup Guide

Skip the bootloader and load your program directly onto an AVR with the AVR Pocket Programmer.

Re-Programming the LilyTiny / LilyTwinkle

A quick tutorial showing how to reprogram the ATtiny85 IC found on the LilyTiny or LilyTwinkle boards.

Comments 6 comments

Related Posts

MaKey MaKey

Recent Posts


All Tags