How to program ATTiny85 with Arduino Uno (part 1)

By | June 29, 2013

UPDATE, November, 2015: The article below was written for Arduino IDE versions, prior to 1.6.4. If you are currently using Arduino IDE 1.6.4, or later, follow the instructions in blog post instead.

This tutorial is based on the steps I took to program an ATTiny85 with my Arduino Uno and use the nifty little chip for a small line following robot. The idea for using the ATTiny came from the MAKE magazine and more specifically their “How-To: Shrinkify Your Arduino Projects” YouTube video.

The ATTiny libraries for the Arduino IDE come from the High-Low Tech group at the MIT Media Lab. They have some other interesting materials for Arduino on their site as well.

Step 1: Collect all necessary hardware components

  • An Arduino Uno (or compatible board)
  • An ATTiny85 IC
  • One 10 uF capacitor
  • Breadboard and jumper wires

In order to test the set-up, we will upload the Blink example to the ATTiny. For this optional step, you will need a LED and an appropriate current limiting resistor.

Step 2: Softwate set-up

  • Make sure you are running the latest version of the Arduino IDE (1.0.5 when this was written). The steps should work for 1.0 and above, but some menus may be slightly different.
  • Download the ATTiny library from the high-low tech group of MIT:
  • Unzip the attiny file. It should contain an “attiny-master” folder that contains an “attiny” folder.
  • Locate your Arduino sketchbook folder (you can find its location in the preferences dialog under “File” -> “Preferences”)

Arduino Sketchbook folder

  • Create a new sub-folder called “hardware” in the sketchbook folder, if it doesn’t exist already.
  • Copy the “attiny” folder (not the attiny-master folder) from the unzipped ATtiny to the “hardware” folder.
  • You should end up with a folder structure like this: “Arduino” > “hardware” > “attiny”. The “attiny” folder should contain a file “boards.txt” and another folder called “variants”
  • Restart the Arduino development environment.
  • You should see a number of ATtiny entries in the menu under “Tools” > “Board” menu.

Arduino Boards Menu

Step 3: Configure the Arduino Uno as a ATTiny programmer

  • Open the ArduinoISP sketch from the Examples (“File” ->”Examples” -> “Arduino ISP”).
  • Select the board and serial port that correspond to your Arduino board (e.g Arduino Uno).
  • Upload the sketch to the Arduino Uno

Step 4: Connecting the ATTiny85 to the Arduino

If you have not reviewed the ATTiny85 data sheet already, it is a good time to do so now. The ATtiny85 has 8 pins as per the diagram below. Pin 1 on the ATiny is marked on the chip by a small dot.

ATTiny 85 Pins

Wire up the ATTiny and the Arduino Uno as per the diagrams below (sources High-Low Tech group & MAKE).

  • Connect a 10 uF capacitor between “Reset” and “Ground” pins on the Arduino Uno board as shown in the diagram. The stripe of the capacitor with the negative sign (“-“) goes to the Arduino “Ground” pin. This prevents the Arduino Uno from resetting and ensures that the Arduino IDE talks to the ArduinoISP (and not the bootloader) during the upload of the sketches to the ATTiny.
  • Connect ATtiny Pin 1 (with the little dot) to Arduino Pin 10.
  • Connect ATtiny Pin 5 to Arduino Pin 11.
  • Connect ATtiny Pin 6 to Arduino Pin 12.
  • Connect ATtiny Pin 7 to Arduino Pin 13.
  • Connect the ground and 5v from the Arduino to the breadboard.
  • Connect ATtiny Pin 4 to ground.
  • Connect ATtiny Pin 8 to 5 volts.

Arduino Uno as an ATTiny85 programmer wiring diagram

Now it is time to test the set-up, by loading the Blink example on the ATTiny85.

  • Open the Blink example sketch (File -> Eamples -> 01.Basic -> Blink)
  • As the ATTiny does not have pin 13, you need to change the led pin in the sketch to one of the free pins on the ATTiny (pin 3 for example). Note that the pin-out of the ATTiny85 in the Arduino IDE differs from that in the data sheet. Refer to the diagram below:

ATTiny85 Pinout

  • Go to Tools -> Board and select “ATTiny85 (internal 1 MHz clock)”. There will be several entries for the ATTiny85, so make sure you have selected the one with the 1 MHz clock.
  • Go to File -> Upload using programmer
  • You may get an error like this: “avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85”. You can ignore it for now.
  • Connect an LED and a resistor between pin 3 of the ATTiny85 chip and ground and power up the ATTiny85.

If you see the LED blinking, you have got the set-up right!

In part 2 of the “How to program ATTiny85 with Arduino Uno” tutorial I cover the steps to make the ATTiny85 run at 8 Mhz and get it ready for more interesting projects, like a little line following robot, for example.

6 thoughts on “How to program ATTiny85 with Arduino Uno (part 1)

  1. Mohamed Kamel

    Thanks for this tutorial, but there’s a noticeable fault in the timing.
    i’ve programmed it to blink every 1 minute , and it blink after shorter time.

  2. David

    thank you, thank you, thank you, for putting it in plain English
    I went through your pages and it worked first time

  3. Wonder star

    Step 3: Configure the Arduino Uno as a ATTiny programmer

    Open the ArduinoISP sketch from the Examples (“File” ->”Examples” -> “Arduino ISP”).
    Select the board and serial port that correspond to your Arduino board (e.g Arduino Uno).
    Upload the sketch to the Arduino Uno

    Which programmer selection should I choose? ArduinoISP? Arduino as ISP? ??? On step 3.

    1. Stan Post author

      Yes, the shield just replaces the breadboard and wires, other than that the connections should be the same.


Leave a Reply

Your email address will not be published. Required fields are marked *