IoTSimulator

ATtiny85: Pinout, Architecture, Power Options Starter Code

Learn how the ATtiny85 works as a tiny 8-pin microcontroller for compact and battery-powered projects. This guide covers pinout, power options, PWM dimming, analog inputs, and wiring.
Muhammad Ichsanul Fadhil
Muhammad IchsanPublished 01 June 2026
ATtiny85

When building tiny electronics projects, the ATtiny85 is a great choice for your hardware setup. In this walkthrough, we look at how this miniature chip works, examine its exact 8-pin layout, compare it with larger boards like Arduino Uno, and run a working circuit demo in the simulator.

The ATtiny85 is one of the most popular 8-pin microcontrollers in the maker world. It gives you a full 8-bit AVR processor, an internal clock, PWM output, and analog inputs inside an ultra-compact DIP-8 package that plugs directly into a breadboard.

Description

The ATtiny85 is a low-power, 8-bit AVR RISC microcontroller made by Microchip (originally Atmel). It packs 8 KB of flash memory for your program, 512 bytes of SRAM working memory, and 512 bytes of EEPROM data storage into a chip the size of a postage stamp.

ATtiny85 Microcontroller Chip (DIP-8)
ATtiny85 Microcontroller Chip (DIP-8)

Unlike full development boards that come with USB converter chips, power regulators, and dozens of header pins, the ATtiny85 is bare silicon. You get direct access to the processor pins with zero extra power drain, making it a favorite for coin-cell battery gadgets, tiny wearables, and dedicated single-task circuits.

Core Capabilities & Technical Specifications

Here is a breakdown of the core hardware specifications of the ATtiny85 and what each specification means in plain English:

Hardware FeatureTechnical SpecWhat It Means in Plain English
Package Type8-Pin DIP-8 or SOIC-8Tiny footprint that fits easily on breadboards and compact project boards.
CPU Core8-bit AVR RISC (up to 20 MHz)Reliable processor that runs compiled Arduino C++ sketches smoothly.
Program Flash8 KB (8,192 bytes)Holds small to medium sketches, state machines, and simple math routines.
SRAM Working Memory512 BytesRAM memory used for active variables and runtime execution.
EEPROM Storage512 BytesNon-volatile memory that retains settings even after power is turned off.
Usable GPIO Pins6 Pins (PB0 to PB5)Configurable pins for digital signals, button inputs, PWM, and analog sensing.
Analog Inputs (ADC)4 Channels (10-bit: 0 to 1023)Reads changing voltage signals from knobs, light sensors, and thermistors.
PWM ChannelsUp to 3 Hardware OutputsGenerates pulse signals for smooth LED dimming and speed control.
Internal Oscillator1 MHz, 8 MHz, or 16 MHz PLLRuns on its own internal clock without needing an external crystal.
Operating Voltage2.7V to 5.5V DCRuns safely on a 3V button cell or a standard 5V USB power supply.
Active CurrentLess than 1 mA (Down to < 5 µA in sleep)Consumes almost no energy, allowing battery gadgets to run for months.

ATtiny85 vs Other Microcontrollers

Makers often wonder when to pick an ATtiny85 instead of an Arduino Uno, ESP32, or Raspberry Pi Pico. Comparing them side-by-side makes it simple to choose the best board for your design:

Comparison FactorATtiny85Arduino Uno R3ESP32Raspberry Pi Pico
Form FactorBare 8-Pin DIP chipStandard board with headersDevelopment boardCastellated board
Size~10 mm x 8 mm68 mm x 53 mm51 mm x 25 mm51 mm x 21 mm
Operating Logic2.7V to 5.5V (5V friendly)5.0V Logic3.3V Logic Only3.3V Logic Only
Processor8-bit AVR @ 8-16 MHz8-bit AVR @ 16 MHz32-bit Dual/Single-core @ 160-240 MHz32-bit Dual-core ARM @ 125 MHz
Flash / SRAM8 KB / 512 B32 KB / 2 KB4 MB / 520 KB2 MB / 264 KB
Usable GPIO6 pins14 digital + 6 analog30+ pins26 pins
WirelessNoneNoneWi-Fi & Bluetooth LENone (Pico W adds Wi-Fi)
Power DrawExtremely Low (~1 mA)Moderate (~45 mA)Higher (~80-160 mA with Wi-Fi)Low (~20 mA)
Best Project RoleWearables, coin-cell gadgets, minimal smart switchesLearning, classroom labs, 5V prototypingConnected IoT dashboards, cloud devicesFast motor control, robotics, sound

Pinout & Pin Basics

Because the ATtiny85 has only 8 physical legs, every pin handles multiple tasks. Here is what each pin does and how to connect it safely:

Pin #Pin LabelPrimary Jobs & Hardware RolesBest Practice / What to Know
Pin 1PB5 / RESETActive-LOW chip reset; weak analog input ADC0.Keep floating or pull HIGH with a 10k resistor. Pulling to GND restarts the chip.
Pin 2PB3Digital I/O 3, Analog Input ADC3.Great for reading analog sensor dividers or digital buttons.
Pin 3PB4Digital I/O 4, Analog Input ADC2, PWM output.Great for analog sensors, tone output, or PWM signals.
Pin 4GNDCommon Ground Reference (0V).Connect to negative rail of battery or power supply.
Pin 5PB0Digital I/O 0, PWM output, I2C SDA, SPI MOSI.Primary output pin for LEDs, servos, or I2C data lines.
Pin 6PB1Digital I/O 1, PWM output, SPI MISO, Timer1.Second PWM pin, ideal for LED brightness control or audio buzzers.
Pin 7PB2Digital I/O 2, Analog Input ADC1, I2C SCL, SPI SCK.Commonly used for I2C clock or an extra analog sensor input.
Pin 8VCCPositive Power Supply (+2.7V to +5.5V).Connect to positive power rail (e.g. 3V coin cell or 5V rail).

Important Safety Rule: Protecting Pin 1 (RESET)

Pin 1 defaults to the chip hardware reset line. If this pin touches ground even for a split second, the processor immediately reboots and stops your code. In your circuits, leave Pin 1 unconnected or connect a 10k pull-up resistor between Pin 1 and Pin 8 (VCC). Do not wire a low-resistance sensor to Pin 1 unless you explicitly intend to reset the board.

How to Power the ATtiny85

One of the best advantages of the ATtiny85 is how forgiving it is with power sources:

  • CR2032 3V Coin Cell: A tiny 3V lithium coin cell connects directly between Pin 8 (VCC) and Pin 4 (GND). Because the chip runs happily down to 2.7V, it can operate on a single coin battery for a long time.
  • Standard 5V USB Power: You can supply regulated 5V from a USB breakout board or phone charger directly into Pin 8.
  • 3x AA or AAA Battery Pack: Three standard 1.5V alkaline batteries provide around 4.5V, which sits right in the sweet spot of the chip's operating window.
  • Filter Capacitor: In real physical builds, always place a 100 nF ceramic capacitor between Pin 8 (VCC) and Pin 4 (GND) as close to the chip as possible to prevent random resets from electrical noise.

Common Components Used With ATtiny85

The ATtiny85 pairs naturally with simple, low-power components to create smart pocket devices:

LED Component
LED Component

Interactive Circuit Demo: LED Blink on PB0

Below is a working circuit configuration in our simulator. The ATtiny85 sends digital HIGH and LOW pulses on pin PB0 (Physical Pin 5) through a current-limiting resistor to blink a status LED:

Safe first wiring: PB0 drives an LED through a 220 ohm resistor with ground return to Pin 4.
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
anode
anode
C
C
K
K
cathode
cathode

Pin Connection Table

Pin Connection Map
Circuit Component
Resistor Lead 1
→
ATtiny85 Pin
PB0 (Physical Pin 5)
Explanation
Carries the digital output pulse from digital pin 0.
Circuit Component
Resistor Lead 2
→
ATtiny85 Pin
LED Anode (Long Leg)
Explanation
Limits current flow to protect both the LED and the chip pin.
Circuit Component
LED Cathode (Flat Edge)
→
ATtiny85 Pin
GND (Physical Pin 4)
Explanation
Returns current back to common ground reference.

Complete Starter Sketch

Here is the C++ Arduino sketch running on the simulated 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
// ============================================================================
// ATtiny85 Starter Sketch: Blinking an LED on PB0
// PB0 is Physical Pin 5 on the DIP-8 package
// ============================================================================

const int ledPin = 0; // Digital Pin 0 corresponds to PB0

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

void loop() {
  // Turn the LED on (HIGH voltage level)
  digitalWrite(ledPin, HIGH);
  delay(500); // Wait for half a second

  // Turn the LED off (LOW voltage level)
  digitalWrite(ledPin, LOW);
  delay(500); // Wait for half a second
}

How the Code Works, Part by Part

Let us look at each section of the sketch to understand how the ATtiny85 handles pin control:

1. Pin Setup Configuration

The setup() function executes once when power is first applied to the chip:

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

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

In Arduino code for the ATtiny85, pin numbers 0 through 4 refer to PB0 through PB4, not the physical leg numbers. Setting pinMode(0, OUTPUT) configures the internal transistors on PB0 (leg 5) to push power out to the LED.

2. Execution Loop & Timing

The loop() function runs repeatedly as long as the chip has power:

C++ Source
1
2
3
4
5
6
void loop() {
  digitalWrite(ledPin, HIGH);
  delay(500);
  digitalWrite(ledPin, LOW);
  delay(500);
}

When digitalWrite(ledPin, HIGH) runs, PB0 goes to full VCC voltage, pushing current through the resistor into the LED. Calling delay(500) pauses the microcontroller for 500 milliseconds before turning the pin back to LOW.

Fixing Common Problems

If you encounter issues when building or simulating with an ATtiny85, check these practical fixes:

Observed ProblemLikely CauseHow to Fix It
LED does not light up at allLED is inserted backwards or wired to wrong pinCheck the LED polarity: the anode (longer lead) must face the resistor, and the cathode must connect to GND. Verify that you used pin 0 in code for PB0 (physical pin 5).
Chip resets repeatedly or acts erraticallyPin 1 (RESET) is floating or picking up electrical noiseConnect a 10k pull-up resistor between Pin 1 and Pin 8 (VCC) to hold the reset line high.
Code runs much slower or faster than expectedClock speed mismatch in compiler settingsATtiny85 ships by default set to 1 MHz internal clock. In the Arduino IDE or simulator, confirm your board definition clock matches your code timing (e.g. 8 MHz or 16 MHz internal PLL).
Dim LED light or hot chipMissing current-limiting resistorNever connect an LED directly between an I/O pin and ground without a resistor. Always use a 220Ω to 470Ω resistor to keep current safe.

Summary & Next Steps

The ATtiny85 shows that you do not need a huge development board to build responsive, smart electronics. With 6 flexible I/O pins, low battery consumption, and familiar Arduino code syntax, it is the perfect platform for minimalist maker projects.

You can test this circuit right now in our online simulator, tweak the delay timings, or add more components like buttons and sensors to create your own custom compact gadget.

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.