Arduino and ATtiny45 / ATtiny85
We all love our Arduino's, but sometimes we just want to create a simple circuit and using an ATmega328 chip can be overkill or just plain too big. Well, did you know that you can use the Arduino IDE to program ATtiny45 and ATtiny85 8-pin chips?
Well you can, and this tutorial will show you how. We will program an ATtiny45/85 with the blink example sketch
Note: This tutorial uses Arduino 0.22. If you are using Arduino 1.0 you need to download a different attiny library. See this page for details (http://hlt.media.mit.edu/?p=1695)
We are going to use an Arduino UNO as the programmer by using the ArduinoISP sketch.
Firstly, you will need to add support for the ATtiny45/85 chips to your Arduino IDE.
- Download the file attiny45_85.zip
- Open up the zip file and copy the attiny_45_85 directory into your arduino-0022/hardware directory
Next, we need to load our Arduino UNO with the ArduinoISP sketch.
- Open the ArduinoISP sketch from the examples menu.
- Select the board and serial port that correspond to your Arduino board.
- Upload the ArduinoISP sketch.
Now we need to connect the Arduino board to the ATtiny as shown in the following diagram. Also connect an led and resistor between pin 5 and pin 4 (0V) observing correct polarity.
Once you have it all wired up, select the ATtiny45 (w/ Arduino as ISP) or ATtiny85 (w/ Arduino as ISP) board depending on the chip you are using
Then load up the Example sketch blink.
As the ATtiny doesn't have a pin 13, change the pin number in the sketch from 13 to 0 in the 3 places it occurs and click on the Upload button
You will get the following message, but ignore it, the upload should have worked ok.
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85 avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
Now the LED should be blinking.
The following Arduino commands are supported by the ATtiny library you have installed: