Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use ATtiny85 20PU: Examples, Pinouts, and Specs

Image of ATtiny85 20PU
Cirkit Designer LogoDesign with ATtiny85 20PU in Cirkit Designer

Introduction

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.

Explore Projects Built with ATtiny85 20PU

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
ATtiny85 and OLED Display Based Interactive Game with Buzzer and LED
Image of FIRST CIRCUIT: A project utilizing ATtiny85 20PU in a practical application
This circuit is a simple interactive game system powered by a 5V battery, featuring an ATtiny85 microcontroller, an OLED display, a buzzer, an LED, and multiple pushbuttons. The OLED displays a menu with options to start a game, which is controlled by the ATtiny85. The buzzer and LED provide audio-visual feedback, and the pushbuttons are used for user input to navigate the menu and play the game.
Cirkit Designer LogoOpen Project in Cirkit Designer
ATmega328P-Based Sensor Hub with OLED Display and LIDAR
Image of TILTPCB: A project utilizing ATtiny85 20PU in a practical application
This circuit features an Mtiny Uno ATmega328P microcontroller as its central processing unit, interfacing with a variety of sensors and peripherals. It includes a 0.96" OLED display and an MPU6050 accelerometer/gyroscope for user interface and motion sensing, respectively. The circuit also integrates a TF LUNA LIDAR for distance measurement, a DHT11 sensor for temperature and humidity readings, and uses a 9V battery with a 7805 voltage regulator for power management. Communication with a computer for programming and data exchange is facilitated by an Adafruit FTDI Friend module.
Cirkit Designer LogoOpen Project in Cirkit Designer
ATtiny-Controlled LED Blinker Circuit
Image of led: A project utilizing ATtiny85 20PU in a practical application
This circuit consists of an ATtiny microcontroller that controls an LED through one of its GPIO pins (PB4). A resistor is connected in series with the LED to limit the current. The ATtiny is powered by a 3.3V battery, and the LED is designed to turn on when the ATtiny is powered up.
Cirkit Designer LogoOpen Project in Cirkit Designer
Battery-Powered Smart Sensor Hub with Adafruit QT Py RP2040
Image of wearable final: A project utilizing ATtiny85 20PU in a practical application
This circuit features an Adafruit QT Py RP2040 microcontroller interfaced with an APDS9960 proximity sensor, an MPU6050 accelerometer and gyroscope, and an OLED display via I2C communication. It also includes a buzzer controlled by the microcontroller and is powered by a 3.7V LiPo battery with a toggle switch for power control.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with ATtiny85 20PU

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of FIRST CIRCUIT: A project utilizing ATtiny85 20PU in a practical application
ATtiny85 and OLED Display Based Interactive Game with Buzzer and LED
This circuit is a simple interactive game system powered by a 5V battery, featuring an ATtiny85 microcontroller, an OLED display, a buzzer, an LED, and multiple pushbuttons. The OLED displays a menu with options to start a game, which is controlled by the ATtiny85. The buzzer and LED provide audio-visual feedback, and the pushbuttons are used for user input to navigate the menu and play the game.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of TILTPCB: A project utilizing ATtiny85 20PU in a practical application
ATmega328P-Based Sensor Hub with OLED Display and LIDAR
This circuit features an Mtiny Uno ATmega328P microcontroller as its central processing unit, interfacing with a variety of sensors and peripherals. It includes a 0.96" OLED display and an MPU6050 accelerometer/gyroscope for user interface and motion sensing, respectively. The circuit also integrates a TF LUNA LIDAR for distance measurement, a DHT11 sensor for temperature and humidity readings, and uses a 9V battery with a 7805 voltage regulator for power management. Communication with a computer for programming and data exchange is facilitated by an Adafruit FTDI Friend module.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of led: A project utilizing ATtiny85 20PU in a practical application
ATtiny-Controlled LED Blinker Circuit
This circuit consists of an ATtiny microcontroller that controls an LED through one of its GPIO pins (PB4). A resistor is connected in series with the LED to limit the current. The ATtiny is powered by a 3.3V battery, and the LED is designed to turn on when the ATtiny is powered up.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of wearable final: A project utilizing ATtiny85 20PU in a practical application
Battery-Powered Smart Sensor Hub with Adafruit QT Py RP2040
This circuit features an Adafruit QT Py RP2040 microcontroller interfaced with an APDS9960 proximity sensor, an MPU6050 accelerometer and gyroscope, and an OLED display via I2C communication. It also includes a buzzer controlled by the microcontroller and is powered by a 3.7V LiPo battery with a toggle switch for power control.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications

  • Wearable electronics
  • IoT devices
  • LED control and lighting systems
  • Small robotics projects
  • Sensor interfacing and data logging
  • Battery-powered devices

Technical Specifications

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

Pin Configuration and Descriptions

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)

Usage Instructions

How to Use the ATtiny85 in a Circuit

  1. Power Supply: Connect the VCC pin (Pin 8) to a power source (2.7V to 5.5V) and the GND pin (Pin 4) to ground.
  2. Programming: Use an ISP (In-System Programmer) such as an Arduino UNO or a dedicated AVR programmer to upload code to the ATtiny85.
  3. I/O Connections: Use the GPIO pins (PB0 to PB5) for input/output operations. These pins can also be configured for ADC, PWM, or communication protocols like SPI and I²C.
  4. Decoupling Capacitor: Place a 0.1 µF ceramic capacitor between VCC and GND to stabilize the power supply.

Example: Programming the ATtiny85 with an Arduino UNO

To program the ATtiny85 using an Arduino UNO as an ISP, follow these steps:

  1. Connect the Arduino UNO to the ATtiny85 as follows:
    • Arduino Pin 10 → ATtiny85 Pin 1 (RESET)
    • Arduino Pin 11 → ATtiny85 Pin 5 (MOSI)
    • Arduino Pin 12 → ATtiny85 Pin 6 (MISO)
    • Arduino Pin 13 → ATtiny85 Pin 7 (SCK)
    • Arduino GND → ATtiny85 Pin 4 (GND)
    • Arduino 5V → ATtiny85 Pin 8 (VCC)
  2. Upload the "ArduinoISP" sketch to the Arduino UNO from the Arduino IDE.
  3. Configure the Arduino IDE for the ATtiny85:
    • Install the ATtiny board package via the Boards Manager.
    • Select "ATtiny85" as the board, "8 MHz (Internal)" as the clock, and the appropriate programmer (e.g., "Arduino as ISP").
  4. Write and upload your code to the ATtiny85.

Example Code: Blinking an LED

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
}

Important Considerations

  • Clock Source: By default, the ATtiny85 uses an internal 8 MHz clock. If you need higher precision, consider using an external crystal oscillator.
  • Power Consumption: Use sleep modes to reduce power consumption in battery-powered applications.
  • Pull-Up Resistors: Enable internal pull-up resistors for input pins if needed.

Troubleshooting and FAQs

Common Issues

  1. Problem: The ATtiny85 is not responding to programming commands.

    • Solution: Ensure all connections between the programmer and the ATtiny85 are correct. Check for loose wires or incorrect pin mappings.
  2. Problem: The LED does not blink in the example code.

    • Solution: Verify that the LED is connected to PB0 (Pin 5) with the correct polarity. Check the resistor value (typically 220Ω to 1kΩ).
  3. Problem: The ATtiny85 is running at the wrong clock speed.

    • Solution: Double-check the clock settings in the Arduino IDE. If using an external clock, ensure it is properly connected.

FAQs

  • 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.