IoTSimulator

ATtiny85: Pinout, Architecture, Wiring Arduino Guide

Learn how the ATtiny85 8-pin microcontroller works with Arduino code. This beginner-friendly guide covers the DIP-8 pinout, power options, PWM, analog inputs, and compact circuit wiring for miniature IoT, battery-powered gadgets, and wearable electronics.
Muhammad Ichsanul Fadhil
Muhammad IchsanPublished 06 October 2026
ATtiny85

When you want to build a tiny smart gadget—like a glowing ring, a battery-powered bike flasher, an automatic plant soil buzzer, or a pocket game timer—an entire Arduino Uno development board is far too large and power-hungry. You do not need dozens of pins or a bulky USB cable taking up space in your enclosure. What you really need is a tiny, powerful computer chip that fits on the tip of your finger.

That is where the ATtiny85 comes in. Inside an 8-pin dual in-line package (DIP-8) that measures less than one square centimeter, the ATtiny85 gives you an authentic AVR processor that runs real Arduino C++ code, controls LEDs, reads analog sensors, and runs for months on a single watch battery.

This complete beginner's guide explains what the ATtiny85 does, how its pins work, how it compares to larger boards, how to wire simple circuits, and how to write clean code for your own miniature electronics projects.

Description

The ATtiny85 is a compact 8-bit microcontroller manufactured by Microchip (originally Atmel). Unlike a complete development board that includes voltage regulators, USB chips, and rows of female headers, the ATtiny85 is a bare integrated circuit (IC). You place it directly into a breadboard or solder it onto a miniature circuit board.

ATtiny85 DIP-8 Microcontroller Chip
ATtiny85 DIP-8 Microcontroller Chip

Despite its pocket size, the ATtiny85 contains everything needed to execute programs: a central processing unit (CPU), built-in program memory (Flash), working memory for live variables (SRAM), persistent storage (EEPROM), internal clock oscillators, precision timers, and analog-to-digital converters.

In real-world projects, makers love the ATtiny85 for wearable electronic jewelry, flashlight controllers, holiday ornaments, interactive toys, auto-shutoff safety switches, and low-cost sensor nodes where every millimeter and milliamp counts.

Key Technical Specifications

Here is what you need to know about the technical capabilities of the ATtiny85 and what each specification means for your project:

SpecificationTechnical ValueWhat It Means in Plain English
Microcontroller Core8-bit AVR RISCThe central brain that executes your code instructions step by step.
Program Flash Memory8 KB (8,192 Bytes)Your program's long-term bookshelf. Holds roughly 2,000 to 4,000 lines of Arduino machine code.
RAM (SRAM)512 BytesLive scratchpad memory for temporary variables, loop counters, and function calls.
EEPROM Storage512 BytesNon-volatile memory that remembers user settings or high scores even when power is disconnected.
Clock Speed1 MHz, 8 MHz, or 16 MHz (Internal PLL)How fast the chip thinks. Runs fast enough for animations, sensor readings, and servo pulses without needing an external crystal.
Operating Voltage2.7V – 5.5V (Standard) / 1.8V – 5.5V (ATtiny85V)Runs comfortably on 5V USB power, 3.3V supplies, 2x AAA batteries, or a 3V CR2032 coin cell.
Programmable I/O Pins6 General Purpose I/O Pins (PB0 to PB5)6 pins to connect buttons, LEDs, buzzers, sensors, and displays.
Hardware Timers & PWM2x 8-Bit Timers (Timer0 & Timer1)Built-in pulse generation for dimming LEDs, creating speaker tones, and driving RC servo motors.
Analog Inputs (ADC)4 Channels (10-bit resolution: 0 – 1023)Measures gradual voltage changes from potentiometers, light sensors (LDR), and thermistors.
Serial InterfacesUniversal Serial Interface (USI)Software-compatible with I2C (OLED screens, RTC clocks) and SPI communication.

ATtiny85 vs Other Microcontroller Boards

Choosing the right microcontroller board is all about matching the hardware to your project's physical space, power budget, and complexity. Here is how the ATtiny85 compares to other popular boards in the maker ecosystem:

Comparison FactorATtiny85Arduino UnoRaspberry Pi PicoESP32-C3 DevKit
Physical SizeUltra-tiny (DIP-8 chip: 9 x 7 mm)Large (68 x 53 mm)Medium breadboard stick (51 x 21 mm)Compact IoT stick (48 x 25 mm)
Usable GPIO Pins6 Pins14 Digital + 6 Analog (20 total)26 Multi-function Pins15 Multi-function Pins
Processor & Speed8-bit AVR @ 8 / 16 MHz8-bit AVR @ 16 MHz32-bit Dual-Core ARM @ 125 MHz32-bit RISC-V @ 160 MHz
Flash / SRAM Memory8 KB Flash / 512 B RAM32 KB Flash / 2 KB RAM2 MB Flash / 264 KB RAM4 MB Flash / 400 KB RAM
Wireless ConnectivityNone (pure standalone hardware)None (USB only)None (Pico W adds Wi-Fi/BT)Built-in 2.4 GHz Wi-Fi + Bluetooth LE
Idle Power ConsumptionMicro-amps (< 0.005 mA in sleep)~45 mA (regulators + USB chip)~20 mA~15–80 mA
Best Project RoleMini wearables, coin-cell gadgets, flashersClassroom learning & desktop prototypingFast robotics, math, audio & multi-core controlSmart home IoT, Wi-Fi web servers, cloud alerts

ATtiny85 DIP-8 Pinout & Port Guide

Understanding the ATtiny85 pinout is straightforward once you know how integrated circuit pins are counted. Hold the chip so the semi-circular notch (or small circular indicator dot) is at the top. Pin 1 starts at the top-left and counts down counter-clockwise to Pin 4 at the bottom-left. Pin 5 is at the bottom-right and counts up to Pin 8 at the top-right.

Physical Pin #Port NameArduino Pin IDPrimary Functions & Alternate Hardware Roles
Pin 1PB5Pin 5 / A0RESET Pin (Active LOW). Also functions as ADC0 and debugWIRE programming pin.
Pin 2PB3Pin 3 / A3Analog Input A3, External Clock Input (XTAL1 / CLKI), Pin Change Interrupt (PCINT3).
Pin 3PB4Pin 4 / A2Analog Input A2, External Clock Output (XTAL2 / CLKO), Pin Change Interrupt (PCINT4).
Pin 4GNDGNDGround Reference (0V). Connects to the negative battery terminal and sensor grounds.
Pin 5PB0Pin 0Digital Pin 0, Hardware PWM (Timer0 OC0A), I2C Data (SDA), SPI Data In (MOSI/DI).
Pin 6PB1Pin 1Digital Pin 1, Hardware PWM (Timer0 OC0B / Timer1 OC1A), SPI Data Out (MISO/DO).
Pin 7PB2Pin 2 / A1Digital Pin 2 / Analog Input A1, I2C Clock (SCL), SPI Clock (SCK).
Pin 8VCCVCCPositive Power Supply (+2.7V to +5.5V). Connects to positive battery rail or 5V/3.3V regulator.

Digital Outputs & Hardware PWM Dimming

Pins 5 and 6 (PB0 and PB1) are the most frequently used output pins because they feature dedicated hardware PWM (Pulse Width Modulation) driven by Timer0. You can use analogWrite(0, value) or analogWrite(1, value) with values from 0 to 255 to smoothly dim LEDs, adjust motor speeds, or drive piezo speakers without using software delay loops.

Reading Analog Sensors (10-bit ADC)

The ATtiny85 has three easily accessible analog input channels: Pin 2 (A3), Pin 3 (A2), and Pin 7 (A1). When you call analogRead(A1), the chip converts incoming sensor voltages into numbers from 0 (0V) up to 1023 (full VCC voltage). This lets you connect light-dependent resistors (LDR), potentiometers, temperature sensors, and moisture probes directly to the chip.

Important Warning: Pin 1 (PB5 / RESET)

Physical Pin 1 defaults to the chip's hardware RESET line. If Pin 1 is pulled down to GND (0V), the microcontroller immediately reboots. In normal breadboard circuits, leave Pin 1 unconnected or connect a 10kΩ pull-up resistor between Pin 1 and VCC. Do NOT use Pin 1 as an ordinary button input unless you are familiar with high-voltage fuse programming, because disabling the Reset fuse makes standard ISP reprogramming impossible.

How to Power the ATtiny85

One of the greatest strengths of the ATtiny85 is its wide operating voltage range and battery efficiency:

  • 5V USB Power: Perfect for initial breadboard prototyping. You can power the chip from the 5V rail of an Arduino or USB breakout board.
  • 3V CR2032 Lithium Coin Cell: The ultimate power source for pocket-sized wearables. A standard CR2032 coin cell outputs 3.0V, perfectly matching the ATtiny85's 2.7V–5.5V range.
  • 2x or 3x AAA / AA Batteries: Two alkaline batteries provide 3.0V, while three provide 4.5V. This provides high capacity for projects that drive high-brightness LEDs or small servo motors for days.
  • Low-Power Sleep Modes: By using the AVR <avr/sleep.h> library, the ATtiny85 can power down into deep sleep when idle, drawing less than 0.005 mA (5 microamps). A single coin cell can power a sleeping sensor for over a year!

Common Components Used With ATtiny85

Because the ATtiny85 has 6 usable pins, it pairs naturally with compact, power-efficient parts:

LED component
LED component

Interactive Circuit Demo: ATtiny85 LED Pulse & Dimmer

Below is an interactive circuit simulation. The ATtiny85 is wired to a 5mm indicator LED on digital pin PB0 (Physical Pin 5) through a protective 220Ω current-limiting resistor. The ground pin (Pin 4) completes the circuit loop back to the power rail.

Interactive circuit connecting ATtiny85 PB0 (Pin 5) to an LED and 220-ohm resistor.
VCC
VCC
PB2
PB2
2
2
A1
A1
PB1
PB1
1
1
PB0
PB0
0
0
PB5
PB5
5
5
RESET
RESET
PB3
PB3
3
3
A3
A3
PB4
PB4
4
4
A2
A2
GND
GND
1
1
2
2
A
A
C
C
K
K

Pin Connection Table

Pin Connection Map
ATtiny85 Pin
PB0 (Physical Pin 5)
→
Circuit Component
220Ω Resistor -> LED Anode (+)
Explanation
Carries high-speed hardware PWM signals to smoothly vary LED brightness.
ATtiny85 Pin
GND (Physical Pin 4)
→
Circuit Component
LED Cathode (-)
Explanation
Common ground reference return line completing the electrical loop.
ATtiny85 Pin
VCC (Physical Pin 8)
→
Circuit Component
+3.3V to +5V Power Supply
Explanation
Supplies operating power to the internal AVR processor logic.

Complete Starter Sketch

Upload the sketch below to run a smooth breathing LED animation on your ATtiny85:

C++ Source
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// ============================================================================
// ATtiny85 Smooth Breathing LED Animation
// PB0 (Arduino Pin 0) -> 220 Ohm Resistor -> LED -> GND
// ============================================================================

const int ledPin = 0; // PB0 is Arduino Pin 0 (DIP-8 Physical Pin 5)

void setup() {
  // Configure PB0 as a digital output pin
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // 1. Ramp brightness smoothly from OFF (0) to FULL (255)
  for (int brightness = 0; brightness <= 255; brightness += 5) {
    analogWrite(ledPin, brightness);
    delay(15); // Smooth 15ms step delay
  }
  
  // 2. Ramp brightness smoothly from FULL (255) to OFF (0)
  for (int brightness = 255; brightness >= 0; brightness -= 5) {
    analogWrite(ledPin, brightness);
    delay(15);
  }
  
  // 3. Brief resting pause at the bottom of the breath
  delay(300);
}

How the Code Works, Part by Part

Let's examine the key building blocks that make this program work:

1. Setup: Declaring the Pin Mode

The setup() function runs once when the chip powers on. We tell the microcontroller to prepare PB0 as an output:

C++ Source
1
2
3
4
5
const int ledPin = 0; // PB0 corresponds to Arduino pin 0

void setup() {
  pinMode(ledPin, OUTPUT);
}

In Arduino code for ATtiny85 (via SpenceKonde's ATTinyCore), digital pin numbers match the Port B number: 0 is PB0, 1 is PB1, 2 is PB2, 3 is PB3, and 4 is PB4.

2. Hardware PWM Dimming with analogWrite()

Inside loop(), the for-loop increments the brightness variable from 0 to 255:

C++ Source
1
2
3
4
for (int brightness = 0; brightness <= 255; brightness += 5) {
  analogWrite(ledPin, brightness);
  delay(15);
}

The analogWrite() function configures the internal 8-bit timer to switch PB0 on and off thousands of times per second. By changing the ratio of ON time to OFF time (the duty cycle), your eyes perceive a smooth, gradual change in light level.

Fixing Common Problems

If your ATtiny85 circuit or code does not behave as expected, check this troubleshooting checklist:

Observed SymptomLikely CauseHow to Fix It
LED stays completely darkLED polarity reversed or wrong pin number in codeConfirm the longer LED leg (anode) connects to the resistor from PB0 (Pin 5) and the flat edge (cathode) connects to GND. Verify code uses pinMode(0, OUTPUT).
Timers and delays run 8x too slow (e.g. 1 second delay takes 8 seconds)Factory clock fuse mismatch (chip is running at 1 MHz default instead of 8 MHz)In the Arduino IDE board settings, select Internal 8 MHz Clock and click Burn Bootloader to set the correct clock fuses.
Program resets randomly when motor or buzzer activatesVoltage drop (brownout) on power rail caused by current spikesAdd a 10µF electrolytic capacitor across the VCC (Pin 8) and GND (Pin 4) power pins to buffer sudden current surges.
Chip will not upload code via Arduino as ISPLoose SPI wiring or missing 10µF capacitor on programmer Arduino Reset pinVerify wiring: MOSI (Uno Pin 11 to ATtiny Pin 5), MISO (Uno Pin 12 to ATtiny Pin 6), SCK (Uno Pin 13 to ATtiny Pin 7), and Reset (Uno Pin 10 to ATtiny Pin 1). Place a 10µF capacitor between Reset and GND on the host Arduino.

Wrapping Up

The ATtiny85 proves that great things come in small packages. It delivers an authentic, programmable 8-bit AVR microcomputer with analog inputs, hardware PWM, and battery-friendly power consumption inside a chip no bigger than a postage stamp.

Whenever your next electronics project needs to be small, lightweight, and long-lasting, the ATtiny85 is the perfect chip to bring your ideas to life.

New

Wait! We're building more...

Our laboratory is currently preparing a lot of exciting new projects using ATtiny85. Stay tuned for the upcoming massive update!
Muhammad Ichsanul Fadhil
About Writer
Muhammad Ichsanul Fadhil
"I'm a developer and hardware enthusiast with a passion for IoT. I love experimenting with new components and writing down everything I learn to help others build their own projects."

Share this article

Share it with your favorite channel.