Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Arduino & Microcontrollers

ATtiny85 Pinout, Programming & Projects: Complete Guide

ATtiny85 Pinout, Programming & Projects: Complete Guide

March 11, 2026 /Posted byJayesh Jain / 0

Eight pins. One chip. Endless possibilities. The ATtiny85 is Microchip’s smallest yet surprisingly capable AVR microcontroller — a full MCU in an 8-pin DIP package that you can solder by hand with a regular iron. It is the go-to chip when you want a microcontroller but the Arduino Uno or Nano is dramatically overkill for the task.

From DIY USB devices to smart lighting controllers, coin-cell powered sensors to wearable electronics — the ATtiny85 does the job in a fraction of the space and at a fraction of the cost. This complete guide covers everything you need to get started: the full pinout, how to program it using an Arduino, power-saving techniques, and real project ideas you can build this weekend.

Table of Contents

  • ATtiny85 Overview and Specifications
  • ATtiny85 Pinout: All 8 Pins Explained
  • How to Program the ATtiny85 Using Arduino
  • Setting Up Arduino IDE for ATtiny85
  • Power Saving and Sleep Modes
  • The ATtiny85 and USB: V-USB and Digispark
  • ATtiny85 vs. Arduino Nano: When to Use Each
  • 10 Project Ideas for the ATtiny85
  • Frequently Asked Questions

ATtiny85 Overview and Specifications

The ATtiny85 is part of Microchip’s (formerly Atmel) tinyAVR family. It shares the same AVR instruction set as the ATmega328P inside the Arduino Uno, which means the same C programming model, the same Arduino-compatible libraries (with some adaptation), and the same well-documented hardware peripherals — just scaled down to fit in 8 pins.

Key specifications:

  • Architecture: 8-bit AVR RISC
  • Clock speed: Up to 20 MHz (external crystal); 8 MHz (internal oscillator)
  • Flash memory: 8 KB
  • SRAM: 512 bytes
  • EEPROM: 512 bytes
  • I/O pins: 6 (shared with other functions)
  • ADC channels: 4 (10-bit resolution)
  • PWM channels: 3
  • Hardware timers: 2 (Timer/Counter 0 and 1)
  • USI: Universal Serial Interface (can be configured as SPI or I2C master/slave)
  • Operating voltage: 2.7–5.5 V (full speed at 5V; reduced speed at lower voltages)
  • Package: 8-pin DIP, 8-pin SOIC, 8-pad MLF (SOT-23 also available as ATtiny85V)
  • Current (active, 5V, 8MHz): ~5 mA
  • Current (power-down sleep): ~0.1 µA

The 512 bytes of SRAM is the most significant constraint. Unlike the Arduino Nano’s 2 KB, this tiny RAM means you need to be careful about string handling, function call depth, and data buffering. The 8 KB of flash is actually quite generous for small tasks — far more than you need for LED control, simple sensor reading, or basic communication.

ATtiny85 Pinout: All 8 Pins Explained

The ATtiny85’s 8 pins carry multiple functions, with each pin shared among 2–5 different signal types. Understanding all the alternate functions is key to making full use of this tiny chip.

Pin 1 — PB5 / RESET / ADC0 / dW: By default this is the hardware RESET pin — pulling it LOW resets the chip and triggers the ISP programming mode. It can also be reconfigured as a general I/O pin (PB5) by changing fuse bits, but doing so disables ISP programming (you would need an HV programmer to recover the chip). Best left as RESET in most projects.

Pin 2 — PB3 / ADC3 / XTAL1 / CLKI / OC1B: Digital I/O, analog input ADC3, crystal oscillator input, external clock input, or Timer1 PWM output B. In most breadboard projects, this is used as a digital or analog input.

Pin 3 — PB4 / ADC2 / XTAL2 / CLKO / OC1B: Similar to Pin 2, but the crystal oscillator output. In internal oscillator mode (most common), this is simply a digital/analog I/O pin. Also Timer1 PWM output (shared with PB3).

Pin 4 — GND: Ground. Connect to the negative terminal of your power supply.

Pin 5 — PB0 / MOSI / DI / SDA / AIN0 / OC0A / OC1A / AREF / PCINT0: The most feature-rich pin. MOSI for SPI, SDA for I2C (via USI), Timer0 and Timer1 PWM outputs, analog comparator input. This is often used as a PWM output (OC0A) for LED control or audio.

Pin 6 — PB1 / MISO / DO / AIN1 / OC0B / OC1A / PCINT1: SPI MISO, analog comparator input AIN1, Timer0 PWM output B. Used as a general digital output or second PWM channel in most projects.

Pin 7 — PB2 / SCK / USCK / SCL / ADC1 / T0 / INT0 / PCINT2: SPI clock, I2C clock (via USI), Timer0 external clock, external interrupt INT0, analog input ADC1. The INT0 external interrupt on this pin is valuable for wake-from-sleep applications.

Pin 8 — VCC: Power supply. Connect to 2.7–5.5 V. Add a 100 nF ceramic decoupling capacitor between VCC and GND placed as close to the chip as possible.

Summary of most useful functions by pin:

  • PWM outputs: PB0 (OC0A), PB1 (OC0B), PB4 (OC1B) — 3 PWM channels
  • Analog inputs: PB2 (ADC1), PB3 (ADC3), PB4 (ADC2), PB5 (ADC0) — 4 channels
  • SPI: PB0 (MOSI), PB1 (MISO), PB2 (SCK)
  • I2C (USI): PB0 (SDA), PB2 (SCL)
  • External interrupt: PB2 (INT0)

In the Arduino IDE (with the ATtiny core), pin numbers map as: D0=PB0, D1=PB1, D2=PB2, D3=PB3, D4=PB4, D5=PB5.

Recommended: Arduino Uno R3 Beginners Kit — The Arduino Uno is the easiest way to program an ATtiny85 via ISP. This kit gives you everything you need to start programming the Uno and use it as an ATtiny programmer.

How to Program the ATtiny85 Using Arduino

The most accessible way to program the ATtiny85 is to use an Arduino Uno (or Nano/Mega) as an ISP (In-System Programmer). Here is the process:

Step 1: Upload ArduinoISP to your Arduino
Open the Arduino IDE, go to File → Examples → 11.ArduinoISP → ArduinoISP. Upload this sketch to your Arduino Uno. Your Uno is now a programmer.

Step 2: Install ATtiny board support
Go to File → Preferences → Additional Boards Manager URLs and add: https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
Then open Tools → Board → Boards Manager, search for “attiny”, and install the “ATtiny Microcontrollers” package by David Mellis.

Step 3: Wire the ATtiny85 to the Arduino
Make these connections between the Arduino and ATtiny85:

  • Arduino Pin 10 → ATtiny85 Pin 1 (RESET)
  • Arduino Pin 11 → ATtiny85 Pin 5 (PB0/MOSI)
  • Arduino Pin 12 → ATtiny85 Pin 6 (PB1/MISO)
  • Arduino Pin 13 → ATtiny85 Pin 7 (PB2/SCK)
  • Arduino 5V → ATtiny85 Pin 8 (VCC)
  • Arduino GND → ATtiny85 Pin 4 (GND)
  • 10 µF electrolytic capacitor between Arduino RESET and GND (prevents the Arduino from resetting during programming)

Step 4: Burn the bootloader (sets fuses)
In the Arduino IDE: Tools → Board → ATtiny25/45/85. Set Processor to ATtiny85, Clock to “Internal 8 MHz”, and Programmer to “Arduino as ISP”. Then click Tools → Burn Bootloader. This does not actually burn a bootloader — it just sets the fuse bits for 8 MHz internal oscillator. You only need to do this once per chip.

Step 5: Upload your sketch
Write your sketch with the ATtiny85 as the board target, then use Sketch → Upload Using Programmer (NOT the normal Upload button) to upload via ISP.

Setting Up Arduino IDE for ATtiny85

The Arduino IDE’s ATtiny core supports most of the standard Arduino API:

  • pinMode(), digitalWrite(), digitalRead() — full support
  • analogWrite() — available on PB0, PB1, PB4 (pins 0, 1, 4)
  • analogRead() — available on PB2, PB3, PB4, PB5 (pins A1, A3, A2, A0)
  • delay(), millis(), micros() — supported
  • Serial — NOT available (no hardware UART). Use SoftwareSerial on PB0/PB1 or the TinyDebugSerial library for debugging.
  • Wire (I2C) — NOT available. Use the TinyWire library for USI-based I2C.
  • SPI — use USISPIMaster library for USI-based SPI.

Debugging without Serial Monitor is the biggest challenge. Options include: blink LED patterns to indicate status, use a logic analyzer on PB0 with SoftwareSerial at 9600 baud, or use a USI-based serial output to an FTDI adapter.

Power Saving and Sleep Modes

The ATtiny85’s Power Down sleep mode consumes only 0.1 µA — making it one of the most power-efficient MCU options for battery applications. Here is how to use it:

The ATtiny85 has 5 sleep modes:

  1. Idle: CPU stopped, peripherals run. ~1.5 mA at 5V/8MHz.
  2. ADC Noise Reduction: CPU stopped, ADC runs. For cleaner ADC readings.
  3. Power-Down: Everything stopped except pin-change and INT0 interrupts. ~0.1 µA.
  4. Power-Save: Power-Down + Timer/Counter2 running (not available on ATtiny85).
  5. Standby: Like Power-Down but with crystal oscillator running.

For battery projects, Power-Down is the target. Wake the chip with either a pin-change interrupt (any I/O pin), the INT0 external interrupt (PB2), or the Watchdog Timer (wake at intervals of 16ms to 8s).

Simple sleep example using the Watchdog Timer:

#include <avr/sleep.h>
#include <avr/wdt.h>

void setup() {
  // Set watchdog to 8s timeout
  WDTCR = (1<<WDIE) | (1<<WDP3) | (1<<WDP0);
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
}

ISR(WDT_vect) {} // Watchdog interrupt handler

void loop() {
  // Do your task here
  doSensorReading();
  
  // Sleep for ~8 seconds
  sleep_enable();
  sleep_cpu();
  sleep_disable();
}

With this pattern, a coin cell CR2032 (240 mAh) can power an ATtiny85 sensor node for over 2 years if the active period is under 100 ms.

Recommended: LM35 Temperature Sensors — A simple analog temperature sensor that connects directly to one of the ATtiny85’s ADC pins. Perfect for a coin-cell powered temperature logger that wakes from sleep, reads the LM35, and transmits via a small radio module.

The ATtiny85 and USB: V-USB and Digispark

One of the most interesting tricks with the ATtiny85 is emulating USB at low speed (1.5 Mbps) using bit-banging software on two I/O pins. This is achieved via the V-USB library, which implements the USB protocol entirely in software.

The Digispark is a commercial board built around this concept — an ATtiny85 on a tiny PCB with a USB-A connector, a 3.6 V zener diode on each data line for voltage protection, and a bootloader that makes it appear as a USB device when plugged in. It can be programmed directly via USB without an external programmer.

Using V-USB and the Digispark (or homemade equivalents), the ATtiny85 can emulate:

  • USB HID keyboard: Simulate keystrokes when plugged into a computer — used in rubber ducky-style security testing devices
  • USB HID mouse: Move the cursor or click buttons programmatically
  • USB MIDI device: Appear as a MIDI instrument to a DAW
  • USB CDC serial port: Emulate a serial device for data transfer
  • USB HID game controller: Custom joystick or button box

The V-USB implementation uses PB0 (D+) and PB2 (D-), leaving only 3 I/O pins free. This is enough for many HID devices where you just need a few buttons or sensors.

ATtiny85 vs. Arduino Nano: When to Use Each

Both run AVR code and share the same programming model, but they serve very different roles:

Use the ATtiny85 when:

  • Your task requires 1–5 I/O pins and fits in 8 KB of flash
  • PCB space is at an absolute premium
  • Power consumption is critical (coin cell, energy harvesting)
  • You are producing many units and per-unit cost matters
  • You need a standalone chip on a custom PCB

Use the Arduino Nano when:

  • You need more than 6 I/O pins
  • You need hardware Serial/I2C/SPI without software emulation
  • You are prototyping and want easy USB programming and Serial Monitor debugging
  • Your sketch is larger than 8 KB
  • You need more than 512 bytes of SRAM

In many production projects, the development happens on an Arduino Nano, and once the code is verified and optimized, it is migrated to an ATtiny85 for the final product. The two platforms complement each other perfectly.

Recommended: Arduino Nano Every with Headers — When the ATtiny85 is not enough but you still need a compact board, the Nano Every is the natural upgrade path. Same tiny footprint, but ATmega4809 with more pins, more memory, and faster clock.

10 Project Ideas for the ATtiny85

Here are 10 practical projects that make excellent use of the ATtiny85’s strengths:

1. RGB LED Fader: PWM three pins to fade through RGB colors smoothly. The ATtiny85’s 3 PWM channels are perfectly matched to driving an RGB LED (or three mosfets for higher-power LEDs). Runs from 3 V coin cell for months.

2. Capacitive Touch Sensor: Use the TinyCapacitiveSensor library to detect touch on a metal pad connected to a pin. No external IC needed. One pin touch sensor, one pin LED feedback. Ideal for smart switch replacements.

3. Candle Flicker LED: Use PWM with random variations and sleep modes to realistically simulate a candle flame on an LED. Powered by a CR2032, runs for months in a decorative lantern.

4. IR Remote Controller: Connect an IR LED to a PWM pin and use the IRremote library (ATtiny-compatible versions exist) to replicate remote control signals. Perfect for smart home IR blaster projects.

5. Temperature Guard: Connect an LM35 analog sensor to ADC1, a buzzer to PB0, and an LED to PB1. Wake from sleep every 30 seconds, check temperature, alert if it exceeds a threshold. Coin-cell powered wall-plug-free temperature alarm.

6. Digispark USB Keyboard: Program a Digispark (ATtiny85 with USB) to type a pre-programmed set of keystrokes when plugged in. Used for automated login sequences, text expansion, and presentation control.

7. Smart Night Light: Read ambient light level via LDR on ADC, control LED brightness via PWM with soft turn-on/turn-off transitions. Turns on as it gets dark, off when daylight returns. One chip, one sensor, one LED — complete in 8 lines of code.

8. Battery Level Indicator: Read battery voltage via a resistor divider on ADC, display charge level via 4 LEDs connected through a 4017 decade counter or directly via Charlieplexing on 3 pins. Compact status indicator for any battery-powered device.

9. Watchdog Timer for Another MCU: Monitor a heartbeat signal from a main microcontroller. If the heartbeat stops (main MCU crashed), the ATtiny85 pulls the main MCU’s RESET pin low. A hardware watchdog controller for critical systems.

10. I2C Expander Slave: Program the ATtiny85 as an I2C slave device using the TinyWire library. Connect it to an Arduino Uno/Mega’s I2C bus. The ATtiny handles local sensor reading and PWM output while the main MCU reads data and sends commands via I2C. Effectively a tiny peripheral processor.

Recommended: Arduino Tiny Machine Learning Kit — When your projects evolve beyond what the ATtiny85 can handle and you want to explore on-device machine learning, this kit from Arduino opens the door to TinyML on compact hardware.

Frequently Asked Questions

Can the ATtiny85 run Arduino code?

Yes — with the ATtiny board support package installed in the Arduino IDE, you can write and upload standard Arduino C++ code to the ATtiny85. Most of the core Arduino API works: pinMode(), digitalWrite(), analogRead(), analogWrite(), delay(), millis(). Libraries that depend on hardware UART (Serial), hardware I2C (Wire), or hardware SPI will not compile directly — use the USI-based TinyWire and TinyUSISPI replacements instead.

How do I add more pins to the ATtiny85?

Several techniques extend the effective pin count: Charlieplexing (drive N*(N-1) LEDs with N pins), SPI shift registers (74HC595 for outputs, 74HC165 for inputs), I2C port expanders (PCF8574 adds 8 I/O pins on 2 ATtiny pins), and analog multiplexers (CD4051 gives 8 analog inputs from 3 pins). For projects that genuinely need more I/O, consider upgrading to the ATtiny84 (14 pins, same architecture) or an ATmega328P.

What is the difference between ATtiny85 and ATtiny25/45?

All three are pin-compatible with identical pinouts and peripheral sets. The difference is memory: ATtiny25 has 2 KB flash / 128 bytes SRAM / 128 bytes EEPROM; ATtiny45 has 4 KB flash / 256 bytes SRAM / 256 bytes EEPROM; ATtiny85 has 8 KB flash / 512 bytes SRAM / 512 bytes EEPROM. For most projects, the ATtiny85 is preferred as the extra cost over the ATtiny25/45 is negligible and the extra memory provides headroom.

Can the ATtiny85 communicate with WiFi or Bluetooth?

Not natively — the ATtiny85 has no wireless hardware. However, you can connect external modules: an ESP01 (ESP8266) WiFi module via SoftwareSerial (bit-banged) for basic WiFi data transmission, or an nRF24L01 module via USI SPI for short-range 2.4 GHz communication. The ATtiny85 has limited memory, so the communication library must be lightweight. For WiFi-centric projects, an ESP8266 or ESP32 is usually a better choice than ATtiny85 + WiFi module.

Is the ATtiny85 suitable for commercial product development?

Very much so. The ATtiny85 is widely used in commercial products, particularly in small accessory electronics, smart LED products, USB gadgets, battery-powered sensors, and simple control functions in appliances. Its low cost (well under ₹50 in quantity), small size, low power, and proven reliability make it a popular choice for high-volume manufacturing. The Arduino development environment makes prototyping fast, and the production firmware can be optimized in plain AVR C for maximum efficiency.

Start Your ATtiny85 Project Today

The ATtiny85 proves that useful electronics do not need to be complex. Eight pins, 8 KB of flash, and 512 bytes of RAM are enough to build everything from decorative LED controllers to production-grade sensor nodes — at a fraction of the cost and size of a full Arduino board.

The best way to start is with an Arduino Uno as your programmer. Once you have your first ATtiny sketch running, you will find yourself reaching for this tiny chip again and again whenever a project calls for a simple embedded controller. Browse the full range of Arduino boards, sensors, and accessories at Zbotic — everything you need to move from prototype to product, shipped fast across India.

Tags: Arduino, attiny, attiny85, AVR, diy electronics, microcontroller, tiny microcontroller
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
Raspberry Pi LoRa Gateway: Bui...
blog raspberry pi lora gateway build long range iot network 595134
blog custom arduino pcb design your own minimal board 595138
Custom Arduino PCB: Design You...

Related posts

Svg%3E
Read more

Arduino Batch Programming: Flash Multiple Boards Quickly

April 1, 2026 0
Table of Contents Introduction Components and Hardware Setup Wiring Diagram and Connections Complete Code with Explanation Customization and Improvements Troubleshooting... Continue reading
Svg%3E
Read more

Arduino Based Radar System with Ultrasonic Sensor

April 1, 2026 0
Table of Contents Introduction Components and Hardware Setup Wiring Diagram and Connections Complete Code with Explanation Customization and Improvements Troubleshooting... Continue reading
Svg%3E
Read more

Arduino Automatic Plant Monitor: Sunlight, Moisture, Temperature

April 1, 2026 0
Table of Contents Introduction Components and Hardware Setup Wiring Diagram and Connections Complete Code with Explanation Customization and Improvements Troubleshooting... Continue reading
Svg%3E
Read more

Arduino Lie Detector: GSR Sensor Polygraph Project

April 1, 2026 0
Table of Contents Introduction Components and Hardware Setup Wiring Diagram and Connections Complete Code with Explanation Customization and Improvements Troubleshooting... Continue reading
Svg%3E
Read more

Arduino Metal Detector: Build a Treasure Finder

April 1, 2026 0
Table of Contents Introduction Components and Hardware Setup Wiring Diagram and Connections Complete Code with Explanation Customization and Improvements Troubleshooting... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now