Parts

ATtiny85: DIP-8 pinout, clock limits, pin current and programming

By

On the DIP-8 ATtiny85, pin 8 is VCC, pin 4 is GND, and the other six pins are port B: pin 5 PB0, 6 PB1, 7 PB2, 2 PB3, 3 PB4 and pin 1 PB5, which is also RESET. Programming uses pins 5, 6 and 7 (MOSI, MISO, SCK) plus pin 1.

This page covers the limits in Microchip's datasheet 2586Q, how fast the chip may run at a given supply, why a pin is good for 10 mA and not 40, a minimal circuit, and how to program it from an Arduino Uno. The ATtiny45 and the low-voltage ATtiny85V share the pins and the datasheet; they come in where they differ.

Datasheet: Microchip (Atmel) ATtiny25/V, ATtiny45/V, ATtiny85/V full datasheet, 2586Q (PDF)Ask Datasheet Guru about the ATTINY85-20PU

Advertisement

Pinout by package

ATtiny85-20PU DIP-8 · Microchip (Atmel)1=PB5 2=PB3 3=PB4 4=GND 5=PB0 6=PB1 7=PB2 8=VCC
top view, notch upATtiny85-20PU18PB5VCC27PB3PB236PB4PB145GNDPB0

Top view, notch up: pin 1 (PB5, RESET) top left, pins 1 to 4 down the left side and 5 to 8 back up the right.

Pin 1 stays RESET unless the RSTDISBL fuse is set, and setting it ends ordinary ISP programming.

Source: Microchip (Atmel) ATtiny25/V, ATtiny45/V, ATtiny85/V full datasheet, 2586Q, p. 2 (Figure 1-1, PDIP/SOIC/TSSOP top view with every pin and its alternate functions); Microchip (Atmel) ATtiny25/V, ATtiny45/V, ATtiny85/V full datasheet, 2586Q, p. 60 (PB5 is RESET while the RSTDISBL fuse is unprogrammed; programming it turns the pin into a weak I/O); Microchip (Atmel) ATtiny25/V, ATtiny45/V, ATtiny85/V full datasheet, 2586Q, p. 206 (ordering information: ATtiny85-20PU is the 8P3 package, 8-lead 0.300 inch PDIP)

Which one do you have?

The through-hole part is the ATtiny85-20PU: 20 for the 20 MHz speed grade, P for the 8-lead 0.3 inch PDIP, U for matte tin. ATtiny85-20SU is the same chip in an 8-lead SOIC with the same pin numbers, and -MU is a 20-pad QFN.

A V after the number (ATtiny85V-10PU) marks the low-voltage grade: it starts at 1.8 V instead of 2.7 V but never runs faster than 10 MHz. The ATtiny45 and ATtiny25 are the same chip with 4 KB and 2 KB of flash. All of them print only the part number on top, so the reliable test is the signature a programmer reads: 0x1E 0x93 0x0B for an ATtiny85.

Absolute maximum ratings

Only Microchip (formerly Atmel) makes the ATtiny85, so the disagreement worth knowing is inside the one datasheet. The maximum ratings allow 6.0 V and 40 mA per pin, but the chip is specified only to 5.5 V, and the output voltages are guaranteed only at 10 mA per pin at 5 V. Note 4 under Table 21-1 goes further: pins are "not guaranteed to sink current greater than the listed test condition." Design to 5.5 V and 10 mA.

Absolute maximum ratings, 2586Q p. 161
ParameterATtiny85-20PUDIP-8
Maximum operating voltage VCC6.0 V
Voltage on any pin except RESET−0.5 V to VCC + 0.5 V
Voltage on RESET−0.5 V to +13.0 V
DC current per I/O pin40.0 mA
DC current, VCC and GND pins200.0 mA
Operating temperature (absolute)−55 to +125 °C
Storage temperature−65 to +150 °C

RESET is the one pin that tolerates more than the supply, up to 13 V, because a high-voltage programmer uses 12 V on it. Every other pin is held to 0.5 V outside the rails, so a 5 V signal must not reach the chip when it runs from 3 V.

Clock, pin levels and supply current

Limits at −40 to 85 °C unless marked typical, 2586Q pp. 161 to 166
ParameterATtiny85-20PUDIP-8
Operating supply VCCATtiny85 / ATtiny85V2.7 to 5.5 V / 1.8 to 5.5 V
Maximum clock, ATtiny85linear between the corners (Figure 21-2)10 MHz at 2.7 V, 20 MHz at 4.5 to 5.5 V
Maximum clock, ATtiny85VFigure 21-14 MHz at 1.8 V, 10 MHz at 2.7 to 5.5 V
Output low voltage VOLIOL = 10 mA, VCC = 5 V0.6 V max
Output low voltage VOLIOL = 5 mA, VCC = 3 V0.5 V max
Output high voltage VOHIOH = −10 mA, VCC = 5 V4.3 V min
Output high voltage VOHIOH = −5 mA, VCC = 3 V2.5 V min
Input thresholds, I/O pins VIL / VIHVCC = 2.4 to 5.5 Vlow below 0.3 VCC, high above 0.6 VCC
Sum of sink current, all pinssteady state60 mA
Sum of source current, all pinssteady state60 mA
I/O pull-up resistor RPU20 to 50 kΩ
RESET pull-up resistor RRST30 to 60 kΩ
RESET threshold VRSTVCC = 3 V0.2 VCC to 0.9 VCC
Minimum RESET pulse tRSTVCC = 3 V2.5 µs
Internal RC oscillatorfactory calibration, 3 V, 25 °C8.0 MHz ±10%
Supply current, active ICC8 MHz, VCC = 5 V5 mA typ, 8 mA max
Supply current, active ICC1 MHz, VCC = 2 V0.3 mA typ, 0.55 mA max
Supply current, power-down ICCVCC = 3 V, watchdog on / off10 µA / 2 µA max
Internal bandgap reference VBGVCC = 5.5 V, 25 °C1.0 to 1.2 V (1.1 V typ)
41016201.82.73.34.55.516 MHz needs 3.78 V3.3 V: 13.3 MHz maxMHzsupply voltage VCC, volts
Figure 1. The shaded area is where the ATtiny85 (-20 grade) may run (Figure 21-2, p. 163). The 16 MHz PLL clock needs 3.78 V or more.

Between the corners the line is straight. From 10 MHz at 2.7 V to 20 MHz at 4.5 V the clock rises 10 MHz over 1.8 V, so the chip's own 16 MHz PLL clock needs 2.7 + (16 − 10) × 1.8 / 10 = 3.78 V. At 3.3 V the limit is 10 + 0.6 × 10 / 1.8 = 13.3 MHz. On a 3.3 V or battery supply, 8 MHz from the internal oscillator stays inside the rating. The V grade is different again: 4 MHz at 1.8 V, 10 MHz from 2.7 V upward.

At 5 V an input reads low below 1.5 V and high above 3.0 V; at 3 V the high threshold drops to 1.8 V. See the logic levels lesson and the 3.3 V to 5 V level shifter guide when the ATtiny85 talks to a board on another supply.

What it is good for

  • Small jobs that would waste an Arduino: a blinker, a fan or pump timer, a button that sends one I²C command, an LED effect. Five free pins once RESET is kept.
  • Battery gadgets. In power-down at 3 V it draws at most 10 µA with the watchdog running and 2 µA without it.
  • Fast PWM. Timer1 can run from the 64 MHz PLL, which gives PWM well above the audio band for LED dimming and small converters, and a dead-time generator for driving half-bridges.
  • Reading up to four analog inputs (ADC1 to ADC3, plus ADC0 on the RESET pin).

It is the wrong chip for anything needing a hardware UART, USB, or more than five pins. The USI can do SPI and I²C, but it needs more code than a real TWI port. For more pins in a breadboard-friendly package, see the ATmega328P page.

Worked example: an ATtiny85 driving LEDs at 5 V

The smallest working circuit: a 5 V supply, one decoupling capacitor, a reset pull-up and an LED on PB0. No crystal: the chip runs on its internal oscillator.

1. Check the clock. A new chip runs at 1 MHz (8 MHz internal oscillator divided by 8, p. 30). Both 1 MHz and 8 MHz sit far inside Figure 1 at 5 V. The 16 MHz PLL clock is also allowed here: it needs 3.78 V.

2. Decouple the supply. A 100 nF ceramic capacitor straight across pin 8 and pin 4, as short as the leads allow. With only two supply pins, they sit on opposite corners of the DIP, so run the capacitor diagonally under or beside the chip.

3. Pull RESET up. The chip has its own pull-up of 30 kΩ to 60 kΩ. A 10 kΩ resistor to 5 V in parallel brings that to 7.5 kΩ to 8.57 kΩ, so a long wire or a noisy motor does not reset the chip. The pulse that resets it must be longer than 2.5 µs, and any button press is.

4. Size the LED resistor to 10 mA. A red LED drops about 2 V. R ≥ (5 − 2) V / 10 mA = 300 Ω; the next E12 value up is 330 Ω. With the pin at the full rail that gives 9.1 mA. The datasheet promises the pin stays above 4.3 V at 10 mA, so even a weak chip gives at least (4.3 − 2) / 330 = 7.0 mA.

5. Add up the pins. 5 such LEDs on PB0 to PB4 draw 45.5 mA together. The sum of all source currents must stay under 60 mA, so five fit with 14.5 mA to spare.

ATtiny851 RST2 PB33 PB44 GNDVCC 8PB2 7PB1 6PB0 5reset+5 V10 kΩ+5 V100 nF330 ΩLEDPB1 to PB4 free for your circuit
Figure 2. The minimal circuit. The resistor, capacitor and LED values are ours; the datasheet gives the limits they are checked against.
050100150200One pin, specified10 mAOne pin, absolute40 mASink, all pins60 mASource, all pins60 mAVCC or GND pin200 mA5 LEDs, PB0-PB445.5 mAmilliamps
Figure 3. Pin current limits from p. 161 and the notes to Table 21-1 (p. 162), against the five-LED example.

On batteries the sleeping chip is rarely what empties them. At the 10 µA maximum with the watchdog waking it, it uses 0.24 mAh a day; the LED, a regulator or a sensor left powered usually costs far more. The LED resistor calculator does step 4 for other colours.

Worked example in numbers

LED resistor at 5 V
330 Ω
LED current, worst to best
7.0 mA to 9.1 mA
RESET pull-up, total
7.5 kΩ to 8.57 kΩ
Minimum supply for 16 MHz
3.78 V

Programming it from an Arduino Uno

The ATtiny85 has no USB and no bootloader as shipped. It is programmed over SPI: hold RESET low and clock instructions in on MOSI (pin 5) and SCK (pin 7), with answers on MISO (pin 6). An Arduino Uno running the ArduinoISP example sketch does this; the sketch uses D10 to drive the target's RESET.

Arduino UnosignalATtiny85 pinD13SCK7 (PB2)D12MISO6 (PB1)D11MOSI5 (PB0)D10RESET1 (PB5)5Vsupply8 (VCC)GNDground4 (GND)
Figure 4. ISP wiring. The ATtiny85 side is Table 20-10 (p. 151); D10 for RESET is the ArduinoISP sketch's choice.

The programmer's clock is limited by the chip's own clock: SCK high and low must each last more than 2 CPU cycles below 12 MHz (p. 151). On the factory 1 MHz that means under 250 kHz; once the chip runs at 8 MHz, up to 2 MHz. Setting the clock fuses (the Arduino IDE's "Burn Bootloader" does this for ATtiny cores) is a separate step from uploading the program, and it has to be done once per chip.

Tips and checks

  • Keep pins 5, 6 and 7 free of heavy loads if you want to reprogram the chip in place. An LED with 330 Ω is fine; a capacitor or a low-value pull-down on SCK or MOSI can stop the programmer.
  • Plan on 10 mA per pin at 5 V and 5 mA at 3 V, the currents the output voltages are specified at. For a relay, motor or LED strip, drive a transistor; the MOSFET guide for Arduino and ESP32 picks one.
  • The internal oscillator is ±10% as shipped (±1% after calibration), too loose for reliable serial timing. Calibrate OSCCAL or use a crystal on PB3 and PB4, which costs two of your six pins.
  • Use the internal pull-ups (20 to 50 kΩ) for buttons. For I²C on PB0 (SDA) and PB2 (SCL), fit external pull-ups.
  • Below 2.7 V the PLL needs its low-speed mode, and the standard ATtiny85 is out of its rating altogether. A falling battery needs the V grade or the brown-out detector set to 1.8 or 2.7 V.
Advertisement

ATtiny45

The ATtiny45 is the same chip with half the memory: 4 KB of flash and 256 bytes each of EEPROM and SRAM, against 8 KB and 512 bytes on the ATtiny85. Pins, peripherals, clock limits and pin currents are identical, so every number on this page applies. A program that fits in 4 KB runs unchanged once the programmer is set for the 45 (signature 0x1E 0x92 0x06). The ATtiny25 halves it again, to 2 KB.

Substitutes: the ATtiny45 and ATtiny85V

Pin numbers as on the DIP-8 top view; the SOIC-8 uses the same numbers
PartPinsVerdict
ATtiny45-20PUSame 8 pinsSame pins, peripherals, clock and current limits, from the same datasheet, with half the memory: 4 KB flash, 256 bytes each of EEPROM and SRAM. Fine for a program that fits. Its signature is 0x1E 0x92 0x06, so the programmer must be set for the 45.Microchip (Atmel) ATtiny25/V, ATtiny45/V, ATtiny85/V full datasheet, 2586Q, p. 1; Microchip (Atmel) ATtiny25/V, ATtiny45/V, ATtiny85/V full datasheet, 2586Q, p. 2; Microchip (Atmel) ATtiny25/V, ATtiny45/V, ATtiny85/V full datasheet, 2586Q, p. 150
ATtiny85V-10PUSame 8 pinsThe same chip graded for low voltage: it runs from 1.8 V but tops out at 10 MHz at any supply. Swap it in when the supply can fall below 2.7 V and the clock is 8 MHz or less.Microchip (Atmel) ATtiny25/V, ATtiny45/V, ATtiny85/V full datasheet, 2586Q, p. 163; Microchip (Atmel) ATtiny25/V, ATtiny45/V, ATtiny85/V full datasheet, 2586Q, p. 206
854525Flash8 KB4 KB2 KBEEPROM, bytes512256128SRAM, bytes512256128Signature (1E ..)93 0B92 0691 08Pins / I/O lines8 / 68 / 68 / 6
Figure 5. The three family members, from 2586Q p. 1 (memory) and Table 20-7, p. 150 (signatures). Differences from the ATtiny85 are in bold.

Bench check: is the chip alive, and at what clock?

  1. With power on, measure 5 V between pin 8 and pin 4, and about 5 V on pin 1. RESET sitting low means a shorted button or a missing pull-up.
  2. Wire the programmer as in Figure 4 and read the signature: 0x1E 0x93 0x0B for an ATtiny85. On a new chip, slow the programmer below 250 kHz first. No answer at all usually means a loose RESET wire or a load on pin 5, 6 or 7.
  3. Load a blink program built for 8 MHz with a one-second delay. If each blink takes 8 seconds, the chip is still on its 1 MHz factory clock: set the fuses.
  4. For a direct look, the CKOUT fuse puts the system clock out on PB4 (pin 3), where a frequency counter should read the clock you set, within the oscillator's ±10%.

What we'd do

Buy the ATtiny85-20PU, read its signature, and set the clock fuses to 8 MHz before it goes into a board. Build it as Figure 2: 100 nF across pins 8 and 4, 10 kΩ on RESET, and 10 mA or less per pin. Leave RESET alone, keep pins 5 to 7 lightly loaded so you can reprogram in place, and use the V grade if the supply can drop below 2.7 V.

Questions people ask

What is the ATtiny85 pinout?

On the DIP-8: pin 1 PB5/RESET, 2 PB3, 3 PB4, 4 GND, 5 PB0 (MOSI, SDA), 6 PB1 (MISO), 7 PB2 (SCK, SCL) and 8 VCC.

How much current can an ATtiny85 pin give?

Plan on 10 mA at 5 V and 5 mA at 3 V, the currents the output voltages are specified at. 40 mA is the absolute maximum, not a working figure. All pins together may sink 60 mA and source 60 mA.

Can an ATtiny85 run at 16 MHz without a crystal?

Yes, from its internal PLL, which turns the 8 MHz oscillator into 64 MHz and divides it by 4. It needs at least 3.78 V on the supply, and the frequency is only as accurate as the internal oscillator.

Can I use the RESET pin as an I/O pin?

Only by setting the RSTDISBL fuse, after which the chip can no longer be programmed over ISP. Even then it is a weak pin. Reading it as ADC0 while it stays RESET works only if the voltage never falls low enough to reset the chip.

What is the difference between the ATtiny85 and ATtiny85V?

The V runs from 1.8 V, but tops out at 10 MHz. The standard part needs 2.7 V and reaches 20 MHz at 4.5 V and above.

Buying the ATtiny85 in India

The DIP ATtiny85-20PU is stocked by most Indian online component shops, and so are small USB boards built around it. Read the print on loose chips (ATtiny85, not 45 or 25) and check the signature when they arrive. Our guide to buying electronic components in India compares ten online sellers and covers how to spot fakes. Before a first dimmer project, read the duty cycle and PWM lesson.

Advertisement

One email a month from the bench

New circuits, lessons, part guides and calculators, on the first Sunday of each month.

We'll send one email to confirm. Every email has a one-click unsubscribe. Privacy policy

Used in these lessons

Lessons that go deeper

Datasheets this page was checked against

Makers revise datasheets. If the copy you download has a newer revision and a number here disagrees with it, the datasheet wins, and we would like to hear about it.