Program an ATtiny Using an Arduino

I am a big fan of the Arduino platform. For those who aren’t familiar with the Arduino, it is a microprocessor development environment & ecosystem. You can visit their site for more info. I started playing with the Arduino and soon discovered the ATtiny microprocessor chip, which is a much smaller cousin to the ATmega series which is used in the Arduino.  Unfortunately, the Arduino IDE did not support it. Since most micro development apps run only on Windows (I use Ubuntu Linux), and require either expensive compilers or hard to use C or Assembler, I was never up to the effort required in using the ATtiny chips.

All of this changed yesterday when I was going through my Arduino notes and came across some attempts by others to use the Arduino IDE to program the ATtiny. One fellow was successful on the ATtiny45. Another tried on the ATtiny85 but didn’t seem to get as far. After much searching, I stumbled across the Arduino-Tiny project. The project is fairly mature, and they have already done all the hard work. The result is fantastic. You can program in C++ using the regular Arduino libraries (which have been modified for the ATtiny). Of course, many features are not available, but that is expected. When you have your sketch written, you can upload it to the ATTiny using either an in-system programmer (like USBTinyISP) or even better, you can use an Arduino itself.

Close only counts in horseshoes and hand grenades

I was all set now. I had an Arduino. I had an ATtiny85 chip. Following this tutorial, I wired everything up, and uploaded the sketch to make the Arduino an ISP (in-system programmer). I then opened the example sketch “blink” and changed the pin from 13 to 0. When I tried to upload the sketch to the ATtiny, I got this error:

avrdude: stk500_recv(): programmer is not responding

I was ATtiny85 programmed with ArduinoIDE - Blinky Sketchclose, but no cigar. After considerable searching again, I at last found the solution to the problem. It appears you must tie the reset pin of the Arduino to high (+5v) via a small resistor (120 ohms is recommended, but it also worked with 500 ohms in my case). At last, sweet success – a blinking LED. My thanks to the folks on this Arduino thread for that insight.

Programming Your Own ATtiny – in 9 easy steps

For those wanting an easy way to program ATtiny chips, here is what you need to do:

  1. Make sure you are using the latest Arduino IDE – currently version 022. Close it if you have it open.
  2. Go to, and download or the latest version thereof.
  3. In your sketches folder, create a folder called “hardware” and put the contents of the zip file in it.
  4. In that hardware folder, under the “tiny” folder, you should see a file called “boards.txt”. Open it for editing. For each ATtiny chip you plan to program, you need to set the ISP you’ll be using. In this example, I am using the Arduino as an ISP, so this block (for ATtiny85, 1MHz clock) will look like this when finished:

    # The following DO work (pick one)...
     # attiny85at1.upload.protocol=avrispv2
     # attiny85at1.upload.using=pololu

    If you haven’t figured it out, the ‘#’ sign at the beginning of a line will comment it out. Make sure only one of these lines is not commented – the one you want to use.

  5. Open the Arduino IDE. You should now see each of the boards listed in the file you just edited.
  6. Now open the ArduinoISP sketch (found in the file/examples menu). Make sure your Arduino board is selected in the list of boards (your Arduino board, not the ATtiny, we are not to that step yet). Upload the sketch. You can add some diagnostic LEDs (with 1k resistors) at this point (or even before you upload the sketch). Put an LED (with resistor) on the following pins to ground:

    9: Heartbeat – shows the programmer is running
    8: Error – Lights up if something goes wrong (use red if that makes sense)
    7: Programming – In communication with the slave (use green if you like)

    You should now see the LED at pin 9 slowly pulse on and off.

  7. VERY IMPORTANT: To finish turning your Arduino into an ISP, you must connect a 120 ohm (500 ohm seems to work as well for me anyway) resistor from the reset pin to +5v. What this does is prevents the Arduino IDE from resetting the Arduino itself. After all, we are not programming the Arduino anymore after this, but the ATtiny. Don’t forget to remove this resistor when you want to program your Arduino again.
  8. Now wire up your Arduino to the ATtiny chip. Here are the connections you need for each ATtiny pin to your Arduino:
    ATTiny45 & ATTiny85 pinout

    ATTiny45 & ATTiny85 pinout

    1. digital 10
    2. nc
    3. nc
    4. ground
    5. digital 11
    6. digital 12
    7. digital 13
    8. +5V
  9. You are ready to program. To test it do the following:
    1. Open up the Blink sketch, under examples/basics.
    2. Change all instances of pin 13 to pin 0.
    3. Under the Tools/Board menu, select the ATtiny version you are using. I am using an ATtiny85, clock speed 1MHz. No external clock is needed.
    4. Hook up a 1k resistor & LED from ATtiny pin 5 (digital 0) to ground.
    5. Upload the sketch. Your Arduino pin 7 pin should blink, and the error pin should stay off. When it is done, your ATtiny LED should be blinking on and off.


Verify each step and the results. Hook up the LEDs to your Arduino to make sure it is working as an ISP. Make sure you have selected the right board for each chip you are programming.


You are now (hopefully) able to program an ATtiny with the same ease as you can an Arduino. The ATtiny chip is cheaper and smaller than the ATmega, and is perfect for light duty applications. The default fuse settings for ATtiny85 appear to be 1MHz for the clock. If you want a faster clock, you will need to change those. That will be my next project.

If you have trouble or questions, post me a comment below. I’ll do what I can to help. Enjoy those ATtinys.

Program an ATtiny Using an Arduino by Provide Your Own is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

This entry was posted in Tech and tagged , , . Section: . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.