Based on this quite good description I’ve made a circuit to program Attiny85. In this way, it is reposted with rather little additional value, but perhaps in a more understandable way. It will be fun!

Required parts:

  • Arduino Nano
  • Attiny85
  • 10 uF electrolytic capacitor
  • LED

ISP (In-system Programming) mode

Put the Arduino Nano in ISP mode. Fortunately, you can find an example of this in the Arduino IDE: File -> Examples -> ArduinoISP - upload without modification.

Add Attiny85 support to Arduino IDE

Under File -> Preferences -> Additional Boards Manager URLs, enter the following: https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json. (mirror)

(If you find the URL unusable in the meantime, check out David A. Mellis’ Github.)

Under Tools -> Board -> Boards manager choose “attiny” (by David A. Mellis) and install it.

If all goes well, you will see “Attiny” under Tools->Board.

Connecting Attiny85 with Arduino

Check Attiny85 pinout:

https://components101.com/microcontroller/attiny85-pinout-datasheet

(source)

Arduino Nano - Attiny85 connection:

  • 5V - VCC
  • GND - GND
  • D13 - PB2
  • D12 - PB1
  • D11 - PB0
  • D10 - PB5 (RESET)
  • RST - 10 uF C - GND*

*The original description incorrectly states that the anode (+) of the electrolytic capacitor should be connected to GND, of course the cathode should be connected to GND.

Prepare uploading Attiny85

In Arduino IDE select the following options:

  • Tools -> Board: Attiny25/45/85
  • Tools -> Processor: Attiny85
  • Tools -> Clock: Internal 8MHz
  • Tools -> Programmer: Arduino as ISP*

*Note that we usually use AVRISP mkii for Arduino…

By default Attiny85 runs at 1MHz, so you need to Tools -> Burn Bootloader.

Test it!

If everything went well so far, open the blink example (File -> Examples -> Basics -> Blink). Change the pin from 13 to 0. (Or from LED_BUILTIN to 0.) Upload.

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED\_BUILTIN as an output.
  pinMode(0, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(0, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);             // wait for a second
  digitalWrite(0, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);             // wait for a second
}

Now, this is harder to test than an usual Arduino app, because you need a separate power source to drive the Attiny. In the original descripton, a 3V button cell is used. But you can also draw the required current from the Arduino (disconnect the original wiring, of course):

  • PB0 - LED - GND
  • 3.3V - VCC
  • GND - GND

Profit!

Errors

Under Arduino IDE 2.x you may get “A programmer is required to upload” error. Use Sketch -> Upload Using Programmer when uploading to your ATtiny85. (ref)