Programming Your Own ATtiny – in 9 easy steps

  1. Go to http://code.google.com/p/arduino-tiny/downloads/list, and download arduino-tiny-0022-0008.zip or the latest version thereof.
  2. In your sketches folder, create a folder called “hardware” and put the contents of the zip file in it.
  3. 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=arduino:arduinoisp
     # 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.

  4. Open the Arduino IDE. You should now see each of the boards listed in the file you just edited.
  5. 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.

  6. 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.
  7. 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
  8. 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.