Microchip ATTINY85-20SFR: A Comprehensive Datasheet and Application Guide
The Microchip ATTINY85-20SFR stands as a titan in the world of 8-bit microcontrollers, packing immense capability into an 8-pin package. This powerful yet diminutive IC is a cornerstone for countless projects, from DIY electronics to sophisticated commercial products. This guide delves into its core specifications, hardware interface, and practical applications.
Core Architecture and Key Specifications
At its heart, the ATTINY85-20SFR is based on the high-performance, low-power AVR RISC architecture. The `-20` suffix denotes its maximum operating frequency of 20 MHz, at which it can execute most instructions in a single clock cycle, achieving a throughput of nearly 20 MIPS.
Its core features include:
8 KB of In-System Self-Programmable Flash memory for code storage.
512 Bytes of Internal SRAM for data handling.
512 Bytes of EEPROM for retaining critical data without power.
Two powerful 8-bit timer/counters and one high-speed 8-bit timer/counter.
A 4-channel, 10-bit ADC (Analog-to-Digital Converter), enabling it to read analog sensors.
Universal Serial Interface (USI) that can be configured for I2C and SPI communication protocols.
Hardware Interface and Pinout
The genius of the ATTINY85 lies in its efficient use of only eight pins. The 20SFR package is an 8-pin SOIC (Small Outline Integrated Circuit), which is easy to prototype with and solder.
A brief pinout overview:
Pin 1 (PB5): Reset (active low) or digital I/O. Also serves as the dW (debugWIRE) interface.
Pin 2 (PB3): Analog Input 3 (ADC3), digital I/O, or external interrupt. Also used for PCINT3.
Pin 3 (PB4): Analog Input 2 (ADC2), digital I/O, or PCINT4.
Pin 4 (GND): Ground.
Pin 5 (PB0): Analog Input 0 (ADC0), digital I/O, Serial Data (SDA for I2C), or MOSI (for SPI).
Pin 6 (PB1): Analog Input 1 (ADC1), digital I/O, Serial Clock (SCL for I2C), or MISO (for SPI).
Pin 7 (PB2): Digital I/O, SCK (Serial Clock for SPI), or PCINT2.
Pin 8 (VCC): Supply Voltage (2.7V - 5.5V).
This multifunctionality of each pin requires careful management in software to assign the correct peripheral functions.

Programming and Development Ecosystem
The ATTINY85 is exceptionally versatile in how it can be programmed. The most common methods include:
Using an In-System Programmer (ISP) like the AVRISP mkII or USBasp through the SPI interface.
Using Arduino IDE with the ATTinyCore board package, which dramatically simplifies code development and uploading, often via a popular programmer like the USBtinyISP or by using an Arduino Uno as a programmer.
Using debugWIRE for on-chip debugging, a feature rare in microcontrollers of this size.
Practical Application Guide
The ATTINY85's small size and low power consumption make it ideal for a vast array of applications:
Standalone Systems: It can serve as the primary brain for simple tasks like controlling LEDs, reading button presses, or driving small displays.
Sensor Hub: Its 10-bit ADC is perfect for gathering data from multiple analog sensors (e.g., temperature, light, potentiometers) and either processing it locally or relaying it to a larger host controller.
I2C or SPI Peripheral: It can be used as a dedicated "co-processor" to handle specific tasks like motor control, LED sequencing, or button debouncing, communicating with a main MCU over a serial bus. This offloads processing overhead from the central processor.
USB Devices (with V-USB): Utilizing the clever V-USB library, the ATTINY85 can implement low-speed USB functionality in software, allowing it to emulate devices like keyboards, mice, or custom USB gadgets.
Power Management and Sleep Modes
A key strength of the ATTINY85 is its ability to operate on minimal power. It features multiple sleep modes, including:
Idle Mode: Stops the CPU but allows peripherals like timers and ADC to continue running.
ADC Noise Reduction Mode: Stops the CPU and all clocks except those to the ADC and timer, minimizing noise during conversion.
Power-Down Mode: Preserves register contents but halts all clocks, achieving the lowest possible power consumption. It can be woken up by an external interrupt or watchdog timer.
This makes it the premier choice for battery-powered and wearable projects where longevity is critical.
ICGOODFIND:The Microchip ATTINY85-20SFR is a testament to the principle that great things come in small packages. Its blend of substantial processing power, versatile peripherals (including a 10-bit ADC), multiple communication protocols, and ultra-low-power sleep modes cements its status as an indispensable tool for electronics engineers and hobbyists alike. Its robust development support, particularly through the Arduino ecosystem, lowers the barrier to entry, enabling its use in everything from the simplest blinkies to complex, interconnected systems.
Keywords:
1. AVR RISC Architecture
2. 8-bit Microcontroller
3. 10-bit ADC
4. Low-Power Sleep Modes
5. I2C/SPI Communication
