Uploading sketches to Attiny85 in various ways?

I feel like a bit of a n00b posting this, so please direct me to another posting if required...

I wanted to play with my Attiny85 chip, and managed to get the Blink sketch running fine:

Note the minimal number of parts (processor, LED, resistor).

But to program it I fetched out my AVR Dragon, and followed the diagram for High Voltage Serial Programming (7 wires), like this:

Now that all worked fine, but I wonder if there is an easier way? I read this, not sure if this is what I want or not:


I presume there are a number of ways it could be programmed:

  • With an external programmer, as I have done
  • Using SPI (inline serial programming) if I break out the SPI lines to a header
  • Using serial if there is a bootloader on the chip (probably not, huh?)

The sketch compiled fine, I'm not sure where I got the Attiny stuff from, probably Coding Badly.

const byte LED = 4;

void setup() {                
  pinMode(LED, OUTPUT);     

void loop() {
  digitalWrite(LED, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(LED, LOW);    // set the LED off
  delay(1000);              // wait for a second

And to prove to myself that it wasn't a fluke, I programmed in the "Blink Two LEDs, independent, no delay" sketch, and that also worked (using pins 3 and 4 as the LEDs).

So my question really is, what is the recommended/simplest way of programming the thing?

Hi Nick,

Definitely an ISP programmer (I have adafruit's and it works great). Something similar to this breakout board helps make the connection to the breadboard.

I've used HV and ISP in the past (non-Arduino code though), I don't see any real difference between them from a practical point of view.

On a final PCB HV would be harder because you have to isolate the 12v from whatever is on the RST pin.

Of course HV allows you to use the RST pin for IO which is nice.


Well I used the USBtinyISP successfully from the command line. This is the wiring:

If you want to try this at home, my connections were:

Label  Colour  ISP cable   Attiny85

MISO   Orange      1           6
VCC    Red         2           8
SCK    Green       3           7
MOSI   White       4           5
RESET  Blue        5           1
GND    Black       6           4

My command to AVRdude was:

avrdude -c usbtiny -p t85 -U flash:w:Blink.cpp.hex:i

(I used the full pathname found by holding down Shift whilst doing a Verify).

However I couldn't get it to work through the IDE. I altered the preferences.txt file to change the line:




However got this:

Binary sketch size: 882 bytes (of a 8192 byte maximum)
	at processing.app.debug.AvrdudeUploader.getProgrammerCommands(AvrdudeUploader.java:106)
	at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:68)
	at processing.app.Sketch.upload(Sketch.java:1603)
	at processing.app.Sketch.exportApplet(Sketch.java:1568)
	at processing.app.Sketch.exportApplet(Sketch.java:1524)
	at processing.app.Editor$DefaultExportAppHandler.run(Editor.java:2327)
	at java.lang.Thread.run(Thread.java:680)

Any suggestions about that problem?

In ...sketchbook\hardware\tiny\boards.txt, I have the following entry. This file was installed with the Arduino Tiny core. I did add the one line to use the USBtinyISP.


attiny85at8.name=ATtiny85 @ 8 MHz  (internal oscillator; BOD disabled)

# The following do NOT work...
# attiny85at8.upload.using=avrispv2
# attiny85at8.upload.using=Pololu USB AVR Programmer

# The following DO work (pick one)...
# attiny85at8.upload.protocol=avrispv2
# attiny85at8.upload.using=arduino:arduinoisp
# attiny85at8.upload.using=pololu


# Default clock (slowly rising power; long delay to clock; 8 MHz internal)
# Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms; [CKSEL=0010 SUT=10]; default value
# Brown-out detection disabled; [BODLEVEL=111]
# Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0]




There might be something missing in your avrdude.conf file see:

Post #78


(Coding Badly has recently helped me through the process, and I found out that that thread is really helpful)


Thanks to both of you. I amended both files and it now works. FWIW, I had already noticed the boards.txt file in the "tiny" directory, but had changed it to read:


rather than:


I had made the earlier change because that was consistent with preferences.txt, which reads:


Follow up regarding the programmer...

In the past I used the Pololu AVR Programmer for two reasons: 1. It works. 2. It has a "separate" serial port which makes debugging a breeze.

Lately I've been using an Arduino Uno. I modified the Arduino ISP (aka Mega ISP) sketch...

? One status LED instead of three
? Dramatically improved upload times
? Recovery clock in case the fuses are accidentally set to use an external source.
? Tuning clock that facilitates tuning the internal oscillator.
? Serial relay that makes debugging almost as easy as with the Pololu.

My plan is to include the modified Arduino ISP sketch in the next Tiny Core update.

The point? Hmm, there must have been a point ... oh yeah ... a few things ... I highly recommend the Pololu AVR Programmer for programming ATtiny processors. The stock Arduino ISP sketch works. The next version will work much better.

Of course HV allows you to use the RST pin for IO which is nice.

The core includes a pin definition (digital pin 5) for the RESET pin.

Regarding battery power... It is possible (and rather nice) to program a battery powered target. In my case, I used a slightly modified Arduino ISP sketch (SS has to either float or sink, it cannot source), a pair of voltage dividers for MOSI and SCK, and a basic transistor circuit to get MISO from battery voltage to USB voltage.

Regarding the Uno... With westfw's latest bootloader (thank you!) it is not necessary to disable auto-reset. Upload the Arduino ISP sketch and it just works.

You know that your dragon can also program using ISP, JTAG, TPI and TDI right?

Yes, but my Dragon is on my Windows PC. For some reason, I prefer working on the Mac. And just typing in a sketch and hitting Upload is a nice easy development cycle.

you can also programm it with your Arduino IDE, but didn't tried :

Something must have changed in the way it works. When attempting that I get:

Blink2.cpp:8:22: error: WProgram.h: No such file or directory
Blink2:7: error: 'byte' does not name a type
Blink2.cpp: In function 'void setup()':
Blink2:12: error: 'LED' was not declared in this scope
Blink2:12: error: 'OUTPUT' was not declared in this scope
Blink2:12: error: 'pinMode' was not declared in this scope
Blink2.cpp: In function 'void loop()':
Blink2:16: error: 'LED' was not declared in this scope
Blink2:16: error: 'HIGH' was not declared in this scope
Blink2:16: error: 'digitalWrite' was not declared in this scope
Blink2:17: error: 'delay' was not declared in this scope
Blink2:18: error: 'LOW' was not declared in this scope

However WProgram.h is in the attiny45_85 folder (I also tried putting it into a "cores" subfolder).

Hmm ... a bit more experimentation seems to show the instructions are a bit out of date.

Using the following directory structure worked (all the files/folders are under "hardware" folder):

This is not exactly how it appears in the .zip file.

Further to that, my earlier test "worked" in the sense that it compiled. Trying to upload raised more issues. According to the page in question:

Pin connections:

  • ATtiny Pin 2 to Arduino Pin 13 (or SCK of another programmer)
  • ATtiny Pin 1 to Arduino Pin 12 (or MISO of another programmer)
  • ATtiny Pin 0 to Arduino Pin 11 (or MOSI of another programmer)

Now I'm not familiar with chips that have a "pin 0". All those pin numbers are out by five. When I'm told to connect something to "pin 1" of a chip I usually take that to mean the "real" pin 1, with the orientation dot on it.

It's also confusing because the diagram labels pin 5 as pin 0:

It also doesn't mention connecting pin 10 on the Arduino to pin 1 of the Attiny (reset pin).

Nick, you should be able to use the Dragon in ISP mode with the IDE on the Mac. I use it on linux.
(I even just now downloaded the Arduino tiny package and tried it on my tiny85)
You have to update your arduino programmers.txt file to create an entry for the dragon ISP
then you have to update your boards.txt to create an entry for the "board" that uses the dragon programmer.

Now there is an issue with avrdude with respect to the dragon that will affect trying to use the IDE
to program a bootloader or if you try to use the Makefiles to burn a bootloader.
It is an issue on linux and Windows and probably with MacOS well.
I have posted patches for a fix for avrdude, but so far the avrdude maintainer considers it to be an OS bug
and does not seem interested.
(My patch is a 6 line workaround for the issue).

I have also posted an Arduino IDE issue with a suggested patch to the JAVA code for a work around
there as well. This patch avoids the avrdude issue, instead of requiring an avrdude fix.
It actually removes code from the IDE JAVA code.
(So far no interest).
I have also posted a fix to the Makefiles to also avoid the issue, but so far westfw isn't
interested in using it for his optiboot.

So if you want to use the dragon to burn a bootloader like optiboot, PM me and I'll fill you in on the details.

But without the work around fixes, the IDE and avrdude work just fine for uploading sketches.

--- bill


You're wasting your time with that core. All the features in it are available in the Tiny Core and it has a few bugs that have been fixed in the Tiny Core.

Trying to upload raised more issues

Do you need help uploading?

@Coding Badly

Do you need help uploading?

No thanks. It worked. I was just pointing out the web page I was directed to was somewhat misleading.


Thanks for the suggestions. Right now I seem to have an embarrassment or riches. So far I have programmed the tiny little thing with the Dragon, via the usbtinyisp, and the rather clever Arduino as ISP concept.

@Coding Badly

All the features in it are available in the Tiny Core and it has a few bugs that have been fixed in the Tiny Core.

I have to admit I get a bit confused about all the various ways you can program the thing. It's a bit like the "blink without delay" concept. There are dozens of ways you can achieve the end result.

For the record I am very grateful for the help I have obtained here. Thanks to your suggestions, I have all these ways of programming it.

i've used USBAVR Programmer for programming ATTiny85 in Arduino and gcc projects, works great and how-to on Windows is documented in thread you linked above. Can't go wrong for $19.95.

I've ordered one, so when it arrives I'll give that a go.

It's a shame that Pololu doesn't re-order the pinout for the serial pins so that you could
solder on a 6 pin header and have a FTDI pin compatible device as well.

--- bill