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.
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 Feature | Technical Spec | What It Means in Plain English |
|---|---|---|
| Package Type | 8-Pin DIP-8 or SOIC-8 | Tiny footprint that fits easily on breadboards and compact project boards. |
| CPU Core | 8-bit AVR RISC (up to 20 MHz) | Reliable processor that runs compiled Arduino C++ sketches smoothly. |
| Program Flash | 8 KB (8,192 bytes) | Holds small to medium sketches, state machines, and simple math routines. |
| SRAM Working Memory | 512 Bytes | RAM memory used for active variables and runtime execution. |
| EEPROM Storage | 512 Bytes | Non-volatile memory that retains settings even after power is turned off. |
| Usable GPIO Pins | 6 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 Channels | Up to 3 Hardware Outputs | Generates pulse signals for smooth LED dimming and speed control. |
| Internal Oscillator | 1 MHz, 8 MHz, or 16 MHz PLL | Runs on its own internal clock without needing an external crystal. |
| Operating Voltage | 2.7V to 5.5V DC | Runs safely on a 3V button cell or a standard 5V USB power supply. |
| Active Current | Less 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 Factor | ATtiny85 | Arduino Uno R3 | ESP32 | Raspberry Pi Pico |
|---|---|---|---|---|
| Form Factor | Bare 8-Pin DIP chip | Standard board with headers | Development board | Castellated board |
| Size | ~10 mm x 8 mm | 68 mm x 53 mm | 51 mm x 25 mm | 51 mm x 21 mm |
| Operating Logic | 2.7V to 5.5V (5V friendly) | 5.0V Logic | 3.3V Logic Only | 3.3V Logic Only |
| Processor | 8-bit AVR @ 8-16 MHz | 8-bit AVR @ 16 MHz | 32-bit Dual/Single-core @ 160-240 MHz | 32-bit Dual-core ARM @ 125 MHz |
| Flash / SRAM | 8 KB / 512 B | 32 KB / 2 KB | 4 MB / 520 KB | 2 MB / 264 KB |
| Usable GPIO | 6 pins | 14 digital + 6 analog | 30+ pins | 26 pins |
| Wireless | None | None | Wi-Fi & Bluetooth LE | None (Pico W adds Wi-Fi) |
| Power Draw | Extremely Low (~1 mA) | Moderate (~45 mA) | Higher (~80-160 mA with Wi-Fi) | Low (~20 mA) |
| Best Project Role | Wearables, coin-cell gadgets, minimal smart switches | Learning, classroom labs, 5V prototyping | Connected IoT dashboards, cloud devices | Fast 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 Label | Primary Jobs & Hardware Roles | Best Practice / What to Know |
|---|---|---|---|
| Pin 1 | PB5 / RESET | Active-LOW chip reset; weak analog input ADC0. | Keep floating or pull HIGH with a 10k resistor. Pulling to GND restarts the chip. |
| Pin 2 | PB3 | Digital I/O 3, Analog Input ADC3. | Great for reading analog sensor dividers or digital buttons. |
| Pin 3 | PB4 | Digital I/O 4, Analog Input ADC2, PWM output. | Great for analog sensors, tone output, or PWM signals. |
| Pin 4 | GND | Common Ground Reference (0V). | Connect to negative rail of battery or power supply. |
| Pin 5 | PB0 | Digital I/O 0, PWM output, I2C SDA, SPI MOSI. | Primary output pin for LEDs, servos, or I2C data lines. |
| Pin 6 | PB1 | Digital I/O 1, PWM output, SPI MISO, Timer1. | Second PWM pin, ideal for LED brightness control or audio buzzers. |
| Pin 7 | PB2 | Digital I/O 2, Analog Input ADC1, I2C SCL, SPI SCK. | Commonly used for I2C clock or an extra analog sensor input. |
| Pin 8 | VCC | Positive 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:
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:
Pin Connection Table
Complete Starter Sketch
Here is the C++ Arduino sketch running on the simulated ATtiny85:
// ============================================================================
// 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:
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:
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 Problem | Likely Cause | How to Fix It |
|---|---|---|
| LED does not light up at all | LED is inserted backwards or wired to wrong pin | Check 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 erratically | Pin 1 (RESET) is floating or picking up electrical noise | Connect 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 expected | Clock speed mismatch in compiler settings | ATtiny85 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 chip | Missing current-limiting resistor | Never 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.












