Source: https://mokxi.com/learn/attiny85-pinout
Updated: 2026-10-26

Learn

# ATtiny85 pinout: eight pins, PB0 to PB5, and how to program it

Intermediate

Written by the Mokxi team, updated October 26, 2026

Start building free Open the editor

Or see every lesson.

- 455 parts on the bench
- 43 boards running now
- 1.00x real time, on every board

Click to open it in the editor

A pot on PB2 (ADC1) sets the duty of timer 0’s PWM on PB0, out of a bare chip on the breadboard.

The ATtiny85 is a whole microcontroller in an eight-pin DIP: 8 KB of flash, 512 bytes of RAM, six I/O pins called PB0 to PB5, a four-channel ADC and two timers. This page lists all eight pins with the Arduino number, the analog channel and the PWM output on each, then power, the RESET pin that is also PB5, I2C and SPI through the USI, the six pins an ISP programmer uses, and which pin to pick for what.

The circuit above is an ATtiny85 in Mokxi, pushed into the breadboard across the channel like a 555: a knob on PB2, which is ADC1, dims an LED on PB0 with timer 0’s PWM. There is no board around the chip, so its supply is two wires and RESET is tied high. The table is read from the same chip model the simulator runs, and where Mokxi does less than the chip, the row says so.

## All eight pins

Pin 1 is the corner beside the notch or the dot, and the numbers run down that side to pin 4 and back up the other side to pin 8, so pin 8, VCC, sits opposite pin 1. In a sketch a pin is its port bit: digitalWrite(3, HIGH) drives PB3, which is package pin 2. That is the one thing to keep straight, because the package number and the Arduino number are never the same.

Five of the six I/O pins are free in an ordinary sketch. PB5 is RESET, and making it a GPIO takes a fuse that also ends programming over ISP. Mokxi keeps it as the reset pin.

ATtiny85 (DIP-8): pin 1 to pin 4 down one side, then pin 5 to pin 8 up the other
Pin | DIP pin | What it can do | Watch out for

RESET | 1 | Reset: low restarts the chip. Also PB5 and ADC0 on the chip. ISP RESET: the programmer holds it low. | Needs a 10 k pull-up to VCC on a real chip; Mokxi fits one. A GPIO only with the RSTDISBL fuse (not modeled).

PB3 | 2 | Digital, pin 3. Analog in, ADC3 (A3). Serial TX of Mokxi’s runtime. SPI SS (default). | XTAL1 if a crystal is fitted.

PB4 | 3 | Digital, pin 4. Analog in, ADC2 (A2). PWM on timer 1 (OC1B). Serial RX of Mokxi’s runtime. | XTAL2 if a crystal is fitted.

GND | 4 | Ground. | -

PB0 | 5 | Digital, pin 0. PWM on timer 0 (OC0A). I2C SDA (default). SPI MISO (default). AREF. | ISP MOSI: the programmer drives it during an upload.

PB1 | 6 | Digital, pin 1. PWM on timer 0 (OC0B). SPI MOSI (default). | ISP MISO: the chip answers the programmer on it.

PB2 | 7 | Digital, pin 2. Analog in, ADC1 (A1). I2C SCL (default). SPI SCK (default). INT0: attachInterrupt. | ISP SCK: the programmer’s clock.

VCC | 8 | Supply: 2.7 to 5.5 V, or 1.8 to 5.5 V for the ATtiny85V. | Not a GPIO. The chip does nothing until VCC and GND are wired.

## Power: the chip has no board

Nothing powers an ATtiny85 but the two wires you give it: VCC on pin 8 and GND on pin 4. Microchip’s datasheet gives 2.7 to 5.5 V for the ATtiny85 and 1.8 to 5.5 V for the ATtiny85V, 40 mA at most on a pin and 200 mA through VCC and GND. Mokxi treats both pins as a load, the way the chip is: with no supply every pin floats and nothing runs, and on a 3.3 V rail the pins drive and read 3.3 V logic.

Put a 100 nF capacitor across VCC and GND close to the chip on a real board. There is no LED on the chip either. LED_BUILTIN is 0, PB0, only so that Blink compiles; the LED has to be wired.

## The pin numbers in code

The sketch below prints the names the core defines. On the chip in Mokxi, with 5 V on VCC and the monitor at 9600 baud, it printed "SDA 0, SCL 2, LED_BUILTIN 0, A1 2, A2 4, A3 3": the I2C pins are PB0 and PB2, and A1 to A3 are the PB numbers of the three analog pins. analogRead(A1) reads PB2.

The serial port it prints on is the runtime’s own, because the chip has no UART: it bit-bangs 8N1 on PB3 out and PB4 in, which is where a USB-serial adapter clips on. On a real chip the internal oscillator drifts by a few percent, so fast rates need it trimmed; Mokxi’s 8 MHz is exact.

Print the pin numbers

## PWM, ADC and interrupts

analogWrite works on three pins: PB0 and PB1 from timer 0 and PB4 from timer 1, all at 488 Hz in Mokxi’s runtime. Timer 0 also counts millis(). Timer 1 can run from a 64 MHz PLL on the chip for fast PWM; Mokxi does not model the PLL, so that timer stays on the 8 MHz clock and such a sketch runs eight times slow here.

The ADC reads ten bits on ADC1 (PB2), ADC2 (PB4) and ADC3 (PB3). ADC0 is on the RESET pin, so it is no use while that pin is the reset. The reference can be VCC, 1.1 V, 2.56 V or AREF on PB0. INT0 is PB2 and is the only external interrupt; a pin-change interrupt covers all six pins, with one handler for all of them.

## I2C and SPI on the USI

The ATtiny85 has no I2C or SPI hardware of its own. It has the USI, a shift register that does either with help from software. Wire.begin() puts I2C on PB0 for SDA and PB2 for SCL, and the stock SPI.h uses PB2 for SCK, PB0 for MISO, PB1 for MOSI and PB3 for SS. Mokxi’s USI shifts and counts, but in two-wire mode it does not drive SDA, so the libraries run those buses in software on the same pins.

I2C needs pull-up resistors on SDA and SCL, 4.7 k to VCC, unless the module brings its own. A chip with a display and a sensor on I2C still has PB1, PB3 and PB4 free.

## ISP: the programming pins

An ATtiny85 is programmed over ISP, six wires from a programmer or from an Uno running the ArduinoISP sketch: RESET on pin 1, SCK on PB2 (pin 7), MISO on PB1 (pin 6), MOSI on PB0 (pin 5), VCC and GND. With an Uno as the programmer, Uno pin 13 goes to PB2, 12 to PB1, 11 to PB0 and 10 to RESET. MOSI on the chip is PB0, the opposite of the SPI.h names above, because during programming the chip is the one listening.

Anything wired to PB0, PB1 or PB2 shares those lines during an upload, so a strong load there can stop the programmer. A Digispark is this chip on a USB board with a bootloader instead; Mokxi models the bare chip, and a program is loaded by pressing Run.

## Which pin should I use for what?

A knob or any analog sensor: PB2, PB3 or PB4, with PB2 first if you need no I2C. An LED you want to dim: PB0, PB1 or PB4. A button: PB2 if it needs an interrupt, otherwise any free pin with INPUT_PULLUP to ground. I2C: PB0 and PB2. Serial to a computer: PB3 and PB4 with an adapter. Leave PB5 as RESET.

## Questions

Which ATtiny85 pins are PWM?

PB0, PB1 and PB4, which are package pins 5, 6 and 3. `analogWrite(0, 128)` puts half duty on PB0.

What are the ATtiny85 I2C pins?

SDA is PB0 (pin 5) and SCL is PB2 (pin 7). The chip does I2C through its USI, and both lines need pull-up resistors.

Which ATtiny85 pins are analog?

PB2, PB4 and PB3, which are A1, A2 and A3. A0 is the RESET pin.

How do I wire an ATtiny85 to an Arduino Uno to program it?

Uno 13 to PB2 (pin 7), 12 to PB1 (pin 6), 11 to PB0 (pin 5), 10 to RESET (pin 1), and 5 V and GND to pins 8 and 4. Load ArduinoISP onto the Uno first.

Can I use the RESET pin as PB5?

Only by programming the RSTDISBL fuse, and after that ISP cannot reach the chip without a high-voltage programmer. Mokxi keeps it as reset.

Why does my ATtiny85 do nothing in the simulator?

Check its supply: VCC on pin 8 and GND on pin 4 must both be wired. With no power every pin floats and nothing runs, as on a real chip.

Related

## Keep going

Arduino Uno Pinout: ATmega328P Pins, PWM, I2C, SPI Arduino Pro Mini Pinout: A4 to A7, FTDI, RAW, VCC I2C Explained: Addresses, Acknowledges and Pull-Ups SPI Explained: Clock, Data and Chip Select Arduino PWM Fade: analogWrite, Pins and the Curve How Many LEDs Can One Arduino Pin Drive? Run the ATtiny85 in the simulator Help: the ATtiny85 model The ATtiny85 simulator page The project page, with the full sketch Intermediate

Sources

## Where the facts on this page come from

- Microchip: ATtiny25/45/85 datasheet (pinout, supply range, current limits, serial programming pins; checked 2026-10-26)
- Arduino: using an Arduino as an ISP programmer (checked 2026-10-26)

## Build this for real

Open the editor, change a value and watch the number move with it. Nothing to install, and no account needed.

Start building free Open the editor
