Ever since I started making projects with the Arduino, I’ve had a desire to shrink them down to a single, small circuit board. One of my first projects, a customizable SLR intervalometer, was packed in a phonebook-sized cardboard box and used the Arduino Deumilanove connected to a breadboard with jumper wires. I brought the box out to Central Park at 5am to make a timelapse of the sunrise, but when I got to the park, I spent 20 minutes fixing the connections between the Arduino, the breadboard, and the components. Since then, I’ve explored a few different ways of shrinking projects down and making them more robust. For the intervalometer, I designed a circuit board that had female header pins to seat an Arduino Nano. It was a huge improvement on the design, but I knew I could do a lot better.
I tried to teach myself AVR programming, but ran into a lot of snags along the way. By the time I got an LED to blink, I had invested hours in the project (a stark contrast to my first Arduino experience) and was feeling quite discouraged. I also tried using PICAXE chips. While it was much easier to get started with these chips than with AVR programming, I felt like I was abandoning all my years of C programming to learn a form of BASIC that’s an entirely different animal from when I used it as a kid.

When I came across this tutorial by MIT Media Lab’s High-Low Tech Group, I was elated. They walk you through the process of using the Arduino IDE and programming language to program 8 pin ATtiny45 or ATtiny85 chips. Not only that, but they also walk you through using an Arduino board to act as the programmer, or ISP. I had everything I needed, except for the chips, so I eagerly awaited my rush shipment of ATtinies.
I followed the tutorial and found that it was actually rather easy to program these little chips using the Arduino code and IDE. I tried out the basic digital and analog I/O functions and they all worked as expected. I did a little experimentation with a few other functions with some success, so your milage may vary. To test it all out, I even made a cute little blinky toy within about an hour. I’m now thinking about revisiting my intervalometer project and shrinking it down from a cardboard box to a mini Altoids tin!
Subscribe to the MAKE Podcast in iTunes, download the m4v video directly, or watch it on YouTube and Vimeo.
More:

RSS for MAKE
Genius! I have several ideas that would be great to move to a smaller chip. Thanks!
Hey matt- wow. almost the same thing happening here. I am working on an intervalometer for my FZ100 (http://www.instructables.com/id/Wireless-Shutter-Remote/) and am having a REALLY hard time fitting it into the project box. I have some gift money at tayda electronics- I will see if they carry these chips
For an already-assembled PCB carrying an ATtiny85, the above technique also works with BlinkM Smart LEDs (carried by MakerShed).
For more details on that, check out my BlinkMuino post.
Now that’s a way of going pro on arduino prototyping. Instead of a huge box full of wires, you go one step ahead and make the arduino part smaller, and doing it on a perf board, you can stick in smaller boxes. Gotta love that!
I’m not sure what I’m doing wrong, but i’m having a hard time with pwm. (analogwrite) The same sketch works fine on other arduinos but only blinks on the attiny85. (led is between pins 2 and 4)
int LedPin = 3;void setup(){ pinMode(LedPin, OUTPUT);}void loop(){ for (int x=0; x0; x–){ analogWrite(LedPin, x); delay(5); }}
I figured out my issue. I was using an ATTINY85 from a previous project. The fuse bits had been altered and that’s the reason for the difference.
I’m glad yo figured it out and thanks for letting us know. I was scratching my head over that one.
Note that IO # 4 (IC Pin 3) can also be a PWM output. If you have any RGB blending projects, this can be pretty useful. I’m not sure how to let the wiki editors at MIT Media Lab’s High-Low Tech Group know this, but I’d guess it could be handy for others too.
If it helps anyone, I paste this into my ATtiny Arduino projects as a quick reference for pinouts:
*/
// ATMEL ATTINY85 / ARDUINO
//
// +-/-+
// Ain0 (D5) PB5* 1| |8 Vcc
// Ain3 (D3) PB3 2| |7 PB2 (D2) Ain1 sck INT0
// pwm2 Ain2 (D4) PB4 3| |6 PB1 (D1) pwm1 miso PCINT1
// GND 4| |5 PB0 (D0) pwm0 mosi PCINT0
// +—-+
//
//* Pin 1 is Reset and tied high on my boards
//available digital pins are D0-D4
Great Video! I want to try to do the blinky toy in the video, is there any tutorial for codes or parts?
Thank You.
I HAVE to try this. Know of anywhere I can pick up an ATtiny?
I have a “Roboduino Duemilenove” and I couldn’t get this to happen. My uploads resulted an error: stk_getsync(): not in sync:resp=0×15. I got some great help from ‘Coding Badly’, who’s one of the Admins at the Arduino Forum. The solution was to pull-up (to +5) the Arduino’s Reset via a 120Ω (!) resistor.
Also — http://arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection
Check Ebay, they have a good selection of 85′s but not as many 45′s or 25′s.
Another question, does this work with the the low power versions, the 85V, 45V, and 25V?
Sorry to triple post but I may have found the problem, to qoute Atmels Datasheet:
“– ATtiny25V/45V/85V: 0 – 4 MHz @ 1.8 – 5.5V, 0 – 10 MHz @ 2.7 – 5.5V
– ATtiny25/45/85: 0 – 10 MHz @ 2.7 – 5.5V, 0 – 20 MHz @ 4.5 – 5.5V”
Okay, the 85′s default speed is 1Mhz but what about the 85V, being that it has a lower max speed, and the error message I am getting in the Arduino IDE about a protocol error, I think I can deduce that the 85V can not be programmed with this method.
Oh, to add some info I am using an UNO r2 and an Atmel 85V with a protoshield wired up to be the same as the breadboard circuit. For those buying ATtinys on Ebay make sure that your not accidentally getting the low power versions that have a V at the end of the model number.
I’ve been working on this project or a few days now; I keep on getting these errors:
avrdude: stk500_paged_write(): (a) protocol error, expect=0×14, resp=0×64
avrdude: stk500_cmd(): protocol error
The ATtiny45 chip I’m working with says it’s 20 MHz (1 MHz and 8 MHz didn’t seem to be available; I got them from Digikey). The MIT lab and everyone else seems to link to ATtiny support files that bring in “boards” into the Arduino IDE for 1 MHz or 8 MHz, but no 20 MHz. I assume that’s my problem. Does anyone have any advice??
I bought the same chips ATTINY45-20PU-ND from Digi-key, so far no luck here as well. Let me know if you figure it out!
mine havent arived yet but it would be nice to kno that they work first
I was able to make this work by installing the capacitor between the Uno’s Reset and Gnd pins as well as changing the baud rate in the ArduinoISP sketch to 9600. Hope that helps.
I’m have trouble moving the necessary folders into the Arduino software. I’m using Windows XP. Can some one walk me through this?
Pessoal,
Acesse o site da EMPRETECNET, eles fabricam um KIT com uma placa compatível com arduino duemilanove, uma placa de rele, de potenciômetro, de sensor de luz, de sensor de luminosidade, de buzzer, de botão e demais componentes que podem ser realizados vários experimentos sem a necessidade de solda. Qualidade excelente!!
it give me this error
“e_dice.cpp:2:21: fatal error: Arduino.h: No such file or directory
compilation terminated.”
i am using ubuntu , please help…
hi, i need to know if i can do something like this with a ATmega8
Hi,
I have followed the tutorial exactly, and i get this error, when I try to upload the code to my ATTiny85:
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
What is the reason for this ?
I have uploaded the Arduino ISP
I have created the “hardware” folder in my documents/arduino folder, witch is my sketchfolder. And added the needed files from the attiny85.zip.
Please help :/
OCMaster85, Denmark
There are two versions of these hardware files, one for Arduino IDE version 022 and 1.0. Make sure you’re using the right one. Arduino.h is new in Arduino 1.0, so I would suggest upgrading your IDE.
Hi Matt,
I have the Arduino 1.0 IDE installed.. But i changed to the attiny 1.0 files that your suggested.. Now i can thoose between 1, 8 and 20mhz attiny85 in the IDE.
I read that i should thoose attiny 8mhz internal clock, and then “burn bootloader”, before burning anything to the chip.
I’m a bit closer that last time, but i still get an error after the PAGEL and BS2 errors, witch are suppose to appear:
Binary sketch size: 774 bytes (of a 8192 byte maximum)
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
avrdude: stk500_paged_write(): (a) protocol error, expect=0×14, resp=0×64
avrdude: stk500_cmd(): protocol error
I hope you can clearify my problem here, as i think i’m very close to get it working
OCMaster85, Denmark
After hours of trying, I get the same error message as OCMaster85.
I have Arduino 1.0 IDE and used the correct boards.txt but I get the following error when trying 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
avrdude: stk500_paged_write(): (a) protocol error, expect=0×14, resp=0×64
avrdude: stk500_cmd(): protocol error.
any guesses, clues or ideas would help.
I ran into the same problems as OCMaster85, AFTER upgrading to Arduino 1.0. Before, I had used arduino0018, which seemed to work: I could get the modified blink sketch working on attiny85.
I found the following thread in the arduino forums:
http://arduino.cc/forum/index.php?topic=87951.0
“Where did you get the ArduinoISP sketch that you uploaded to the Uno? The one supplied with Arduino 1.0 doesn’t work under Arduino 1.0. There are a couple of threads in this section of the forum about that, with remedies.”
I tried to lower the baud rate to 9600 baud, but that didn’t help. I also tried to use other versions of arduinoISP, but to no avail.
Sadly, right now I have tried to upload with 0018, 0022 and 0023 and get protocol errors or things like “HIGH was not declared in this scope”. Right now I’m really out of my depth. If this were a video game, I would now watch the walkthrough…
MAKE to the rescue!!!
UPDATE: I got it working after all – at least partially:
You have to lower the baud rate from 19200 to 9600 baud in TWO places:
1. in the arduinoISP sketch
2. in the “programmers.txt” file
Under windows, you find this file i.e. at C:\Program Files\arduino1.0\hardware\arduino\programmers.txt
Search for “Arduino as ISP” in that file, and change the baud rate.
After this change, I can now use “burn a bootloader” and then send a blink sketch to attiny85.
Having trouble programming the attiny85.
When I upload blink I get this
avrdude: stk500_getsync(): not in sync: resp=0xe0
One issue is that when I go to pick the attiny 85 ISP I don’t have a listing for that. In that space it says attiny85 (internal 1mhz crystal)
Great Video, very useful.
Currently i’m working on a project using arduino. I’m using 4 analog inputs, 1 digital input and one digital output (pwm). All based on basic code.
Is it possilbe to achieve this with attiny85?
i’m not sure if attiny pin 1 can also be used as an analog in and if attiny pin 5-6 can be used as a digital in/out?
thanks
I have learned thru pain that the attiny85 seems to have some problem with floating point math. I used a float-based HSL2RGB algorithm which just would not work on attiny. With atmega the same code worked fine. So I changed the algo to an integer based logic and voila, attiny worked as well. So: if you are using attiny, try to avoid float.
thank you for the advice, does this only concern the procedures concerning input/output or also with internal calculations?
for instance can i take an int as an input, convert it to a float, do the calculations and convert the result into an int again for output (to minimize the loss of resolution within the calculation itself)?
my other question is can the attiny85 process 4 analog inputs, 1 digital input and 1 digital output?
I commented in line by line of the float algo and at some point i got a compile error. Very strange, i guess it is an old gcc bug that i read about. So: Some simple float calculations will work, but at some point it just will be too much.
Concerning your other question: Check the attiny85 datasheet at http://www.atmel.com/Images/2586s.pdf , page 2f: pin configurations show that you have 8 pins: 5V, GND, Reset and 5 data pins. according to the data sheet you can disable reset and use PB5 as a data pin instead. However, I am not sure whether this is supported by the arduino IDE.
BTW, there is now an updated arduinoISP sketch which works under arduino IDE 1.0. See http://www.adafruit.com/blog/2012/03/27/updated-arduinoisp/ for details.
Ruben, I would be happy to hear about your future progress, either here or at moolder AT gmx DOT net. or on twitter as moolder.
Ruben, I just saw that you are planning to use “basic code” – that would be something different than the arduino IDE, which uses the arduino language. The arduino language is based on C/C++.
Thank you again for your help and I will keep you updated. And I will give it a shot the get the fourth Analog input as well using the arduino IDE. I’ll keep you posted on the level of success.
ps. By basic code i meant simple. I’m am familiar with arduino, c/c++ and actually not at all with BASIC.
I tried maybe everything, but was not able to run this using arduino ide 1.0.
Then I downloaded arduino 0023 and after 5 minutes LED started blinking
Peter: Check Out the updated arduinoISP For 1.0 via http://www.adafruit.com/blog/2012/03/27/updated-arduinoisp/
Thank you ! This was the problem
works after 1st try with arduino 1.0 and this new ISP sketch
Hello, does this new arduinoISP works for you also with other chips? I tried attiny13, added it in boards.txt, but when uploading blink sketch I get error similar to the one I got using old arduinoISP: “programmer not in sync”
Peter, the Way I understood Matt’s Video this seems to work only with attiny85 and attiny45.
Greetings, moolder
you are right, but there is also another tutorial which says that it works (http://elabz.com/arduino-shrunk-how-to-use-attiny13-with-arduino-ide/) and I thought that everybody automatically tries other chips..
ok, it works, I found out that arduinoISP sketch released with arduino IDE 1.0 is needed for programming attiny13
Follow MAKE
From the Maker Shed
Launch Price: $75.99
RedPark TTL iOS Cable Breakout Pack
Exclusively in the Maker Shed, this updated Redpark Breakout Pack for Arduino and iOS makes interfacing your iPhone, iPad, or iPod touch with the real world easy! This bundle includes the new RedPark TTL Cable for iOS so a TTL adapter (and soldering) is no longer required.
Read More →