Introduction: The Idiot's Guide to Programming AVR's on the Cheap (with the Arduino IDE!)

Picture of The Idiot's Guide to Programming AVR's on the Cheap (with the Arduino IDE!)

     Microcontrollers are, without a doubt, amazing little things. They are versatile, powerful, and extremely tiny. Unfortunately, the latter trait is also shared by both my wallet and my programming skills. My understanding of C is poor, and I can hardly afford to buy something like an Arduino or a decent ISP. And in any case, the Arduino would be overkill for many of my projects, which only need simple IC's.

     But as many of you know, DIY always finds a way. This tutorial is meant for those among us with no budgets or programming experience who want to start using these little machines. It is not based around the ATmega328 (the Arduino Uno chip), but rather the Attiny line of chips (the Atiny85 and Attiny2313, to be specific). The total cost of this project can go as lower than $15 if you know where to buy from, and you can still use the original Arduino IDE and language to program your projects in the end. Keep in mind that you will need some soldering skills to get this project done.

Step 1: So What Programmer Do I Get?

Picture of So What Programmer Do I Get?

My, my, I thought you'd never ask. There's a large number to choose from, so I'll give you a rundown of the most popular ones.

• The USBasp is quite possibly the cheapest programmer out there, but you should be careful when buying them; some versions use outdated firmware or are missing jumpers. Make sure that your model has three jumpers (or three pairs of holes with J1, J2, and J3 printed next to them). You can find them on eBay starting at only $3. Be wary of the shipping times that the Chinese ones come with.

• A parallel port programmer is around the same price and can even be made at home. It, obviously, will only work on computers with a parallel port. 

• The USBTinyISP is a step up from the USBasp. It costs $22 from Ladyada, but knockoffs can be had from eBay for around $12. Keep in mind that it cannot program certain high end Atmega devices due to memory limitations.

• The AVRISP mk.II is Atmel's official programmer for the AVR line of chips. It is without a doubt the most powerful of these programmers and can be used with AVR Studio (complete with debugger!), but costs around $35 to get.

Your programmer might come with either a 10 pin connector or a 6 pin connector. The only difference between the two is that the 10 pin connector has 4 redundant/unused pins.

Due to my aforementioned lack of money, my programmer was a USBasp. Once again, make sure you get one with all three jumpers; mine looks nice and comes with a fancy case, but is missing 2 of them. Thankfully, it still works.

Step 2: Is That All?

Picture of Is That All?

Unless you plan on programming air, you might want to get a microcontroller and some parts for a programming cradle. 
Most AVR microcontrollers will work with the programmers I listed on the previous step, but only some can be used with the Arduino language. 
• The Attiny85 and Attiny45 are tiny 8 pin chips with 6 functional inputs and outputs with a max of 8kb of memory.
• The Attiny84 and Attiny44 are 14 pin clones of the chips above.
• The Attiny2313 is a 20 pin chip with 2kb of memory.
• The Atmega328 is the chip used on the actual Arduino. You'll have to edit a few things if you want to use it without its crystal.
Take your pick; any of these will work well.

In addition to a chip, you'll want a few parts to make a cradle; otherwise, you'll have to breadboard out all of the connections whenever you want to program anything. For that, you'll need:
• A chip socket (pick one that'll accommodate the chip you plan on using).
• Male pin headers, 2 sets of 5 (if your programmer has a 6 pin cable, go for 2 sets of 3.
• Female pin headers (same number of pins at your socket) OR more male pin headers if you want it to plug into a breadboard.
• Strip board.
• Wire.
• Basic soldering equipment.

If you want to get these fast, try Digikey. If you want to get these parts cheap with 2 week shipping, go with Tayda Electronics.

Step 3: Small Scale MIG Welding, Anyone?

Picture of Small Scale MIG Welding, Anyone?

To start out, lets assemble a simple (ghetto) cradle for our chips. Most of these chips have pinouts that differ quite a bit, so only the Attiny85 and Attiny2313 can be programmed on the same socket. The design I used for mine takes advantage of this.

First, arrange your parts on the stripboard as shown and solder them down. Try not to make your joints as ugly as mine.
Our goal is to match up all six essential pins on our programmer with the corresponding pins on our microcontroller; these pins would be MISO , MOSI , SCK , RESET/RST, GND , and VCC/VTG. The two rows of male headers will be where our programmer plugs in. I've included diagrams for most of the chips you can use. I've also included a diagram that shows which pin is which on your header. Go slow, and make sure that you don't mix up any pins. 

Once you are done, test out your pins with a continuity tester and make sure that they all go to the right places. You may want to seal up your circuit to prevent damage. In my case, I just drenched it in hot glue. Thankfully, FCC regulations do not apply to my circuit.

Step 4: Setting Up Your Not-so-micro Computer.

Picture of Setting Up Your Not-so-micro Computer.

Now that our chip is ready to be programmed, we need to set up the programmer. If you have a USBasp and run windows, download the driver from and install it. If you have a USBtinyISP and run windows, get your driver from Check in "Device Manager" to see if your programmer shows up when you plug it in; if so, you are ready!

Download the latest version of the Arduino IDE from and install it. To get this to work with chips other than the ATmega328, we'll need to add a few plugins. Go to and download the latest zip of Arduino-tiny. Go to "C:/(Your install directory)/Arduino/hardware" and create a new folder called "tiny". Unzip the contents of arduino-tiny into this folder, and rename the file called "Prospective Boards.txt" to "boards.txt".

Then, open up the Arduino IDE. First, go to Tools->Programmer and select your programmer from the drop down list. Then, go to Tools->Boards and select the chip that you want to program. There might be multiple versions of the same chip; make sure that you select the "1 MHz" version, as factory chips are tuned to run at that frequency out of the box. 

If you are using a USBasp, you should short out Jumper3. This slows down the programming speed enough for you to program chips that work at 1 MHz.

Finally, give your new chip a whirl! Find "Fade" in the File->Examples->01-Basics menu and change the line
int led = 9;           // the pin that the LED is attached to
int led = 1;           // the pin that the LED is attached to
since your chip may not have a pin 9. Then, hit upload.

You might get a few warnings, bu if everything works should have successfully programmed your first chip!
Hook up the GND pin of your chip to the negative terminal of a 5v supply and VCC to the positive. Then connect an LED (with a resistor) between the negative terminal and pin 1 of your chip. If it slowly fades in and out, you win!

Step 5: Get Programming!

Picture of Get Programming!

Check out the Arduino website for more examples and tutorials; it's an easy language to learn. Keep in mind that some commands and libraries might not work or take a bit more effort to get working.
Here are a few last tips to remember for the ride:
• If you want to make your device run at 8MHz, select the "8MHz" version of your chip and hit "Burn Bootloader". Keep in mind that most speeds higher than that will need an external oscillator.
• If you want a bigger programming challenge, learn to code with AVR Studio. You'll have to manually use AVRdude to actually burn the code onto the chip, but you will have MUCH more control over how your program works.
• If you plan on programming a fresh Atmega328 (Arduino Uno chip) with this setup, you (ironically) can't directly use the Arduino IDE to do so. I've yet to try this, but you should be able to fix this with the following. You'll have to edit the boards.txt in  "Arduino/hardware/arduino" and change a few lines in the "Arduino Uno" section. Replace the lines


and change

That'd be it! With a day's work and nothing but cheap parts from China, you've just built a (hopefully) functioning programmer.
If you see any mistakes in my ible or have any questions, leave a comment. Good luck.


Ploopy (author)2015-07-04

Is think my USBasp is out of date! :O

I tried using Arduino IDE and avrdude but I get the same error again and again:

avrdude -p t85 -c usbasp

avrdude: warning: cannot set sck period. please check for usbasp firmware update.

avrdude: error: programm enable: target doesn't answer. 1

avrdude: initialization failed, rc=-1

Double check connections and try again, or use -F to override

this check.

Then when I do override using -F this happens:

avrdude -p t85 -c usbasp -F

avrdude: warning: cannot set sck period. please check for usbasp firmware update.

avrdude: error: programm enable: target doesn't answer. 1

avrdude: initialization failed, rc=-1

avrdude: AVR device initialized and ready to accept instructions

avrdude: Device signature = 0x000000 (retrying)

avrdude: Device signature = 0x000000 (retrying)

avrdude: Device signature = 0x000000

avrdude: Yikes! Invalid device signature.

avrdude: Expected signature for ATtiny85 is 1E 93 0B

avrdude done. Thank you.

I am trying to program ATtiny85 on a breadboard.

DraakUSA (author)Ploopy2017-11-13

This writeup might help someone...

noobtronics (author)Ploopy2016-05-29

I know it's a while since you posted but I've had exactly the same issues today - others may have the same. Here is a write up of my experience:

mistrije (author)noobtronics2017-04-15

"avrdude: warning: cannot set sck period. please check for usbasp firmware update."
- this is only about firmware for your usbasp, it's not important at all, you can live well with this! :)
"avrdude: error: programm enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override this check."
- this IS your real problem: avrdude don't detect an mcu, -1 error is an hardware error code, meaning any of:
- no mcu at all
- mcu is working with another clock, or you disabled reset pin mai function, so, usbasp cannot detect the mcu. to solve this thing, you need an HV rescuer... search here, dmjlambert put a nice instructable on this subject.
- mcu is connected to the wrong pins
- usbasp connection cable is broken
- mcu dont get his 5 (or 3.3) V to work
- you fried the mcu! :)

pfred2 (author)noobtronics2017-01-09

Not Found

The requested document was not found on this server.

Web Server at
pascor2 (author)noobtronics2016-06-15

Your write-up has been deleted. )-: I was looking forward to reading it.

Would you re-post it on a more friendly web site and give everyone the new URL ?

nem8 (author)noobtronics2016-06-06

Nice writeup!

noobtronics (author)nem82016-06-06

Thanks - planning on doing at lot more on there in the coming weeks - got soooo much stuff to look at!

DavidP178 (author)2015-11-04

While you say that you have no skill programming in C/C++, you should be aware that when using the Arduino IDE, you are in fact using C/C++. There is *no* "Arduino Language." It *is* C/C++. The only difference is that there is some behind the scenes linking and setup that is done for you. In the IDE you never see the "main()" routine that exists in all C/C++ programs.

pascor2 (author)DavidP1782016-06-15

That's not quite true ! The Arduino IDE's C++ macros are, in fact, a unique language in itself. They conveniently remove the intricacy of specifying the ports and DDRs that are necessary. All the programmer needs to know is the Arduino-given pin number in order to read from or write to it.

jathomaz (author)pascor22016-08-07

well, I am sure that arduino "language" has its own set of macros, but they are still written in c(C++). There is no arduino programming language.

DavidP178 (author)pascor22016-06-21

What you say is correct, but this is the case for almost every implementation of C/C++. There are always platform dependent macros that allow certain kinds of "shortcuts" to make certain functions easier. The core language is C/C++ with the ability to make structs, classes, pointers, reference variables, and every other kind of OOP constructs.

ArcAiN6 (author)2016-07-07

do any of these programmers you've mentioned allow for high voltage programming (i.e. unbricking attiny85's)

schematicsman (author)2016-03-07

Hi I have USBasp with atmega avr 16&or 32 dev board from eBay and want to get my programmer recognised in Avrdude.exe command prompt program and burn chips with it ? please help newbie....the photos depict what I have.

schematicsman (author)2016-03-07

Hi I have a usbasp connector with avr atmega atmel 16& or 32 programmer unit and need help in winavr command prompt finding and using my programmer that I bought of eBay in that program?

marapet made it! (author)2016-01-25

I already had a USBasp programmer lying around, so your instructable was the perfect excuse to get started toying around with those awesome attiny85 chips. Inspired by your non-FCC compliant use of hot glue, I applied it generously to cover up my terrible soldering skills. I also printed a diagram with the pin numbers and attached it to the bottom.

Works flawlessly, and as GandaU below, I do get the same avrdude warnings which can simply be ignored.


GandaU (author)2015-10-16

Despite some warnings from arduino 1.6.4 s/w it work

Build options changed, rebuilding all Sketch uses 784 bytes (19%) of program storage space. Maximum is 4,096 bytes.

Global variables use 9 bytes of dynamic memory.

avrdude: warning: cannot set sck period. please check for usbasp firmware update.

avrdude: warning: cannot set sck period. please check for usbasp firmware update

GandaU made it! (author)2015-10-16

blink works from arduino. usbasp + attiny45 + arduino + blink (change pin 13 to 3 like in hi-low tech)

LostinAsia (author)2015-05-12

Good morning. I am having problems and troubleshooting.
1. Orientation of the programmer Pins.
Mine has 10 pins. Viewing the pins from female side cable red strip on the top. Would VTG be on the Left or Right column of ;pins?
2. I have seen some instructions that say to modify the board.text in the hardware folder to comment out the particular chip you are programming. In my case the ATTINY85, Not sure if this is necessary or required.
Thank you in advance.

Ploopy (author)2015-04-07


LostinAsia (author)Ploopy2015-05-12

Yes. Good instructable.

victor.valadez.547 (author)2015-04-20

There is also another good tutorial titled:

Arduino Uno R3 as a true ISP programmer for any Attiny and Atmega AVR


arjen.gerstel.1 (author)2015-04-08

Excellent tutorial, worked great for me (on OS X 10.7). I used a (cheap chinese) ZIF-socket for ease of use.

One small point, though: if you change the led pin in the Fade sketch to 1 as stated above, the led on physical pin 6 will blink (instead of pin 5 on the photo). Change the led value to 0 to make the setup in the photo work.

snaggledip (author)2015-01-21

Great tutorial! Sorry in advance for the newb question. I can't select a com portーit's just grayed out in the Arduino IDE under tools. Is the USBasp supposed to create one?

marlarius (author)2014-10-03

Thanks, it was very helpfull.

SuperTech-IT (author)2014-03-14

Those "redundant / unused" pins on the 10 pin connector are Ground.

Their purpose is to prevent crosstalk between lines, as all the signals are separated by a ground line in the flat ribbon cable that goes between the programmer and the device. This allows you to have much longer cables without the worry of data corruption die to crosstalk in the lines.

Shagglepuff (author)SuperTech-IT2014-07-05

Interesting, I didn't know that.

Lestronix (author)2014-06-22

Thank you so much! This tutorial helped me out a lot. The only problem I had was figuring out that the pin numbers in the code aren't the same as the pins on the attiny. I figured it out though. Thanks again for the awesome tutorial.

Shagglepuff (author)Lestronix2014-06-24

Glad to have helped!

manyids2 (author)2014-05-14

Great tutorial \m/

Steve25 (author)2013-11-20

Can you program an atmega8 with this set up ore do you need to change some lines aswell like the atmega328?

kshowell (author)2013-08-06

Nice, I will try this one.

WWC (author)2013-07-28

I get those errors with my USBASP as well. I am confident mine isn't out of date, it is possible how the program is written to work with Arduino that makes it throw that error.
Mine also has no problem with programming even with the errors.

Shagglepuff (author)WWC2013-07-31

Did you set the slow speed jumper on your USBASP (or does it exist?)? Keep in mind that the arduino-tiny only effects how the code is compiled; the uploading of the program is still handled unchanged by AVRDUDE.

WWC (author)Shagglepuff2013-07-31

Nope no jumper and thanks for the correction.

simpleavr (author)2013-07-29

Great guide. Regarding usbtinyisp programmer, are you sure usbtinyisp is the original "creator"? I thought this exists 1st and deserves a mention. AAMOF the ladyada page acknowledge that "code and design" are based off Dick's works.
The msp430 is more fun to play w/.

Shagglepuff (author)simpleavr2013-07-31

This entire instructable was actually made after my failthful MSP430 died for some reason.

mikroskeem (author)2013-07-29

lol gonna program intel i7 xD

About This Instructable




Bio: I am a highschooler who has an unhealthy obsession with the unusual and the esotoric. DIY seems to fit in perfectly with this.
More by Shagglepuff:Build a Low-cost Portable Wii LaptopThe Idiot's Guide to Programming AVR's on the Cheap (with the Arduino IDE!)
Add instructable to: