Program an ATtiny With Arduino




Introduction: Program an ATtiny With Arduino

About: My name is Randy and I am a Community Manager in these here parts. In a previous life I had founded and run the Instructables Design Studio (RIP) @ Autodesk's Pier 9 Technology Center. I'm also the author ...

Follows are directions for programming the ATtiny microcontrollers using the Arduino IDE. In plain English, this is how to program 8-pin Atmel chips as you would normally an Arduino. This is cool because the ATtiny is tiny, and - well - this allows you to make tiny things that don't need a big ol' microcontroller.

The instructions I have posted here are pretty much the same as instructions given by the incredibly awesome High-Low Tech Tutorial. I posted my version of the instructions here because I plan to make a couple of upcoming projects using ATtiny chips and figured I would show my process.

Step 1: Go Get Stuff

You will need:

- Arduino
- Breadboard
- ATtiny85 (or ATtiny45)
- 10uF electrolytic capacitor
- 220ohm 1/4 watt resistor
- hookup wire

Please note that some of the links on this page contain Amazon affiliate links. This does not change the price of any of the items for sale. However, I earn a small commission if you click on any of those links and buy anything. I reinvest this money into materials and tools for future projects. If you would like an alternate suggestion for a supplier of any of the parts, please let me know.

Step 2: Wire the Circuit

Connect the Arduino to the ATtiny as follows:
  • Arduino +5V      --->  ATtiny Pin 8
  • Arduino Ground --->  ATtiny Pin 4
  • Arduino Pin 10   --->  ATtiny Pin 1
  • Arduino Pin 11    --->  ATtiny Pin 5
  • Arduino Pin 12    --->  ATtiny Pin 6
  • Arduino Pin 13    --->  ATtiny Pin 7

Step 3: Program the Arduino

Select the "ArduinoISP" sketch from the "Examples" menu.

Upload the sketch to your Arduino as you would any other sketch.

Your Arduino is now configured as a serial programmer that can program other chips.

Step 4: Filter Cap

Put the 10uF capacitor between ground and the Arduino reset pin. Make sure to keep an eye on the capacitors polarity (ground to ground!).

It is rumored you only need this for the Arduino Uno, but I have found it helped matters to include it with earlier versions as well. If you find that it is not working in the next steps, simple remove it and see if that helps.

Step 5: ATtiny Core Files

Take note of your sketchbook folder from the Arduino preference menu.

Create a new folder in your sketchbook folder called "hardware"

Then, go to this page and download the file:

Unzip this file and leave it in the new hardware folder.

Finally, restart the Arduino programming environment. The new cores should now be loaded.

Note that there are also core files for a number of other ATtiny chips. This page is a good starting point for interfacing with a wide range of them using the Arduino.

Step 6: Program the ATtiny

Select from the top menu:
Tools --> Board --> ATtiny85 (w/ Arduino as ISP)

(Of course, you will want to select a different chip for this if you are using one.)

Then open the basic blink example and change the pin number from 13 to 0.

Finally, upload it as you would any other sketch.

It should give the following error twice:
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

Simply ignore the error message and you should be good to go.

Step 7: Test Circuit

Connect a 220 ohm resistor to pin 5.

Connect an LED between the resistor and +5V.

It should blink.

Congratulations. You're done.

19 People Made This Project!


  • Creative Misuse Contest

    Creative Misuse Contest
  • Tiny Home Contest

    Tiny Home Contest
  • Fix It! Contest

    Fix It! Contest

199 Discussions

This looked like such a cool project. But I am running into an issue that I can't figure out. I get the error once and then it says:

avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.

When I connect the LED, nothin. :-(

11 replies

I had your error with a tiny85 that I've already used to try this project earlier in 2012, but I think it was fried or I fried it, because then I tried with the same exact config but another one and it was up and running!

That is exactly what happened. I put this project aside for a year and wend back at it and tried a new chip and it all worked great. I tried one of the chips that was an issue and it was still an issue. So bad chip, I fried it somehow? Who knows and who cares. I got it to work and the AT tiny85s are inexpensive.

I have the 1.0.3 version and switched back to 1.0.1 and getting the same error. I tried the trick that hydronics did but that didn't work either.

I have ATTINY85-20PU
Arduino UNO R3
Board is set to ATTINY 85 (external 20 MHz Clock)
Programmer as Arduino as ISP

Tried Upload and Upload using Programmer

I was able to get the Burn Bootloader to run once with the proper error messages. Nothing else seems to be going as it should.

Binary sketch size: 834 bytes (of a 8,192 byte maximum)
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.

Don't bootloader and use External. It will damages core. I damaged mine.

Selecting "External" means you need a external crystal for it to work.

You can add a crystal, reprogram with "Internal" setting and remove external crystal.

I have used that exact chip and got those errors to rectify it I did this
1 load *ArduinoISP* sketch to arduino board
2 Use ATtiny 85 (internal 1Mhz clock) as board
3 Double check your connections ( i say this because in my case I had reset connected to pin 9 instead of pin 10 when `i got this error)
4 Load a simple sketch like Blinky to see if it works

I hope to get back to this project at the end of Feb. Thank you for the information. I was so excited about getting some stuff running on the ATtiny 85. I look forward to getting something to work! :-)

Go even further back... Arduino 1.0.anything is not going to work. Go back to version 20 or earlier of the old IDE. For some reason the core files do not work with the new version. Unclear whether anyone is ever going to make an updated set of core files.

I loaded up 20 and 22. These are working even worse. I can't even get the blink program to compile fore the ATTiny85. :-(

That you for the tips. I will see about getting an older version. I have tried doing 1MHz and 8MHz and was getting the same issue. I will give these a try and comment back.

Also, try it without setting the external clock. Try using the slowest possible internal clock. Sometimes the external clock causes strange errors until you get it configured correctly.


11 months ago

Any ideas on controlling a servo with it?

1 reply

the ATtiny probably wouldn't be able to supply the current necessary to run a servo, try adding a BJT or a MOSFET or some kind of electric switch to take the binary signal from the ATtiny to allow current to drive the servo.

did not working on me

Why this happen when i select ATtiny85 (w/ Arduino as ISP)

can not compile

Blink.ino:10:21: error: Arduino.h: No such file or directory

Blink.ino: In function 'void setup()':

Blink:15: error: 'OUTPUT' was not declared in this scope

Blink:15: error: 'pinMode' was not declared in this scope

Blink.ino: In function 'void loop()':

Blink:20: error: 'HIGH' was not declared in this scope

Blink:20: error: 'digitalWrite' was not declared in this scope

Blink:21: error: 'delay' was not declared in this scope

Blink:22: error: 'LOW' was not declared in this scope

yes it does, if you use the right settings

im sorry, its a long time since i did this so i dont remember the settings. Also you have to use another library.