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
<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>
<p>can i get the hardware files for atmega8 pls!</p>
<p>can i get the hardware files for atmega8 pls!</p>
<p>Here is the updated tutorial <a href="http://highlowtech.org/?p=1695" rel="nofollow">http://highlowtech.org/?p=1695</a><br>and do not use the attiny45_85.zip listed in this page but the one you can find in the link I provided to you! cheers!</p>
I've been trying to program my ATtiny13V but I keep getting &quot;'OUTPUT' was not declared in this scope&quot;. <br> <br>// Must include for servos to work <br> #include <br>// Elements is the amount of numbers you want to dedicate to the running average <br>// Increase the number for a slower reaction <br> #define elements 5 <br> <br>// Variables for loops <br> int i = 0; <br> int j = 0; <br> <br>// The Analog Pins - C:Centre R:Right L:Left U:Up <br> int pinC = 1; <br> int pinR = 2; <br> int pinL = 3; <br> int pinU = 7; <br> <br>// Variables to store the data from the photo-resisitors <br> int analogValueC; <br> int analogValueL; <br> int analogValueR; <br> int analogValueU; <br> <br>// The change in position from the last reading <br> float posX = 0; <br> float posY = 0; <br> <br>// The running average readings <br>// - Each element is made up of the difference between opposite photorestors <br> int x[elements], y[elements]; <br> <br>// Servos - X is rotation/spin, Y is the tilt servo <br> Servo servoX; <br> Servo servoY; <br> <br>// Common servo setup values <br> int minPulse = 600; // minimum servo position, us (microseconds) <br> int maxPulse = 2400; // maximum servo position, us <br> <br> void setup() { <br> <br>// Turn on the pins, program doesn't work without it *shrug* <br> pinMode(6, OUTPUT); <br> pinMode(5, OUTPUT); <br> digitalWrite(6, HIGH); <br> digitalWrite(5, HIGH); <br> delay (200); <br> <br>// Attach each Servo object to a digital pwm pin <br> servoY.attach(6, minPulse, maxPulse); <br> servoX.attach(5, minPulse, maxPulse); <br> delay(200); <br> <br>// Sanity check! <br> servoX.write(90); <br> servoY.write(90); <br> <br>// Start all the running average values to zero <br> for(i=0;i x[i] = 0; <br> y[i] = 0; <br> } <br> <br>// Serial - good for troubleshooting <br> Serial.begin(9600); <br> delay(200); <br> } <br> <br> void loop() { <br> <br> // This will help to balance the values so the sun tracker doesn't Jump around <br> // during high contrast situations <br> int normal = (analogRead(pinC)/50); <br> <br> // Read the photorestors <br> analogValueC = (analogRead(pinC)/normal); <br> analogValueL = (analogRead(pinL)/normal); <br> analogValueR = (analogRead(pinR)/normal); <br> analogValueU = (analogRead(pinU)/normal); <br> analogValueD = (analogRead(pinD)/normal); <br> <br> // Check if the Centre photorestor is the brightest, if it is then set the change to zero <br> if((analogValueC &lt;= analogValueL)||(analogValueC &lt;= analogValueR)){ <br> // Value is positive: go right, negative: go left <br> x[i] = analogValueR - analogValueL; <br> } else { <br> x[i] = 0; <br> } <br> if((analogValueC &lt;= analogValueU)||(analogValueC &lt;= analogValueD)){ <br> y[i] = analogValueU - analogValueD; <br> } else { <br> y[i] = 0; <br> } <br> <br> // The change in position is the average of all the elements <br> int totalX = 0; <br> int totalY = 0; <br> for(j=0;j totalX+=x[j]; <br> totalY+=y[j]; <br> } <br> posX = totalX/elements; <br> posY = totalY/elements; <br> <br> // Send the values through the serial when it has gone through all the elements <br> if(i==0)avgDisplay(); <br> //if(i==0)rtDisplay(); <br> <br> // Change the position of the tracker towards the light <br> simpleChangePos(); <br> <br> // Increment I through 0 to number of elements <br> i++; <br> i = i%elements; <br> delay(301); <br> } <br> <br> <br> // Class will display a cross on the serial monitor showing real time values of the resistors <br> void rtDisplay(){ <br> Serial.print(&quot; &quot;); <br> Serial.println(analogValueU); <br> Serial.println(&quot; /\\&quot;); <br> Serial.print(analogValueL); <br> Serial.print(&quot; &lt;= &quot;); <br> Serial.print(analogValueC); <br> Serial.print(&quot; =&gt; &quot;); <br> Serial.println(analogValueR); <br> Serial.println(&quot; \\/&quot;); <br> Serial.print(&quot; &quot;); <br> Serial.println(analogValueD); <br> Serial.println(); <br> Serial.println(); <br> } <br> <br> // Class will display the change in position <br> void avgDisplay(){ <br> Serial.print(&quot; &quot;); <br> if(posY&gt;0){ <br> Serial.println(posY); <br> Serial.println(servoY.read()); <br> } else { <br> Serial.println(&quot; &quot;); <br> } <br> Serial.println(&quot; /\\&quot;); <br> if(posX&gt;0){ <br> Serial.print(posX); <br> Serial.println(servoX.read()); <br> } else { <br> Serial.print(&quot; &quot;); <br> } <br> Serial.print(&quot; &lt;= &quot;); <br> if((posX==0)&amp;&amp;(posY==0)){ <br> Serial.print(&quot;C&quot;); <br> } else { <br> Serial.print(&quot; - &quot;); <br> } <br> Serial.print(&quot; =&gt; &quot;); <br> if(posX&lt;0){ <br> Serial.println(-posX); <br> Serial.println(servoX.read()); <br> } else { <br> Serial.println(&quot; &quot;); <br> } <br> Serial.println(&quot; \\/&quot;); <br> Serial.print(&quot; &quot;); <br> if(posY&lt;0){ <br> Serial.println(-posY); <br> Serial.println(servoY.read()); <br> } else { <br> Serial.println(&quot; &quot;); <br> } <br> Serial.println(); <br> Serial.println(); <br> } <br> <br> // Named so, because I am planning on making a more complicated verson <br> void simpleChangePos(){ <br> // Variables to store the current position of the servos <br> int readX = servoX.read(); <br> int readY = servoY.read(); <br> <br> // If there is a change: <br> if(posX!=0){ <br> // If the servo is going to change position past its range of motion <br> if((readX+posX)&gt;180){ <br> if(readX!=180){ <br> servoX.write(180); <br> } <br> } else if((readX+posX)&lt;0){ <br> if(readX!=0){ <br> servoX.write(0); <br> } <br> } else { <br> // If the change is a non-zero and not past the servo's limit, change the position <br> servoX.write((readX+posX)); <br> <br> } <br> delay(15); <br> } <br> <br> if(posY!=0){ <br> if((readY+posY)&gt;180){ <br> if(readY!=180){ <br> servoY.write(180); <br> } <br> } else if((readY+posY)&lt;0){ <br> if(readY!=0){ <br> servoY.write(0); <br> } <br> } else { <br> servoY.write((readY+posY)); <br> } <br> delay(15); <br> } <br> <br> } <br> <br>If anyone got any ideas how to solve it pls let me know : )
<p>i know this is old, but cant run the servo library on the tiny.</p><p>there is a library called servo8bit.h thas written for the tiny</p>
Not all of the code that runs on the Arduino will run on the ATtinys. When you start including libraries, like the servo library, the likelihood of it working diminishes. <br /> <br />Can you program one to blink an LED? If so, the problem is probably with some of the commands you are calling (presumably the servo code). You will need to figure out some alternative way of writing the code, or to modify the library to work with the chip.
<p>I got a new ATTiny85 and and i tried to get it to blink and im still getting the same error. 'OUTPUT' was not declared in this scope. </p>
<p>You need to declare OUTPUT or try to change OUTPUT with 0</p>

About This Instructable


990 favorites


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: Hard Candy Recipe 2-Ingredient Candy Teeth Candy
Add instructable to: