ATTiny programmer

The DIY ATtiny programmer described here shows you how to program a lot of chips in the ATtiny range. The example shown here uses the ATtiny85 as an example chip with the Arduino Uno as the ATtiny programmer (so it is an ATtiny85 programmer).

In fact the setup is very easy - all you do is connect the SPI signals from the programmer to the SPI signals on the target chip.

Note: You can use many other Arduino boards as the programmer.

Note that while this setup is fairly easy it has extra steps compared to using the Digispark ATtiny USB interface. If you are not worried about the program size - yet! (the main reason for using this process) - then using the Digispark board is a good idea.

An Interesting Question

How many external components do you need to operate an Arduino Sketch in an ATtiny85? If you think about an Uno or Nano (or any other Arduino board) you could come up with about 10 components but what is the minimum?

Q: What are the minimum number of components required to run an Arduino Sketch in an ATtiny85?

(click to find out)

Amazingly the answer is 3 (if you include the power supply) - You only need the ATtiny85, a decoupling capacitor and a power source e.g.LiPoly battery. All the other components on Arduino boards are convenience components e.g a USB interface, external crystal clock, power supply conditioning etc.

You should have at least one power supply decoupling capacitor to eliminate switching noise. If you program the ATtiny85 using an AVRISP as described here then you don't need the USB interface chip (required on all Arduino boards).

Obviously you will need more external components to create the useful circuit but by using an ATtiny85 you can create the smallest possible system.

Arduino IDE

In normal use the Arduino IDE communicates with an Arduino board, pre-programmed with a bootloader. This is a small program that communicates over the serial link, allowing you to easily upload programs using the Arduino IDE. This is the reason that you don't need an ISP chip programmer for Arduino projects.

ISP programmer

There are several reasons using an ISP programmer; you might need to:

  • Save some space by not using a bootloader.
  • Re-program the bootloader (or program the bootloader into a new chip).
  • Use the chip with a slower (internal) clock.

One problem is that the bootloader uses up some of the Flash memory in the chip; memory which you can't use for your own program. You may just need that extra 2k of space and decide not to use a bootloader!

Why use an ISP ATtiny programmer?

Using an ISP programmer allows you to upload a standard program directly to the target chip without requiring the target chip to be pre-programmmed i.e. you don't need a bootloader to execute Arduino sketches.

The disadvantage is that you have to connect up the SPI signals (MOSI MISO etc.) to the target chip. This usually means removing the chip from the project board and putting it into the programmer board (unless the SPI pins are routed to a connector, which is more likely for higher pin devices).

Dedicated ISP or Arduino ISP?

You can buy a dedicated AVR ISP programmer that plugs into a USB port providing the required ISP signals.

Alternatively you can use the Arduino IDE along with a standard Arduino board; using the Arduino board itself as your ISP programmer - this turns your Arduino into an AVRISP.

If you are on a budget then the Arduino programmer is the one you want.

ATtiny Programmer library

Install Spence Konde library

You need to add an entry for the boards manager. Select:

Menu > File > Preferences

...and paste the following:

...into the text field labelled 'Additional Boards Manager URLs'.

If you have problems make sure you have Arduino IDE 1.8.9 or later.

Now open the boards manager and select ATtinyCore by Spence Konde:

Menu > Tools > Board > Boards Manager

Chip list for Spence Konde library

Here's a list of the chips that can be programmed using the Spence Konde library:

  1. ATtiny24/44/84(a) (No bootloader)
  2. ATtiny44/84(a) (Optiboot)
  3. ATtiny84(a) (Micronucleus / California STEAM)
  4. ATtiny24/45/84 (No bootloader)
  5. ATtiny45/85 (Optiboot)
  6. ATtiny85 (Micronucleus / DigiSpark)
  7. ATtiny44/88 (No bootloader)
  8. ATtiny44/88 (Optiboot)
  9. ATtiny88 (Micronucleus, MH-ET t88 w/16MHz CLOCK)
  10. ATtiny87/167 (No bootloader)
  11. ATtiny167/87 (Optiboot)
  12. ATtiny167 (Micronucleus / DigiSpark Pro)
  13. ATtiny261/461/861(a)
  14. ATtiny461/861(a) (Optiboot)
  15. ATtiny441/841 (No bootloader)
  16. ATtiny441/841 (Optiboot)
  17. ATtiny841 (Micronucleus / Wattuino)
  18. ATtiny43 (No bootloader)
  19. ATtiny828 (No bootloader)
  20. ATtiny828 (Optiboot)
  21. ATtiny1634 (No bootloader)
  22. ATtiny1634 (Optiboot)
  23. ATtiny2313(a)/4313 (No bootloader)

You can see that you do have the option of using a specific bootloader but check how much memory it takes up; its a trade off between convenience and the amount of memory used.

Chip features

Here's a few points of interest on some of these chips:

ATtiny85 - (8k F, 512 S, 6 I/O), DIL, QFP, gain (1x,20x),2 Diff ADC pairs.

ATtiny84 - (8k F, 512 S, 12 I/O), DIL, QFP, gain (1x,20x), 12 Diff ADC pairs.

ATtiny88 - (8k F, 512 S, 28 I/O), DIL, QFP.

ATtiny167 - (16k F, 512 S, 16 I/O), QFP, LIN controller.

ATtiny861 - (8k F, 512 S, 16 I/O), QFP, min 2.7V.

ATtiny841 - (8k F, 512 S, 12 I/O), 2 USART, gain (1x,20x,100x) QFP.

ATtiny828 - (8k F, 512 S, 28 I/O), 32.768 kHz ultra-low power oscillator, QFP.

Attiny1634 (16k F, 1k S, 18 I/O), 2 USART, 12Bit ADC, QFP.

ATtiny Programmer Arduino as AVRISP

Here you program the Arduino Uno with a Sketch that allows it to be an ATtiny programmer (an ISP - In System Programmer).

Select the Arduino ISP from the example programs in the IDE:

    Menu > File > Examples > 11.ArduinoISP > ArduinoISP

arduino as ISP selecting ISP sketch

ATtiny programmer: From the Tools Menu set-up three options:

  • Board: "Arduino/Genuino Uno". This is the programmer board in use.
  • Port : COMnn. (Arduino/Genuino Uno); The port for your Arduino Uno.
  • Programmer : "Arduino as ISP".

They should match the screen shot below - except for the port number which will be different for your system.

arduin IDE uno attiny programmer setup information

Program the sketch into the Arduino Uno.

    Menu > Sketch > Upload

ATtiny85 pinout

 ATtiny85 pinout

Note: Pins are on PORTB (it only has PORTB and no PORTA!) so you can use code such as:

    PORTB= 0xff;

... to set all pins on PORTB high.

As with all Arduino boards pins are related to logical port pins and not physical chip pin numbers so check the diagram for the correct 'pin' when coding for Arduino.

AVRISP Connection diagram

This diagram shows you how to wire up the Arduino uno as an ATtiny programmer. Simply connect MISO, MOSI, SCK, 5V and GND to the chip. Additionally connect pin 10 to the reset pin on the chip.

Arduino Uno pin
ATtiny85 [chip] pin
13 - SCK
7 - SCK - White
12 - MISO
6 - MISO - Purple
11 - MOSI
5 - MOSI - Blue
10 - RESET
1 - RESET - Yellow
GND - Green
VCC - Red

For testing (optionally) add 1k resistor to pin 3, and LED anode to the resistor. The flat side is the cathode which connects to GND.

Arduino as ATtiny85 programmer

Optional ATtiny Programmer Status LEDs

You can also add LEDs (and resistors) to the following Arduino Uno pins to show programmer status:

Arduino pin
Heartbeat - programmer is operational.
Error - something went wrong.
Programming - communicating with target.

IDE Set-up for the ATtiny85

Now choose the no-bootloader option for ATtiny85 as follows:

Menu > Tools > Board > ATtinyCore > ATtiny25/45/85 (No bootloader):

Note: Leave the other settings at default values i.e. 8MHz (Internal) clock etc.

Select attiny85 no bootloader

So this shows the setup for an ATtiny85 programmer.

Programming the ATtiny85

Do this FIRST - Clock Setting and BOD

Perform a 'Burn Bootloader' before programming your Sketch but after programming the Arduino Uno as an AVRISP.

Menu > Tools > 'Burn Bootloader'

TIP: DO THIS FIRST: Menu > Tools > 'Burn Bootloader'

Since you have setup the board as an ATtiny85, burning the bootloader (can) burn a bootloader into the ATtiny85 (Not the Arduino Uno). For the setup here, where no bootloader is selected, it is not bunt in - however the other settings must be updated.
Clicking burn bootloader, in this case, will program the clock setting fuses or BOD

If you want to:

  • Change the internal clock used,
  • Change the BOD (Brown Out Detector) setting,
  • Set clocks for the first time,
  • Set BOD for the first time.

...then you must hit 'Burn Bootloader':

Menu > Tools > 'Burn Bootloader'

The action of programming the bootloader sets the ATtiny85 fuses that allow a clock change. This is the reason that the text is written into the Clock source menu item:

Menu > Tools > Clock Source (Only Set on bootload) "8Mhz (internal)"

Warning: Click Burn Bootloader when changing clocks or BOD.

When you re-program the ATtiny85 with your Sketch (without a bootloader selected), the fuses are left as they were - i.e. correct for the selected clock rate.

Note: Burning the Bootloader erases the original Sketch!
If you had a program in the Attiny85, after burning the bootloader you need to reload it; burning the bootloader erases memory.

LED Flash program for ATtiny85

The standard blink example uses LED_BUILTIN which is pin 6 on the ATtiny85 and it is connected to MOSI above. If you removed the chip and then attached an LED to pin 6 via 1k to ground it would work on another solder-less breadboard. However to test it in the circuit above you need to use pin 4 (here set by definition TEST_LED) and not LED_BUILTIN.

The text LED_BUILTIN was changed to TEST_LED to use allow you to use any LED pin:

#define TEST_LED 4

// The setup function runs once on reset or powering the board.
void setup() {
  // initialize digital pin TEST_LED as an output.
  pinMode(TEST_LED, OUTPUT);

// the loop function runs over and over again forever
void loop() {
  digitalWrite(TEST_LED, HIGH);   // turn the LED on.
  // PORTB= 0xff;
  digitalWrite(TEST_LED, LOW);    // turn the LED off.
  // PORTB= 0x00;


Note: The pin refers to PB4 not the physical pin (PB4 is on chip pin 3).

Programming the ATtiny85 Sketch

To program the ATtiny85 with the standard Arduino code, using the ATtiny85 programmer, just hit the programming symbol (right arrow as usual) or use the menu; it is exactly the same as normal Arduino IDE programming!:

Menu > Sketch > Upload

The reason this works is that the IDE bypasses the normal serial interface and uses the Arduino Uno as an ISP programmer (because of the setup you did previously).

Note: If your LED is flashing slowly click here.

Program Space used

This is the output from the Arduino IDE status screen (programming the ATyiny85 using the Arduino Uno as ISP programmer):

Sketch uses 462 bytes (5%) of program storage space. Maximum is 8192 bytes. Global variables use 9 bytes (1%) of dynamic memory, leaving 503 bytes for local variables. Maximum is 512 bytes.

You can see that only 462 bytes are used and there is a maximum of the full Flash memory available for your use.

There is no bootloader yet the same blink program (essentially) has been loaded into the ATtiny85 (it has a little bit more in setup function - see link below).

Here is a line from the Digispark (Bootloader with ATtiny85 - flashing an LED):

Sketch uses 700 bytes (11%) of program storage space. Maximum is 6012 bytes. Global variables use 9 bytes of dynamic memory.    

Here the maximum space is reduced by 2180 Bytes (more than 1/4 of the total available) - this loss is due entirely to the bootloader code.

These are the same chip but the Digispark system uses a software bit-banged USB interface (bootloader) that is very clever (and convenient) but does require a lot of Flash memory.


For the ATtiny85 you can save more than 1/4 of the total available Flash memory space. For some programs this will be essential as having only 6k is small enough as it is, but having a boost of 2k could allow the project to work.

An ATtiny programmer also allows you to change the clock frequency which can be important in low power operation.

New! Comments

Have your say about what you just read! Leave me a comment in the box below.

Privacy Policy | Contact | About Me

Site Map | Terms of Use