

The ATtiny85 20PU is a small, low-power 8-bit microcontroller from Atmel (now part of Microchip Technology). It features 8 KB of flash memory, 512 bytes of SRAM, and 6 general-purpose I/O pins. This microcontroller is designed for compact embedded applications where space and power efficiency are critical. Despite its small size, the ATtiny85 offers a wide range of functionalities, including PWM, ADC, and I²C/SPI communication, making it a versatile choice for hobbyists and professionals alike.








Below are the key technical details of the ATtiny85 20PU:
| Parameter | Value |
|---|---|
| Architecture | 8-bit AVR RISC |
| Flash Memory | 8 KB |
| SRAM | 512 bytes |
| EEPROM | 512 bytes |
| Operating Voltage | 2.7V - 5.5V |
| Maximum Clock Speed | 20 MHz |
| I/O Pins | 6 |
| ADC Channels | 4 (10-bit resolution) |
| PWM Channels | 2 |
| Communication Interfaces | I²C, SPI, USI (Universal Serial Interface) |
| Power Consumption | Low-power modes available |
| Package Type | PDIP-8 |
The ATtiny85 20PU comes in an 8-pin PDIP package. Below is the pinout and description:
| Pin Number | Pin Name | Description |
|---|---|---|
| 1 | PB5 (RESET) | Reset pin (active low) / GPIO |
| 2 | PB3 (ADC3) | GPIO / ADC channel 3 / Timer/Counter0 Compare Match |
| 3 | PB4 (ADC2) | GPIO / ADC channel 2 / Timer/Counter0 Compare Match |
| 4 | GND | Ground |
| 5 | PB0 (ADC0) | GPIO / ADC channel 0 / MOSI (SPI) / PWM output |
| 6 | PB1 (ADC1) | GPIO / ADC channel 1 / MISO (SPI) / PWM output |
| 7 | PB2 (SCK) | GPIO / SPI Clock / USI Clock |
| 8 | VCC | Power supply (2.7V - 5.5V) |
To program the ATtiny85 using an Arduino UNO as an ISP, follow these steps:
The following code demonstrates how to blink an LED connected to PB0 (Pin 5) of the ATtiny85:
// Blink an LED on PB0 (Pin 5 of ATtiny85)
#define LED_PIN 0 // PB0 is digital pin 0 on ATtiny85
void setup() {
pinMode(LED_PIN, OUTPUT); // Set PB0 as an output pin
}
void loop() {
digitalWrite(LED_PIN, HIGH); // Turn the LED on
delay(500); // Wait for 500 milliseconds
digitalWrite(LED_PIN, LOW); // Turn the LED off
delay(500); // Wait for 500 milliseconds
}
Problem: The ATtiny85 is not responding to programming commands.
Problem: The LED does not blink in the example code.
Problem: The ATtiny85 is running at the wrong clock speed.
Q: Can I use the ATtiny85 without an external programmer?
A: No, you need an ISP programmer or an Arduino configured as an ISP to upload code.
Q: How do I reset the ATtiny85 to factory settings?
A: Use an ISP programmer to erase the flash memory and reset the fuses to their default values.
Q: Can the ATtiny85 handle 5V logic?
A: Yes, the ATtiny85 operates at 5V and is compatible with 5V logic levels.
Q: How many devices can I connect via I²C?
A: The ATtiny85 can act as a master or slave in an I²C network. The number of devices depends on the bus capacitance and addressing.
By following this documentation, you can effectively use the ATtiny85 20PU in your projects.