ATtiny85 Beginner’s Guide: How to Use this Amazing Chip

The ATtiny85 is a small 8-bit AVR microcontroller that packs a surprising amount of functionality into an 8-pin package. It has 8 KB of Flash program memory, 512 bytes of SRAM, 512 bytes of EEPROM, six programmable I/O pins, analog-to-digital conversion, PWM, timers, interrupts, and several low-power operating modes.

Its small size makes the ATtiny85 particularly useful when a project needs a microcontroller but does not need all the pins and memory of a larger device such as the ATmega328P used in the Arduino Uno.

The ATtiny85 can be programmed directly using an ISP programmer, and it can also be used with Arduino-compatible development environments. This makes it suitable for both beginners learning about AVR microcontrollers and experienced developers building compact embedded devices.

This guide explains the ATtiny85’s features, pinout, memory, peripherals, programming options, clock system, power requirements, and practical applications.

What is the ATtiny85?

The ATtiny85 is an 8-bit AVR RISC microcontroller originally developed by Atmel and now manufactured by Microchip Technology. It belongs to the ATtiny25/45/85 family of closely related AVR microcontrollers. That is, the ATtiny85, ATtiny45, and ATtiny25 are all related parts. The three devices are largely compatible and have the same basic architecture and peripheral set, but provide different amounts of memory.

The ATtiny85 operates from 2.7 to 5.5 V for the standard device and can operate from 1.8 to 5.5 V in the ATtiny85V version. Its maximum clock frequency is 20 MHz when operated within the appropriate voltage range.

Microchip currently lists the ATtiny85 as in production, so it remains an available member of the AVR family rather than simply being a legacy part.

Features of this amazing 8-pin microcontroller are included in the following table.

FeatureDetails
8 KB of Flash program memoryNon-volatile memory used to store the program. The contents remain stored when power is removed.
512 bytes of SRAMVolatile working memory used for variables, the stack, and temporary data while the program is running.
512 bytes of EEPROMNon-volatile memory that can be used to store settings, calibration data, counters, and other information that must be retained when power is removed.
Six programmable I/O pinsThe ATtiny85 has six general-purpose digital I/O pins. Many of these pins also have alternative functions such as ADC, PWM, USI, and other peripheral functions.
10-bit ADCA 10-bit analog-to-digital converter provides four single-ended analog input channels, allowing the ATtiny85 to measure analog voltages with 1,024 possible digital values.
Hardware PWMTimer peripherals can generate PWM signals in hardware for applications such as LED brightness control, motor control, and waveform generation without continuously toggling the pins in software.
Two timer/counter peripheralsThe timers can be used for generating precise time intervals, creating interrupts, measuring events, and generating PWM signals.
Analog comparatorCompares two analog voltage levels and produces a digital output indicating which input voltage is higher. This can be useful for threshold detection and simple analog control circuits.
Watchdog timerAn independent timer that can reset the microcontroller if the program stops operating correctly. It can also be used to wake the device from certain sleep modes.
SPI programming through the ISP interfaceThe ATtiny85 can be programmed using its In-System Programming (ISP) interface. Programmers such as the USBasp can connect directly to the device without requiring a bootloader.
Universal Serial Interface (USI)The USI provides hardware support for serial communication and can be used to implement interfaces such as SPI and two-wire communication. It is not a conventional hardware UART.
Internal and external interrupt sourcesInterrupts allow the microcontroller to respond to events without continuously polling them in the main program. They can be used with external input changes and internal peripheral events.
Internal calibrated oscillatorThe ATtiny85 can operate from an internal clock source, eliminating the need for an external crystal or resonator in many applications.
Several power-saving modesSleep modes such as Idle, ADC Noise Reduction, and Power-down allow unused parts of the microcontroller to be disabled to reduce power consumption, which is useful for battery-powered projects.
8-pin package optionThe 8-pin DIP version is particularly convenient for breadboard prototyping. The small package also makes the ATtiny85 useful when PCB space is limited.

ATtiny85 Features at a Glance

The device has only six general-purpose I/O lines because two of the eight physical pins are used for power and ground. That limitation is important when designing a project. The ATtiny85 can do a lot, but it is not intended to replace a larger microcontroller when a project needs many inputs and outputs. Key features of this device are shown in the table below.

FeatureATtiny85
AVR CPU8-bit
Flash memory8 KB
SRAM512 bytes
EEPROM512 bytes
GPIO6
ADC10-bit, 4 channels
Timers2
PWMYes
Analog comparatorYes
Watchdog timerYes
Internal oscillatorYes
Maximum clock frequency20 MHz
ISP programmingYes
Package optionsIncludes 8-pin DIP (PDIP), SOIC, and QFN/MLF, variants

ATtiny85 Memory

Understanding the different types of memory in the ATtiny85 is important when moving from a simple Arduino sketch to AVR programming.

Flash Memory

The ATtiny85 has 8 KB of Flash memory for storing the program.

Flash is non-volatile, so the program remains stored when power is removed. It is the memory used for the compiled application code.

Eight kilobytes may seem small compared with the memory available in modern computers and larger microcontrollers, but it is enough for many small embedded applications. For example, a simple application that reads a sensor, processes the measurement, and controls an LED or other output can fit comfortably into the available memory.

SRAM

The ATtiny85 has 512 bytes of SRAM.

SRAM is used while the program is running. Variables, the stack, and temporary data are stored here. The relatively small amount of SRAM means that memory usage needs to be considered carefully in larger programs. Large arrays and long strings can consume a significant proportion of the available RAM.

EEPROM

The ATtiny85 also provides 512 bytes of EEPROM.

Unlike SRAM, EEPROM retains its contents when power is removed. It is therefore useful for storing small amounts of configuration or user data, such as:

  • Calibration values
  • User settings
  • Device configuration
  • Counters
  • Saved operating parameters

EEPROM should not be treated like ordinary RAM because it has a limited write endurance. The datasheet specifies a typical endurance of 100,000 write/erase cycles.

ATtiny85 Pinout

The ATtiny85 has eight physical pins in the common DIP package. Six of these pins can be used as general-purpose digital I/O. Several pins have additional functions, so the same physical pin can perform different jobs depending on how the microcontroller is configured.

The exact peripheral function available on each pin depends on the ATtiny85’s internal configuration. The datasheet should always be consulted when designing a circuit around a particular pin.

One particularly important detail is PB5. It normally functions as the RESET input, but it can be configured for other purposes by changing the appropriate fuse setting. Doing this has consequences for normal ISP programming, so it should not be done casually.

Pin names and alternate pin functions for this microcontroller are shown in the below image. As an example, take pin 1. Its name is PB5 and can be configured as a digital input or output. In addition, it can be set up to use interrupts (as PCINT5), or be used as an external reset input, or be used as analog input 0 (as ADC0). It can also be configured to function as a debugging pin when debugWIRE is enabled on the chip.

The main pin functions are as follows.

PinMain FunctionOther Functions
1PB5 / RESETPCINT5, ADC0, debugWIRE (dW)
2PB3PCINT3, XTAL1, CLKI, not OC1B, ADC3
3PB4PCINT4, XTAL2, CLKO, OC1B, ADC2
4GNDGround or 0V
5PB0MOSI, DI, SDA, AIN0, OC0A, not OC1A, AREF, PCINT0
6PB1MISO, DO, AIN1, OC0B, OC1A, PCINT1
7PB2SCK, USCK, SCL, ADC1, T0, INT0, PCINT2
8VCCSupply voltage (2.7V to 5.5V, or 1.8V to 5.5V for ‘V’ suffix parts)

Digital I/O

The six I/O pins can be configured as digital inputs or outputs.

For example, an ATtiny85 can be used to:

  • Turn LEDs on and off
  • Read push buttons
  • Control transistors and MOSFETs
  • Read digital sensors
  • Generate control signals
  • Interface with other digital electronics

The AVR architecture provides direct control over the I/O registers, making the ATtiny85 useful for learning how microcontroller hardware actually works.

Instead of relying exclusively on high-level Arduino functions, you can configure registers such as DDRB, PORTB, and PINB directly when programming the ATtiny85 in C. This makes the device particularly useful for learning bare-metal AVR programming.

ATtiny85 ADC

The ATtiny85 includes a 10-bit analog-to-digital converter (ADC) with four single-ended input channels. A 10-bit ADC produces digital values from 0 to 1023. This allows the ATtiny85 to measure analog voltages from devices such as:

  • Potentiometers
  • Light-dependent resistors
  • Analog temperature sensors
  • Battery voltage monitoring circuits
  • Analog pressure or position sensors
  • Other analog sensors

The ADC can also be used with the internal temperature measurement facility provided by the device. When using the ADC, remember that the result represents a voltage relative to the selected ADC reference. Therefore, choosing an appropriate reference voltage and designing the input circuit correctly are important for obtaining useful measurements.

ATtiny85 PWM

The ATtiny85 has hardware timer peripherals capable of generating PWM signals. Pulse-width modulation (PWM) is useful for controlling the average power delivered to a load or for generating a variable-duty-cycle digital signal. Typical applications include:

  • LED brightness control
  • Motor speed control
  • Servo-related control signals
  • Audio and tone generation
  • Power control
  • Generating analog-like voltages with filtering

Hardware PWM is preferable to generating the signal entirely in software because the timer can generate the waveform without requiring the CPU to repeatedly toggle the output pin. The exact PWM output available depends on which timer and output compare channel is being used, so the datasheet should be consulted when assigning PWM pins.

ATtiny85 Timers

Timers are among the most useful peripherals in the ATtiny85. The device includes:

  • An 8-bit timer/counter with compare functionality
  • A high-speed 8-bit timer/counter with its own prescaler

Timers can be used for much more than simply generating PWM. They can also be used to:

  • Generate accurate time intervals
  • Create periodic interrupts
  • Measure events
  • Generate waveforms
  • Control PWM outputs
  • Implement software timing without blocking the main program

Using timers instead of software delay loops is an important step toward writing more capable embedded applications.

ATtiny85 Communication Interfaces

The ATtiny85 does not have a conventional hardware UART like some larger AVR microcontrollers. Instead, it includes a Universal Serial Interface (USI). The USI can support serial communication protocols such as SPI and two-wire communication, with the appropriate software and configuration. This is an important distinction when moving from an Arduino Uno to the ATtiny85.

An Arduino Uno has a dedicated USART peripheral that can be used for conventional serial communication. The ATtiny85’s USI is different and does not simply provide a drop-in hardware replacement for the Uno’s UART.

Software-based serial communication can also be implemented when required, although this consumes CPU resources and needs to be designed carefully.

Interrupts

The ATtiny85 supports both internal and external interrupt sources. Interrupts allow the microcontroller to respond to events without continuously polling every input in the main program.

For example, an interrupt can be used to respond to:

  • A change on an input
  • A timer event
  • A watchdog event
  • Other peripheral events

A typical application might put the processor into a low-power mode and use an interrupt to wake it when an external event occurs. This can significantly reduce power consumption in battery-operated equipment.

ATtiny85 Clock Options

The ATtiny85 has an internal calibrated oscillator, which means a separate crystal is not necessarily required. This is one of the reasons an ATtiny85 can be used in such a small circuit.

Depending on the application, an internal clock can be sufficient. For applications requiring a more precise or specific clock frequency, an external clock source or crystal can be used.

The standard ATtiny85 can operate at up to 20 MHz when the supply voltage is high enough for that speed. At lower supply voltages, the maximum permitted clock frequency is lower.

The clock configuration is particularly important when using timing-sensitive software or communication protocols.

ATtiny85 Power Consumption

Low power consumption is one of the major advantages of the ATtiny85. The device includes several power-saving modes, including:

  • Idle
  • ADC Noise Reduction
  • Power-down

In Power-down mode, most of the microcontroller’s functions are disabled until an appropriate wake-up event occurs. This makes the ATtiny85 suitable for battery-powered applications in which the microcontroller spends much of its time waiting for an event.

However, the power consumption of a complete ATtiny85 circuit depends on much more than the microcontroller’s sleep current. LEDs, sensors, voltage regulators, pull-up resistors, and other components can consume considerably more current than the sleeping microcontroller.

ATtiny85 vs ATtiny45 vs ATtiny25

The ATtiny85 is part of the ATtiny25/45/85 family. The three devices have the same basic architecture and peripherals but different memory capacities.

The ATtiny85 is often the most convenient choice when the extra memory is useful, but a smaller device can be perfectly adequate for a simple application.

The three devices are collectively referred to as the ATtiny25/45/85 family. These devices are essentially identical, except for their memory sizes, as the following table shows.

FeatureATtiny25ATtiny45ATtiny85
Flash2 KB4 KB8 KB
SRAM128 B256 B512 B
EEPROM128 B256 B512 B
I/O666
ADC10-bit10-bit10-bit
Basic architectureSame familySame familySame family

ATtiny85 vs Arduino Uno

The ATtiny85 is often used as a smaller alternative to the ATmega328P found in the classic Arduino Uno (revision 3 and earlier Arduino Uno boards). However, the two microcontrollers have very different capabilities as the following table highlights.

The ATtiny85 is therefore not simply a smaller Arduino Uno. It is a different microcontroller with fewer resources. Its advantage is that many projects do not actually need the resources of an ATmega328P.

If a circuit only needs a few inputs, a few outputs, some timing, and perhaps an analog sensor, the ATtiny85 can provide all of the required functionality in a much smaller package.

FeatureATtiny85Arduino Uno / ATmega328P
I/O623 programmable I/O lines on the MCU
Flash8 KB32 KB
SRAM512 B2 KB
EEPROM512 B1 KB
Package8-pin options28-pin MCU
ADC10-bit10-bit
UARTNo dedicated USARTYes
USBNo native USB peripheralUSB provided by Uno’s separate USB interface
Typical useSmall embedded circuitsLarger Arduino projects

ATtiny85 Programming Options

You have several ways to program ATtiny25/45/85 microcontrollers, each with its own benefits.

1. Programming ATtiny85 with Arduino

One of the most popular ways to program the ATtiny25/45/85 is through the Arduino IDE. Using an Arduino Uno as an ISP (In-System Programmer), you can upload sketches just like any other Arduino board.

Steps

  1. Install the ATtiny85 board package via Arduino Boards Manager.
  2. Connect the Arduino Uno to the ATtiny85 via ISP wiring.
  3. Burn the bootloader and upload your sketch!

This method makes programming accessible even for beginners already familiar with the Arduino ecosystem.

Alternatively the Digispark ATtiny85 board can be used which has a bootloader and USB interface.

2. Using USBasp or Atmel/Microchip Programmer

If you want more control or need to program multiple devices, a dedicated programmer like the USBasp or Atmel-ICE is ideal.

Tools Needed

  • USBasp or Atmel-ICE
  • AVRDude or Microchip Studio
  • 6-pin ISP header or breadboard setup

This approach is often used by more experienced hobbyists or professionals developing AVR-based systems.

3. High Voltage Programming (Optional)

If you’ve disabled the reset pin (to use it as an I/O pin), you’ll need high voltage programming to recover your ATtiny25/45/85. This is more advanced and usually requires a special HV programmer or shield.

4. Modern Programming Options

The MPLAB Snap is an in-circuit programmer and debugger for AVR devices as well as for other Microchip microcontrollers such as the PIC, dsPIC, and SAM devices. At the time of writing this article, the cost of the MPLAB Snap is about $12 US. This programmer/debugger is very affordable, even for hobbyists. It can program and debug the ATtiny25/45/85 range, other older AVR microcontrollers, and all of the new AVR microcontrollers. At $12 it is not even worth considering cheap hobby programmers any more. A program only hobby programmer that can program newer AVR microcontrollers that use the UPDI interface costs about $7 US from a popular online shop, and can only program through the new UPDI interface. If you want to program the ATtiny25/45/85 range in addition to the new UPDI devices, you will need a second program only hobby programmer. It is therefore not even worth buying the hobby programmers because the MPLAB Snap can not only program all the AVR microcontrollers, but has debugging capabilities as well.

Programming the ATtiny85 using an MPLAB Snap programmer/debugger and the cross-platform MPLAB X IDE is the modern option.

Here are a few ideas to spark inspiration:

  • Tiny temperature sensor with OLED display
  • USB rubber ducky (keyboard emulator)
  • Mini audio tone generator
  • Battery-powered LED light show
  • Simple capacitive touch button

Alternatives: Exploring Other ATtiny Microcontrollers

The ATtiny85 is just one option in the ATtiny microcontroller family. Other options include:

  • ATtiny13 – Minimalist with just 1 KB flash
  • ATtiny45 – A smaller sibling to ATtiny85
  • ATtiny84 – More pins and memory, ideal for slightly bigger projects

If you’re planning future-proof projects, check out the newer ATtiny0/1-series devices, which use the UPDI interface and offer more modern features.

Did You Know?

The ATtiny85 has an interesting history in the maker community.

The Digispark development board helped make the ATtiny85 particularly well known among hobbyists. The tiny board provided an inexpensive Arduino-compatible development platform based around the ATtiny85 and was designed to be much smaller than a conventional Arduino board. Microchip itself has highlighted the Digispark and its use of the ATtiny85.

The name itself also gives a clue to the device. Microchip notes that the “8” in ATtiny85 can be associated with its 8-bit architecture, 8 KB of Flash, and 8-pin package.

Another interesting feature is that the ATtiny85’s small size does not mean it is limited to simple digital switching. Its peripheral set includes a 10-bit ADC, timers, PWM capability, analog comparator, watchdog timer, interrupts, and serial interface hardware. This combination explains why the device has been used for everything from simple LED controllers to compact sensor systems and experimental USB devices.

Frequently Asked Questions

What is the ATtiny85?

The ATtiny85 is an 8-bit AVR microcontroller from Microchip Technology. It has 8 KB of Flash, 512 bytes of SRAM, 512 bytes of EEPROM, six programmable I/O pins, ADC, timers, PWM, interrupts, and other peripherals in a small package. It was originally produced by a company called Atmel, which was later bought out by Microchip.

How many pins does the ATtiny85 have?

The ATtiny85 has eight physical pins in the common DIP package, known as PDIP, or Plastic Dual In-line Package. Two are used for power and ground, leaving six pins that can be configured as general-purpose I/O, or input/output pins.

How much memory does the ATtiny85 have?

The ATtiny85 has 8 KB of Flash program memory, 512 bytes of SRAM, and 512 bytes of EEPROM.

Can the ATtiny85 be programmed with Arduino?

Yes. The ATtiny85 can be used with Arduino-compatible development environments and can be programmed using an Arduino Uno as an ISP programmer or a dedicated AVR programmer. The exact board support and programming procedure depend on the software environment being used.

Does the ATtiny85 have a UART?

No. The ATtiny85 does not have a conventional dedicated hardware USART like the ATmega328P used in the Arduino Uno. It has a Universal Serial Interface (USI), which can support serial communication protocols such as SPI and two-wire communication. Software serial can also be implemented when appropriate.

Can the ATtiny85 run at 20 MHz?

Yes, the standard ATtiny85 can operate at up to 20 MHz when the supply voltage is within the range specified for that clock speed. At lower supply voltages, a lower maximum clock frequency applies.

Can the ATtiny85 run without an external crystal?

Yes. The ATtiny85 has an internal calibrated oscillator, so many applications can operate without an external crystal or resonator.

Does the ATtiny85 have analog inputs?

Yes. The ATtiny85 has a 10-bit ADC with four single-ended ADC channels. This allows it to measure analog voltages from sensors and other circuits.

Is the ATtiny85 still available?

Yes. Microchip currently lists the ATtiny85 as an in-production product.

Is the ATtiny85 still worth learning?

The ATtiny85 remains useful for learning the fundamentals of AVR microcontrollers, including GPIO, ADC, timers, PWM, interrupts, memory, and low-power programming. Newer ATtiny devices offer more advanced features, but the ATtiny85’s simple architecture and small package make it particularly useful for understanding the fundamentals and building compact projects.

Conclusion

The ATtiny85 is a remarkably capable microcontroller for an 8-pin device. Its 8 KB of Flash, 512 bytes of SRAM, 512 bytes of EEPROM, six I/O pins, ADC, timers, PWM, interrupts, serial interface, and low-power modes give it enough functionality for a wide range of small embedded projects.

Its main strength is not that it can replace a larger microcontroller in every application. Instead, it is useful when a project needs a small amount of processing and only a handful of inputs and outputs.

For beginners, the ATtiny85 is also an excellent introduction to the AVR architecture. It can be programmed using Arduino-compatible tools, while more advanced users can work directly with AVR C, assembly language, registers, timers, interrupts, and fuse settings.

Although newer ATtiny microcontrollers offer considerably more advanced features, the ATtiny85 remains a useful and well-established device for compact electronics projects, prototyping, low-power applications, and learning about 8-bit AVR microcontrollers.