The ATTiny85 is a pretty neat little microcontroller with some sophisticated features, despite its small size, low cost, and limited I/O. I bought a bunch of them a while back to mess with, and recently got around to getting them to work. I have a few applications that could use these.

One thing that I don’t have, is a dedicated programmer for the AVR chips. If you’re using a naked microcontroller chip that’s not on a board, you’ll need to program it somehow! I read somewhere that it’s easy to use an Arduino to program these chips, so I never bothered buying a programmer. In theory, it is easy. In practice, it’s a bit of a pain, so I thought I’d write up my experience.

I was using a Leonardo because I don’t have a Uno, which is the board of choice when programming naked AVRs. The Arduino IDE comes with a program that you can use to program these chips, but to run on a Leonardo, it needs a small modification, which I’ll come to later.

After following various guides and failing, I found this instructable:

It’s pretty good but some parts of it are quite out date. Here are the up to date instructions!

FIRST – install ATTiny support in the Arduino IDE. This was where I first got really messed up, as there are a lot of obsolete instructions out there. It’s actually very easy, you don’t need to edit any config files, all you need to do is open the Arduino IDE and go to File->Preferences, find Additional Board Manager URLS and paste this into the box:


Close this window and go to Tools -> Boards -> Boards Manager. Scroll down to ATTinyCore, click it, and click ïnstall”. Apparently there’s a bug in verion 1.6.6 of the IDE and you need to close the board manager and re-open it before you can do this.


You can find more details about ATTinyCore here:

Connect your Leonardo to your computer via USB. Go to File->Examples and load up the sketch called ArduinoISP. This sketch needs a couple of changes. Scroll down and find this bit:


Change RESET from SS to 10. Change LED_HB from 9 to 13. What this means is that we’ll be resetting the target hardware with pin D10, and instead of having to fit an LED to pin 9, we can watch the on-board D13 LED throb to show that the board is alive.

Save the sketch under a different name for future use. Upload it to the board – the D13 LED on the board should start to pulse.

Now it’s time to wire up the ATTiny. Locate the ICSP header on the Leonardo (I stole this image from, sorry)


The pinout on the ATTiny85 is thus (image purloined from


MISO, MOSI, and SCK should be connected from the Leonardo header to the chip. You don’t connect MOSI to MISO or anything, as you might suspect: it’s a straight connection.

Connect VCC and GND. I didn’t use the power connectors on the SPI header, I took them from the 5V and GND connectors labelled on the Leonardo. This was purely superstition on my part.

Connect Reset on the ATTiny to D10 on the Leonardo.

I also connected the anode of a LED from pin 5 on the ATTiny, and connected the cathode to ground via a 220 ohm resistor. This was for testing, we’re going to upload a modified BLINK sketch to the ATTiny.

When you are all wired up, load the Blink sketch from the examples. change the pin from 13 to 0. There is no D13 on the ATTiny 🙂 the LED on pin 5 is connected to the ATTiny’s D0.

Your code should look a bit like this:


Now use Tools->Board to switch your board in the Arduino IDE to “ATTinyX5 Series”.  Then go to the same menu and set your programmer to “Arduino/Leo As ASP (ATtiny)”. You’ll need to burn the bootloader before you can program the chip – you only need to do this once. Choose Tools->Burn Bootloader. It will take a little while, and if you haven’t wired everything up right, it will poop. Hopefully it’s all good.

When that comes back, you can just upload the blink sketch like you normally would. The LED connected to the ATTiny should start flashing.

When I tried to set this up, I had a lot of problems. My main trouble was old, obsolete how-to’s, particularly information on how to install the ATTiny support into the Arduino IDE. Also I forgot to change the pin on the Blink sketch, and I thought I had bricked my ATTiny, I just couldn’t work it out. Here is what my breadboard looked like at the end:


You can just about see the ATTiny.

One of the many things that I got into a pickle about when it didn’t work (because I didn’t change Blink’s output to D0) was that I suspected that the ATTiny wouldn’t work unless I disconnected all the wires. Nope – you don’t have to. You can leave those wires where they are.

I hope this helps someone!