Program ATtiny85 ATtiny45 using Arduino

by Oscar

This post shows you how to program ATtiny 85 and 45 micro controllers using the Arduino as an ISP. I also explain the advantages of using Attiny chip over Arduino for DIY projects. 

Some of the links on this page are affiliate links. I receive a commission (at no extra cost to you) if you make a purchase after clicking on one of these affiliate links. This helps support the free content for the community on this website. Please read our Affiliate Link Policy for more information.

What is ATtiny?

ATtiny is a family of micro-controllers for DIY projects, popular models including the ATtiny85 (8 pins) and ATtiny4313 (20 pins).

ATtiny is like a cousin to the ATmega, which is the MCU in the popular Arduino boards. One of the main differences is the ATtiny is generally smaller (as the name suggests).

You can replace the Arduino with an ATtiny chip if your project requires only a few simple inputs and outputs. The ATtiny costs less (only about $3), and takes up less physical space. However you will need an external hardware programmer to program them.

In this post i will show you how to easily program an ATtiny85 and ATtiny45 using an Arduino board. Here is a post about how to program the ATtiny2313 and ATtiny4313.

Programming ATtiny45, ATtiny85, ATtiny44 or ATtiny84

I learned how to program ATtiny 45/85 from this tutorial (link), it’s a bit long, so I have summarized the steps here.

Adding ATTINY to the list of supported boards in Arduino IDE

  1. Download and install the latest Arduino IDE (Link)
  2. Download ATTINY Library for Arduino, and Unzip it (Link)
  3. Go to your Arduino Sketch book folder (the folder where the Arduino IDE stores your sketches. This folder is automatically created by the IDE when you install it)
  4. Create a new sub-folder called “hardware” in the sketchbook folder
  5. Copy the “attiny” folder (not the attiny-master folder) from the unzipped ATtiny to the “hardware” folder. You should end up with this folder structure: Documents > Arduino > hardware > attiny that contains the file boards.txt and another folder called variants
  6. Restart the Arduino IDE. You should now see ATtiny entries in the Tools > Board menu

ATTiny and Arduino Connection

Here is the wire connections between the ATTiny chip and Arduino board in order to flash it. You will also need to connect a 10uF capacitor between ground and reset on the Arduino.

It’s pretty straightforward, if you still need help you can find detailed explanation in this article (link).

Flashing ATTiny using Arduino

And finally we can try and upload a program to the ATTiny, I am going to use the “blink” sketch as an example here:

  • Open the Blink sketch
  • Change the LED pin number from 13 to 0 (Note: the pin numbers on the ATtiny85 are different to the Arduino)
  • Select the appropriate ATtiny IC model in the menu, Tools > Board
    • For example, Attiny85 (internal 8mhz clock)
  • Select “Arduino as ISP” from menu, Tools > Programmer
  • Upload the sketch

This will take half a minute, and when it’s compelted you should see “Done uploading.” in the Arduino IDE console without any error messages.

If you then connect an LED between pin 0 and ground, you should see it blinking. Note that you may need to disconnect the LED before uploading a new program.

Edit History

  • Oct 2013 – Tutorial created
  • July 2018 – Updated

Leave a Comment

By using this form, you agree with the storage and handling of your data by this website. Note that all comments are held for moderation before appearing.

1 comment

Pedro Augusto Barbosa de Souza 13th December 2015 - 5:20 pm

Excellent tutorial and amazing blog! im a big fan of your work!