I am a big fan of the Arduino platform. For those who aren’t familiar with the Arduino, it is a microprocessor development environment & ecosystem. You can visit their site for more info. I started playing with the Arduino and soon discovered the ATtiny microprocessor chip, which is a much smaller cousin to the ATmega series which is used in the Arduino. Unfortunately, the Arduino IDE did not support it. Since most micro development apps run only on Windows (I use Ubuntu Linux), and require either expensive compilers or hard to use C or Assembler, I was never up to the effort required in using the ATtiny chips.
All of this changed yesterday when I was going through my Arduino notes and came across some attempts by others to use the Arduino IDE to program the ATtiny. One fellow was successful on the ATtiny45. Another tried on the ATtiny85 but didn’t seem to get as far. After much searching, I stumbled across the Arduino-Tiny project. The project is fairly mature, and they have already done all the hard work. The result is fantastic. You can program in C++ using the regular Arduino libraries (which have been modified for the ATtiny). Of course, many features are not available, but that is expected. When you have your sketch written, you can upload it to the ATTiny using either an in-system programmer (like USBTinyISP) or even better, you can use an Arduino itself.
Close only counts in horseshoes and hand grenades
I was all set now. I had an Arduino. I had an ATtiny85 chip. Following this tutorial, I wired everything up, and uploaded the sketch to make the Arduino an ISP (in-system programmer). I then opened the example sketch “blink” and changed the pin from 13 to 0. When I tried to upload the sketch to the ATtiny, I got this error:
avrdude: stk500_recv(): programmer is not responding
I was close, but no cigar. After considerable searching again, I at last found the solution to the problem. It appears you must tie the reset pin of the Arduino to high (+5v) via a small resistor (120 ohms is recommended, but it also worked with 500 ohms in my case). At last, sweet success – a blinking LED. My thanks to the folks on this Arduino thread for that insight.
Programming Your Own ATtiny – in 9 easy steps
For those wanting an easy way to program ATtiny chips, here is what you need to do:
- Make sure you are using the latest Arduino IDE – currently version 022. Close it if you have it open.
- 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
- nc
- nc
- ground
- digital 11
- digital 12
- digital 13
- +5V
- 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.
Troubleshooting
Verify each step and the results. Hook up the LEDs to your Arduino to make sure it is working as an ISP. Make sure you have selected the right board for each chip you are programming.Conclusion
You are now (hopefully) able to program an ATtiny with the same ease as you can an Arduino. The ATtiny chip is cheaper and smaller than the ATmega, and is perfect for light duty applications. The default fuse settings for ATtiny85 appear to be 1MHz for the clock. If you want a faster clock, you will need to change those. That will be my next project.
If you have trouble or questions, post me a comment below. I’ll do what I can to help. Enjoy those ATtinys.

Program an ATtiny Using an Arduino by Provide Your Own is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
48 Comments
You might have a typo in step 6. I think it is “ArduinoISP”, not “ArduinoIDE”.
You are absolutely correct. I have made the correction. Thanks for the tip.
You might have a typo in step 6. I think it is “ArduinoISP”, not “ArudinoISP”.
(-, just kidding, great tutorial!
It would be quite helpfull if pics could be programmed too from the Arduino
@Rick
Maybe this is not exactly what you dream about but it is close to:
http://hackinglab.org/pinguino/index_pinguino.html
@Rick
Chipkit would be better option. ChipKITs can be programmed using the original Arduino™ IDE modified to support PIC32.
These comments on programming PICs in an Arduino-like fashion are great. In looking at the two solutions mentioned, the Pinguino is promising. I like it being open source. The downside is it uses a different IDE and currently does not support C++; only C. The support of C++ is the Arduino’s biggest advantage to me. The Chipkit also looks great – it uses the ArduinoIDE. The downside is it is a proprietary board for only one PIC chip.
What would be great to see is the combination of these two. The ideal would use the ArduinoIDE as does the Chipkit, but support entire families of PIC chips, such as the PIC18F series with built-in USB support. It looks doable – the Chipkit people have done it for one of the chips. Comments? Ideas?
Thank you for your article. I was trying to program another chip using arduino UNO for 4-5 weeks. I’ve read lots of articles but somehow I couldn’t upload. At last, I managed to program attiny2313 at 1mhz with your code. And there is no resistance between 5v and reset pin! Thank u.
hello all’
I am new ao this audriuno.
recently I got the Audriuno board. Now I have a new Atmega168 .
How can I program it in Audriuno?
Is there any special needed when programming a IC first time?
Reply pls I am a kid help me
Thank you for writing this article.
The pin diagram is incomplete. AREF (pin 0) should be indicated. Pin 4 also supports PWM. It would be helpful to mark SCK, MISO, and MOSI.
I’ve been working on some better pinouts for the ATtinys. If I get them done, I’ll try to post them.
In the library code I have from the ATtiny project for Arduino, digital pin 4 does not support PWM, even though the underlying hardware does. Is my code out of date?
I think I love your blog ^^
can I use smd attiny’s too?
Of course!
> The default fuse settings for ATtiny85 appear to be 1MHz for the clock. If you want a faster clock, you will need to change those.
You can change the fuse settings by selecting the appropriate board then executing Tools / Burn Bootloader.
Thanks for the tip. I’ll have to give it a try soon.
Hey — another big thanks for putting this together… it works!
Worth noting: I got the “please define PAGEL and BS2 signals” error, but it appears from a bit of googling that it’s more of a warning. The code works fine, no one seems to be stopped, and it’s expected that the next release of the IDE will have a newer release of the AVR-GCC compiler, which will have the right values for this setting.
Thanks again!
I had to change two things to let my ATtiny85 work
1 The reset resistor MUST be ~ 120ohm, not larger.
2 Boards.txt for
attiny85at8.name=ATtiny85 @ 8 MHz (internal oscillator; BOD disabled)
attiny85at8.build.f_cpu=1000000L
#attiny85at8.build.f_cpu=8000000L 8 x times too slow!
Thanks for the clarification.
1) 120 ohms is recommended. The 500 ohms that worked for me is not universal.
2) The ATTiny85 chip comes pre-programmed at 1MHz, not 8MHz. Instead of making the change you did, you should use attiny85at1 instead of attiny85at8. I referenced the 8MHz section by mistake in the article. I have corrected it to reflect the 1MHz default.
You should probably make the changes to CHIP.upload.using=arduino:arduinoisp to every ATTiny chip & clock you intend to use, where CHIP is attiny85at8, attiny85at1, etc. Then, make sure you choose the right chip/clock for your application in the Tools/Board menu of the Arduino IDE.
Thanks again for the article.Really thank you! Awesome.
Here is a ready to use, all-in-one shield, that does exactly (and more) what is described here: http://flytron.com/open-source-hardwares/162-tinyshield-all-in-one-avr-programmer-shield-for-arduino.html
It’s a colaboration between the shop in the link and me.
Oh man, this was gonna be my first board design project, but I guess I didn’t search hard enough to see someone else did it. Nice job!
Hi.
I know the following arduino commands are supported by the ATtiny
pinMode()
digitalWrite()
digitalRead()
analogRead()
analogWrite()
shiftOut()
pulseIn()
millis()
micros()
delay()
delayMicroseconds()
but will the following control structures work on it aswell?
if
if…else
for
switch case
while
do… while
break
continue
return
goto
if you can reply asap, that would be great!
Yes – you use the same compiler and the instruction set is the same. Not only can you write standard C, but C++ classes as well – just like the Arduino.
You do need to watch memory more carefully though. Since there is no bootloader, you do have the entire memory space (an extra 2k). I am finding I can do a fair amount of stuff in 8K, but it is pretty limited to simpler programs. I would not even consider using a chip with less memory than that.
thank you for your reply… im not to worried about memory… my projects are complex, but small!
Hey Scott,
thanks for this awesome info and tutorial.
I am a newbie to Arduino my question is … if I write up code in Arduino code (NOT C++ or C) will that work on the ATiny or will I have to write the code only in C++ for it to work ?? Because I am not good with c/c++ it would be very comfy if I could just use the default arduino code… And also like the previous person asked how do I find out which arduino command will work and which ones won’t ??
thanks
Anurag,
Thanks for the feedback.
The default Arduino code is C++. The Arduino part is their library to make it easy to use. The same commands/functions work for both Arduino and ATtiny for the most part. The main difference is which pins are available. I am working on another article to give more details. Check back in a bit.
as Scott has not come back yet, let me add. Yes it is completely possible. You can set up and test your program in the IDE/Arduino and then use your Arduino to burn that code on an attiny85.
Just make sure you are only using those commands that the Attiny knows.
you will need a ‘core’ though for yr attiny
Have a look here:
http://elabz.com/arduino-shrunk-how-to-use-attiny13-with-arduino-ide/#comment-17350
I allready used this succesfully for Attiny45 but can I use this methode for Attiny2313 as well ?
The fact is that I need more inputs, my sketch is small enough for the 2313.
Absolutely. You may need to check your SKETCHES/hardware/tiny/core/tiny/pins_arduino.c file for the proper pinouts.
You ought to be a part of a contest for one of
the best websites on the web. I most certainly will recommend this blog!
How about the attiny 2313 , how do i have to connect it to the arduino and where to see how the pins are positioned (where is digital pin 1,2,3 and so on?)
Thanks!
Sorry just found the pins_arduino file, but which pins are analog inputs – only PB0 and PB1 ?
Great job! I’m using ATtiny 45 for this tutorial. Thanks.
Hi Scott,
I am new to this so I was wondering if I can use the ATtiny 13 with your code?
What about a .c file with a makefile? Do I have to compile and install that from a CMD window or can I do it from within the Arduino IDE? The makefile has avrdude fuse settings:
avrdude -p $(AVRDUDE_TARGET) -c $(PROGRAMMER) -P $(PORT) -v -e -b 115200 \
-U lfuse:w:0xE4:m -U hfuse:w:0xDF:m \
-U efuse:w:0xff:m \
-U flash:w:$(PRG).hex
well, I thought I had it working but now when try to upload a sketch I see one quick blink on the red led (error) then the green led flashes several times. The IDE reports that uploading is complete and displays no error messages but the attiny led does not blink. I wonder if I damaged the attiny at some point?
Hard to say – lot’s of things can go wrong. Try again, turning on verbose output during upload. It sounds like it is uploading. Check your sketch and LED pin to make sure they are indeed the same. Also, try using a different pin.
Howdy! This post could not be written any better!
Reading this post reminds me of my old room mate! He always kept talking about this.
I will forward this article to him. Fairly certain he will
have a good read. Many thanks for sharing!
hey I want to know,if the micro-nucleus.hex file which is the bootloader needed for attiny 85 to be programmed by usb ,can I burn it using arduino as ISP ??
Yes. The Arduino when configured as an ISP and the ArduinoIDE selected to use it as such will burn any code desired to the ATTiny through the standard ICSP connector. Sounds like a fun project.
Hi, this is just what i am looking for as i build models and want to incorporate Arduinio in getting all the lighting correct. I was going to use an Arduino board in the model! Which ATTiny85 can you sue, there seem to be so many different types. Is it any of the ATTiny 85 range? I see 20su and 20 PU etc when i do a search for ATTiny 85. Any help greatly appreciated.
Hey… Thanks for the great tutorial.
Looks like highlowtech.org moved the tutorial on you… It’s now here: http://highlowtech.org/?p=1706
I am a teacher trying to help students make simple inexpensive projects using the ATtiny 85 so they can take their projects home. We are able to use the Arduino to program the ATtiny to blink but cannot seem to get a servo to work. The libraries out there do not work, and we don’t know c++ just simple code modifications with arduino.cc
You can program ATtiny13/15/25/45/85 with these shield also. I found one here its very cheap and easy no jumpers and breadboard needed.
http://tiny.cc/bg86ox
Great tutorial. Can this technique be used with Attiny 10?
Thanks
Peter
http://www.htlinux.com/product/attiny-isp-shield Here is the ATTiny ISP Shield makes the job very much easier.
I burnt the bootloader to the AtTiny85 at 8MHz succesfully using Arduino Uno as ISP, however, when i load the Blink sketch to upload it to the 85, with the board selected- ATTiny85 (internal8MHz Clock)
and Arduino as isp THE SKETCH DOES NOT VERIFY, and fails to upload to the 85.
Thanks in advance. Not convinced? Tried it doesn’t
work.
11 Trackbacks
[…] an ATtiny Using an Arduino – [Link] Tags: Arduino, ATMEL, ATtiny Filed in Arduino | 1 views No Comments […]
Program an ATtiny Using an Arduino…
Program an ATtiny Using an Arduino – I am a big fan of the Arduino platform. For those who aren’t familiar with the Arduino, it is a microprocessor development environment & ecosyst… ArduinoをAVRライタにするらしい。 ATtiny用のArduinoがあるのか、それも興味深い…
[…] http://provideyourown.com/2011/arduino-program-attiny/ […]
[…] I program ATtiny85 with JeonLab mini 1.3. The idea has been adapted from High-Low Tech Group and provideyourown.com. One missing note from High-Low Tech Group is that you need to add a 110-120 ohm resistor between […]
[…] is a big fan of the Arduino platform, and he’s not afraid to admit it. It does all the things he needs, but now and again he would like to use something a bit smaller, […]
[…] get my chip programmed. Starting with High-Low Tech’s post, and working through Scott Daniel’s tutorial, then finally to an Instructables article by Randofo. These where some of the errors I was […]
[…] записи имеются ссылки на описание процесса (на сайте provideyourown.com) и на пакет необходимых программ (на […]
[…] http://provideyourown.com/2011/arduino-program-attiny/ […]
[…] program ATtiny85 with JeonLab mini 1.3. The idea has been adapted from High-Low Tech Group and provideyourown.com. One missing note from High-Low Tech Group is that you need to add a 110-120 ohm resistor between […]
[…] in the standard Arduino IDE. By following the instructions described in my previous article – Program an ATtiny Using an Arduino – your Arduino sketch can be uploaded as easily to an ATtiny board as it can be to an Arduino […]
[…] get my chip programmed. Starting with High-Low Tech’s post, and working through Scott Daniel’s tutorial, then finally to an Instructables article by Randofo. These where some of the errors I was […]