- Go to http://code.google.com/p/arduino-tiny/downloads/list, and download arduino-tiny-0022-0008.zip or the latest version thereof.
- In your sketches folder, create a folder called “hardware” and put the contents of the zip file in it.
- 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.
- Open the Arduino IDE. You should now see each of the boards listed in the file you just edited.
- 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.
- 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.
- Now wire up your Arduino to the ATtiny chip. Here are the connections you need for each ATtiny pin to your Arduino:
- digital 10
- digital 11
- digital 12
- digital 13
- You are ready to program. To test it do the following:
- Open up the Blink sketch, under examples/basics.
- Change all instances of pin 13 to pin 0.
- 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.
- Hook up a 1k resistor & LED from ATtiny pin 5 (digital 0) to ground.
- 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.