3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Program an ATtiny with Arduino

Program an ATtiny with Arduino
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.
 
Remove these adsRemove these ads by Signing Up
 

Step 1Go get stuff

Go get stuff
You will need:

- Arduino
- Breadboard
- ATtiny85 (or ATtiny45)
- 10uF 16V electrolytic capacitor
- 220ohm 1/4 watt resistor
- LED
- solid core hookup wire
« Previous StepDownload PDFView All StepsNext Step »
73 comments
1-40 of 73next »
Mar 13, 2012. 3:37 PMmidknight5000 says:
Is it possible to control a 16x2 lcd with an attiny85 (since lcd's only need six pins right)?
Mar 14, 2012. 6:51 PMmidknight5000 says:
ok no problem thx for at least telling me you don't know instead of telling a lie
Apr 12, 2012. 5:52 PMcompsfreak17 says:
there is an instructable for controlling an lcd screen with 3 pins instead of the normal 6, i just dont know if the libaray will owrk with it. Its worth a try though.
http://www.instructables.com/id/Hookup-a-16-pin-HD44780-LCD-to-an-Arduino-in-6-sec/
Jan 26, 2012. 8:45 PMslayer04 says:
Please Help

I've tried everything to get this to work. I've tried both arduino 1.0 and 022 along with a capacitor and not, nothing ever works and I always get this when I click
to burn the bootloader:

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


Then I get this every time I go to upload sketch:

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: stk500_cmd(): protocol error
Apr 7, 2012. 7:26 AMjaky_shaky says:
if using arduino 1.0 as shown in pic, you must change the heart rate delay to twent milliseconds instaed of forty this solved my problem.
hope this helps,
Jacob
Jan 27, 2012. 6:30 AMslayer04 says:
I've got an arduino uno and if it helps any, but this is the chip I'm trying to program:

http://search.digikey.com/scripts/dksearch/dksus.dll?KeywordSearch&site=US&keywords=ATTINY85V-10PU-ND
Jan 30, 2012. 11:39 AMslayer04 says:
Hmm I did it without the capacitor with the exact same results and I did change the 13 -> 0

I wonder if my chip is just bad but that seems unlikely.
Mar 16, 2012. 3:41 PMslayer04 says:
Nice instructible, but would you happen to know why my blink sketch runs about 5x faster when I upload it to the ATiny? I don't have any errors except for the ones you say to ignore, the sketch is set to delay 1000 like normal but it cycles about every .2 secs and not every 1 sec.

I have tried it with and without the capacitor and both ended with the result above.

Thanks for any help
Mar 17, 2012. 2:26 PMnik.mess says:
By default, the ATtiny’s run at 1 MHz (the setting used by the unmodified “ATtiny45″, etc. board menu items). You need to do an extra step to configure the microcontroller to run at 8 MHz – necessary for use of the SoftwareSerial library. Once you have the microcontroller connected, select the appropriate item from the Boards menu (e.g. “ATtiny45 (8 MHz)”). Then, run the “Burn Bootloader” command from the Tools menu. This configures the fuse bits of the microcontroller so it runs at 8 MHz. Note that the fuse bits keep their value until you explicitly change them, so you’ll only need to do this step once for each microcontroller. (Note this doesn’t actually burn a bootloader onto the board; you’ll still need to upload new programs using an external programmer.)

(http://hlt.media.mit.edu/?p=1695)

I tried to follow their instructions, but it didn't seem to work for me.
Jan 29, 2012. 2:43 AMopal_1970 says:
Hi, any idea why I am getting the error " 'Serial' was not declared in this scope " when ever I attempt to upload the ArduinoISP to the board? I am using a new Arduino Uno r3 with an ATTiny85.
Thanks.
Feb 27, 2012. 3:07 PMFoxtrot70 says:
Hello, I am getting same error as opal_1970 " Serial' was not declared in this scope " with this exception. I am using Arduino-22 and WinXP, USBtinyISP and got the ArduinoISP to upload to the 328 chip but, can not get any program to upload to the ATTiny85. Any thoughts?
Jan 30, 2012. 1:53 AMopal_1970 says:
Ahhhhhh.... that was it, I had already set it to ATTiny85 (w/ Arduino as ISP)
Thanks for the tip and thanks for a great instructable.
Feb 17, 2012. 12:42 AMGyurEEE says:
Will it work with the 20pin attiny?
Feb 18, 2012. 2:12 AMGyurEEE says:
thanks
Feb 16, 2012. 1:21 PMderder says:
is it possible to run a attiny 85 or 84 with an external quartz clock? if yes how?
Feb 7, 2012. 10:37 PMjgrina says:
There are two excellent writeups on using the ArduinoISP as a programmer for ATtiny chips. The earlier one uses Tiny45-85.zip as the cores file and the later one uses Tiny.zip. The first one only works with Arduino 0022 and the second with Arduino 1.0 Getting the wrong zips with the wrong versions makes a mess with lots of different errors. I know, I made a mess of both Arduino IDEs and unloaded everything to fix it.
Jan 30, 2012. 2:36 AMopal_1970 says:
Hi, I am getting the "... not in scope" error also, I followed Nibb's comment below and commented the correct line in the Wiring.h file (...\Hardware\attiny45_85\cores\attiny45_85), but I am still getting the error. I am using Windows XP, could that be the reason why it is not working?
Thanks for any advice.
Jan 30, 2012. 11:11 AMopal_1970 says:
The latest, Arduino 1.0
Jan 21, 2012. 9:17 PMHiggs Boson says:
I put everything in the folder that the preference menu said my sketchbook was, but it doesn't come up in the sketchbook. Do the have to be pde files? I tried restarting the ide but it isn't working. what could be the problem?
Jan 10, 2012. 1:00 PMtekstop says:
http://tekstop.wordpress.com/2011/12/30/programming-attiny13-using-arduino-isp-and-all-the-hacking-involved/

I have a tutorial on programming the ATtiny13 with the arduino (Arduino IDE 1.0). The tutorial is based on MIT high-low tech lab instructions with modifications for the Attiny13. 
Jan 19, 2012. 12:31 AMEirinn says:
Fantastic! I'll try this out as it can possibly reduce the power needed for my project (along with size). Please collect 1 free interwebs at aisle 5.
Jan 11, 2012. 3:05 AMrobot1398 says:
it gives a error "output was not in the scope"
Dec 21, 2011. 8:35 PMrobot1398 says:
if i want add a different program and not a blink sketch
Jan 7, 2012. 1:03 PMGreat Wight Ninja says:
The reason he uses the sample blink sketch is because it is such a simple program to use for debugging your hardware setup. If you can light an LED, you can build to anything is a common philosophy with programming a micro-controller configuration for the first time. If that works, you move on to a slightly more elaborate sketch until it is doing what you want it to do. It helps save some frustration when your buggy, advanced code is not working and your real issue is hardware related. Hope that helps.
Dec 6, 2011. 9:41 AMnerdbot2085 says:
when i to upload the Blink sketch I receive this error.

Blink.cpp:8:21: error: Arduino.h: No such file or directory
Blink.cpp: In function 'void setup()':
Blink:10: error: 'OUTPUT' was not declared in this scope
Blink:10: error: 'pinMode' was not declared in this scope
Blink.cpp: In function 'void loop()':
Blink:14: error: 'HIGH' was not declared in this scope
Blink:14: error: 'digitalWrite' was not declared in this scope
Blink:15: error: 'delay' was not declared in this scope
Blink:16: error: 'LOW' was not declared in this scope

I am using a mac with arduino 1.0 and a duemilanove board as the programmer. I am trying to program an ATtiny45. I triple checked the instructions. Do I need to modify an other files after dropping the contents of the zip file into the /hardware folder? do the attiny 45 board files need to be in the same hardware folder as the arduino hardware files?
Dec 6, 2011. 6:14 PMnerdbot2085 says:
So I found a suggestion on the arduino.cc forum to back down from arduino 1.0 to 22. Then i got passed that error. Now I am seeing this. It seems like I am close but still missing something. Any ideas?

Binary sketch size: 658 bytes (of a 4096 byte maximum)
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny45
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
Dec 18, 2011. 8:36 AMdiy_bloke says:
You can just ignore that message. Look here:
http://tronixstuff.wordpress.com/2011/11/23/using-an-attiny-as-an-arduino/#comment-9695
Dec 5, 2011. 10:24 AMdunnos says:
I am experimenting with this as we speak. I'm trying to copy a remote control with this, but it's rather time-specific. Does anyone know at what frequency these chips work now?

Dec 5, 2011. 11:59 AMdunnos says:
that's not enough by a long shot... to get a 38khz signal I need the 55 cycles for digitalWrite() to take less than 13 ms. It takes 55 now -.-
Nov 17, 2011. 12:38 PMchriscross93 says:
I get this error when compiling, any thoughts?


**************************************
In file included from /usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h:44:0,
from /usr/lib/gcc/avr/4.5.3/../../../avr/include/avr/delay.h:37,
from /home/zach/Desktop/Dropbox/Treeduino/Hardware/ArduinoCode/hardware/attiny45_85/cores/attiny45_85/wiring_private.h:32,
from /home/zach/Desktop/Dropbox/Treeduino/Hardware/ArduinoCode/hardware/attiny45_85/cores/attiny45_85/WInterrupts.c:36:
/usr/lib/gcc/avr/4.5.3/../../../avr/include/math.h:426:15: error: expected identifier or ‘(’ before ‘double’
/usr/lib/gcc/avr/4.5.3/../../../avr/include/math.h:426:15: error: expected ‘)’ before ‘>=’ token
Nov 30, 2011. 12:41 PMblinkyblinky says:
It should be in Desktop and then in desktop should be the hardware folder.
Nov 30, 2011. 12:41 PMchriscross93 says:
blinky,

See nibb's comment. All is well now.
1-40 of 73next »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
2353
Followers
200
Author:randofo(Randy Sarafan loves you!)
I am the Technology Editor here at Instructables. I am also the author of the books 'Simple Bots,' and '62 Projects to Make with a Dead Computer'. Subscribing to me = fun and excitement!