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 16V electrolytic capacitor
- 220ohm 1/4 watt resistor
- solid core hookup wire

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: attiny45_85.zip

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.
<p>Hello</p><p>After this procedure ,how can i add these code into microcontroller? </p><p>#include &lt;avr/io.h&gt;<br>int main(void)<br>{</p><p>DDRB = 0b00000001; //Data Direction Register setting pin0 to output and the remaining pins as input<br>PORTB = 0b00000001; //Set pin0 to 5 volts<br><strong>while(1)</strong><br><strong>{</strong><strong>//Code would be in here if it needed to execute over and over and over ... endlessly</strong></p><p><strong>}</strong><br>}</p>
<p>thank you so much. and yes high-low tech is an awesome site for this kind of stuff. basically every idea i have an uno is too large to be practical.</p><p>this is my first step to making the things i <em>want to make</em> rather than making things others have already made and was made just to learn.</p><p>(though i have a whole lot to learn and look forward to it)</p><p>thanks again will be checking out your &quot;Tiny&quot; builds next.</p>
<p>lol wanted to program more and got the dreaded errors:</p><p>stk500_getsync(): not in sync: resp=0x00.</p><p>set it up the exact same way.... 10uf and all.... triple checked everything....</p><p>very annoying how unreliable this sort of method is and i have a $3 ATTiny 85 programmer but it doesn't work... i need to make a shield...</p>
<p>figured it out again..... somehow.....</p><p>regardless, now that i have more than one uno to work with (6 actually and a mega) i am going to make a permanent shield once my 8 pin IC sockets arrive which haven't even shipped yet even though i ordered them over a month ago... (gotta be careful what and when i need something when buying from china) though just ordered some more from a US vendor and will be here in 3 days so that will be a fun project (nice break in between studying for finals) as i will go through them fast enough</p>
AtTiny85 does not have Arduino boot loader in it, then how does it understand functions like digitalWrite(), analogWrite() and all other functions that are only used in Arduino programming and not in embedded C?
<p>that is what this instructables does, it puts the bootloader in it so it can understand those functions</p>
<p>Is there a good article that explains how to best utilize pins. For example, I have an Uno with a lot of digital and analog pins. I'm not really sure how to make it all work with this smaller CPU.</p>
<p>thanks working whit version arduino ide 1.6.7 but not has tools-boards-attiny as isp. but have only attiny and i use thats, load sketch good and blink working. thanks.</p><p>proplem has first only were found bootloader and burn thats, then all ok.make new folder &quot;hardware&quot; and copy these tiny files.then working :)</p>
<p>i've this error...</p><p>avrdude: Yikes! Invalid device signature.</p><p>I don't know what i've to do....</p><p>i've tried a lot of things but without solutions....</p><p>Please help me!!!</p>
I got the same error and what solved it is as follows. Press continuously the reset button on the arduino. While doing so take out the usb cablw out of the pc for a few secs and then put it back in (while still pressing the reset button) then upload your attinny85 sketch and only then while it uploads release the reset button on the arduino. Let us know how it works. Good luck!!
<p>The shield works great!</p><p>Thank you for making this guide!</p>
<p>Thanks I got it working no problems, but how come the LED is connected to 5v and not to ground? Does it make a difference?</p>
<p>Yup, with that newer zip works like charm. Thanks for this 'ible!</p>
<p>it's easy with tutorial. IDE 1.6.9 hw <a href="https://github.com/damellis/attiny/tree/ide-1.6.x" rel="nofollow">https://github.com/damellis/attiny/tree/ide-1.6.x</a></p><p>Thanks</p>
<p>Great Tutorial... Thanks...</p>
<p>bro that looks awesome, is there an instructable for this?</p>
<p>WARNING: This tutorial is now out of date. The zip you are instructed to download is not compatible with the current release of Arduino (1.6.5). Also this tutorial does not mention burning the boot loader to the ATtiny - I found this was required before I could upload sketches. There is an updated version of the original High-Low Tech tutorial linked in this Instructable which did work for me:</p><p><a href="http://highlowtech.org/?p=1695" rel="nofollow">http://highlowtech.org/?p=1695</a></p><p>Hope this helps somebody!</p><p>Alex</p>
<p>i want to get a pulse in output of attiny45, do u know any code for it? or some link? </p>
Made it. Easy tutorial. Note: didn't need the 10uf capacitor.<br><br>
<p>got the core files to load but now the IDE isn't recognizing any of the calls... getting errors like</p><p>&quot;delay was not declared in this scope&quot;</p><p>its for evrything?!? dunno HELP</p>
<p>Can I use a 22uF capacitor? That's the closest I can find at hand.</p><p>Thanks for the great Instrucatble.</p>
<p>it think so, I am using two of 4.7uf in parallel and works, the capacitor is to avoid the reset in the upload</p>
<p>Cool</p><p>if you are using Arduino IDE 1.6.5 read this http://highlowtech.org/?p=1695, it is the same but more simples.</p>
<p>Please help!!!</p><p>How can you programm an AATTiny24.</p><p>i can't find libraries.</p><p>Thanks</p>
<p>i got a problem, the program is fine, and i uploaded blink program perfectly with errors</p><p>avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny45<br>avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny45</p><p>but led is still not blinking, </p><p>i've changed the pins from 13 to 0, still doesn't work, i'm using arduino 1.0.6 and arduino nano, thank you and sorry for my bad english</p>
<p>*I cant write to my ATtiny...can't upload... changed USB, all parameters correct. Im using windows 7 home edition... maybe bad attiny? how to find out if my tiny is working? prior sending data?</p>
<p>arduino was defective... i bought a nano instead</p>
<p>good instructable, only problem I had was the missing Arduino.h file. I posted a work around below.</p>
<p>Hey everyone!</p><p>I have tried uploading the blink program on the arduino (i have selcected ATTiny 85 w/ Arduino as ISP option)</p><p>Arduino shows me this error whiile compling!</p><p>Blink.cpp:8:21: fatal error: Arduino.h: No such file or directory</p><p>compilation terminated.</p><p>Please help!</p>
<p>I had the same problem until I found this:</p><p>Create an Arduino.h in ...\Arduino\hardware\attiny45_85\cores\attiny45_85 containing</p><pre>#include&lt;WProgram.h&gt;</pre><p>at this link:</p><p><a href="http://electronics.stackexchange.com/questions/87328/arduino-as-isp-for-attiny" rel="nofollow">http://electronics.stackexchange.com/questions/87328/arduino-as-isp-for-attiny</a></p>
How critical is the capacitor?<br>would variation in the uf our volt be more forgiving?<br>I have a 10 uf 25v cap available. safe our no?
<p>Higher voltage rating is almost always safe, if not always. In this case, you can use your 10&micro;F 25V cap, no problem.</p><p>In this case, the capacitor is needed to sink an reset signal. I think a higher capacity cap would also work, but I'd stick with 10&micro;F to be sure.</p>
<p>Much appreciated. I have some 85's on the way and one 328 in hand I can't wait to get back to. Schedule is too tight right now. Adult in school after work.</p>
<p>Thanks for the instructions. I could make it.</p>
<p>Thanks mate, this will be very useful for me. I need to learn programing, since everything I want is too pricy or not exist at all.. :)</p>
<p>For the breadboard CHEAP and perfect for this project, go to e-bay and search </p><p>5pcs-Universal-170-Tie-point</p>
<p>Thanks for this, it was INVALUABLE. I'd bought 3 different ATtiny programmers, none of which worked with win7-8... which I found somewhat disturbing/frustrating yet hilarious in the end. THIS, this simple instructable, took me 20 minutes to get a working programmed ATtiny. THANK you. </p><p>AND... for Arduino fans, here's the neatest serendipitous event regarding the ATtiny and Arduino... Check out the pic, this breadboard 'accidentally' fits PERFECTLY between the Horizontal arduino female pinouts, AND the vertical caps and end male pins! I kid you not, it fits in, and TIGHT, so you can just pop in a breadboard on an Arduino! I was so thrilled I nearly choked on my coffee when it popped in. Check out the pic!</p><p>Okay, I did have to grind off the little plastic doohicky that lets the breadboards stack... but it was worth a few seconds on the grinder.</p>
<p>I made a little board with an IC socket and just soldered the 10uf cap onto it as well for quick and easy programming, as I have a bunch of ATTiny85s.</p><p>Wires came from patch cord, so bear with me on that. </p><p>ATTiny85 works like a charm (did not catch the led on in the pic, but it is blinking on pin 0).</p><p>Thanks! Cheers.</p>
<p>As a shield for reusability</p>
<p>Using a 10uF capacitor between the reset and ground pins on the Arduino prevented the IDE from recognizing the board for me - otherwise, everything worked perfectly! </p>
<p>There has got to be an easier way to program a chip to slow down an electronic flash. I downloaded, I unzipped, I followed the directions as they were given here and on the High low tech tutorial, all i was able to accomplish was to change the rate of blink on the Arduino board. The LED wouldn't blink........arggghhhhhh. Anybody know an easy way to slow down an electronic flash?</p>
<p>Here I found a simple Attiny85 shield which makes the Job Much simpler without any jumper wires.</p><p>http://www.htlinux.com/product/attiny-isp-shield/</p>
<p>Finally! After 3 years, I got my ATtiny to blink a light. I have an 85-20. To get it working I added the Arduino.h and WProgram.h includes (not sure they helped or not) and I ran this as the board as the 1 mhz not the 20.</p><p>I also found that my HIGH and LOW for the digitalWrite are backwards. I am running the basic blink program and when I changed the delay to it would blink for a shorter time of on and a longer time of off, it was backwards. </p><p><br>digitalWrite(led, HIGH);</p><p>delay(25);</p><p>digitalWrite(led,LOW);</p><p>delay(975);</p><p>This code had the led on for 975 and off for 25. When reversed the HIGH and LOW, then it worked as I originally expected.</p><p>Another major issue I have run into is that some of the ATtiny85 chips are bad. I have two that won't work with this set up and one that does. I have 2 more that I am going to try.</p>
<p>I see you connecting the diode to +5V. Doesn't it fry the micro controller? In my head I would rather go Pin 0 -&gt; diode -&gt; 220ohm -&gt; GND</p>
<p>Thanks for taking the time to put this up. Worked for me.</p>
<p>can i get the hardware files for atmega8 pls!</p>
<p>can i get the hardware files for atmega8 pls!</p>

About This Instructable




Bio: My name is Randy and I founded the Instructables Design Studio. I'm also the author of the books 'Simple Bots,' and '62 Projects to ... More »
More by randofo:Robots ClassBringing it All AroundTelepresence Robot: Shields and Modules
Add instructable to: