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

How to Use ATTiny85: Examples, Pinouts, and Specs

Image of ATTiny85
Cirkit Designer LogoDesign with ATTiny85 in Cirkit Designer

Introduction

The ATTiny85 is a small, low-power microcontroller from Atmel's AVR family, designed for embedded systems and DIY electronics projects. It features an 8-bit architecture, 8 KB of flash memory, 512 bytes of SRAM, and 6 I/O pins, making it a versatile choice for compact and low-power applications. Its small size and ease of programming make it a popular choice among hobbyists and professionals alike.

Explore Projects Built with ATTiny85

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 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
ATtiny-Controlled LED Blinker Circuit
Image of led: A project utilizing ATTiny85 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
ATmega328P-Based Sensor Hub with OLED Display and LIDAR
Image of TILTPCB: A project utilizing ATTiny85 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
ATMEGA328 Battery-Powered LED Blinker with FTDI Programming
Image of Homemade Arduino using ATmega328: A project utilizing ATTiny85 in a practical application
This circuit is a basic microcontroller setup using an ATMEGA328, powered by a 5V battery, and includes an FTDI programmer for serial communication. It features a pushbutton for reset functionality and two LEDs controlled by the microcontroller, with one LED blinking at a 1-second interval as programmed.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with ATTiny85

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 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 led: A project utilizing ATTiny85 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 TILTPCB: A project utilizing ATTiny85 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 Homemade Arduino using ATmega328: A project utilizing ATTiny85 in a practical application
ATMEGA328 Battery-Powered LED Blinker with FTDI Programming
This circuit is a basic microcontroller setup using an ATMEGA328, powered by a 5V battery, and includes an FTDI programmer for serial communication. It features a pushbutton for reset functionality and two LEDs controlled by the microcontroller, with one LED blinking at a 1-second interval as programmed.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • Wearable electronics
  • IoT (Internet of Things) devices
  • LED control and lighting systems
  • Sensor-based projects
  • Small robotics and automation systems
  • Battery-powered devices

Technical Specifications

The ATTiny85 is a highly capable microcontroller with the following key specifications:

Parameter Value
Architecture 8-bit AVR
Flash Memory 8 KB
SRAM 512 bytes
EEPROM 512 bytes
Operating Voltage 2.7V - 5.5V
Clock Speed Up to 20 MHz (with external clock)
I/O Pins 6
ADC Channels 4 (10-bit resolution)
PWM Channels 2
Timers 2 (8-bit)
Communication Interfaces SPI, I²C (TWI), and UART (via USI)
Power Consumption Low-power modes available
Package 8-pin PDIP, SOIC, or QFN

Pin Configuration and Descriptions

The ATTiny85 comes in an 8-pin package. Below is the pinout and description:

Pin Number Pin Name Description
1 PB5 (RESET) Reset pin (active low) or GPIO
2 PB3 (ADC3) GPIO, ADC input channel 3, or SPI MOSI
3 PB4 (ADC2) GPIO, ADC input channel 2, or SPI MISO
4 GND Ground
5 PB0 (ADC0) GPIO, ADC input channel 0, PWM output, or SPI SCK
6 PB1 (ADC1) GPIO, ADC input channel 1, PWM output
7 PB2 (ADC4) GPIO, ADC input channel 4, or I²C SDA
8 VCC Power supply (2.7V - 5.5V)

Usage Instructions

The ATTiny85 is a versatile microcontroller that can be programmed using the Arduino IDE or other AVR programming tools. Below are the steps to use the ATTiny85 in a circuit:

Programming the ATTiny85

  1. Setup the Arduino IDE:

    • Install the ATTiny85 board package in the Arduino IDE by adding the following URL to the "Additional Board Manager URLs" in the preferences:
      https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
    • Go to "Tools > Board > Boards Manager" and install the "ATTinyCore" package.
  2. Connect the ATTiny85 to a Programmer:

    • Use an Arduino UNO as an ISP (In-System Programmer) or a dedicated USB programmer.
    • Connect the pins as follows:
      Arduino UNO Pin ATTiny85 Pin
      10 (RESET) Pin 1 (RESET)
      11 (MOSI) Pin 2 (PB3)
      12 (MISO) Pin 3 (PB4)
      13 (SCK) Pin 5 (PB0)
      GND Pin 4 (GND)
      5V Pin 8 (VCC)
  3. Select the Board and Programmer:

    • In the Arduino IDE, go to "Tools > Board" and select "ATTiny85".
    • Set the clock speed (e.g., 8 MHz internal oscillator).
    • Choose the programmer (e.g., "Arduino as ISP").
  4. Upload Code:

    • Write your code in the Arduino IDE and upload it to the ATTiny85 using "Sketch > Upload Using Programmer".

Example Code: Blinking an LED

The following example demonstrates how to blink an LED connected to Pin 0 (PB0) of the ATTiny85:

// Blink an LED on ATTiny85 Pin 0 (PB0)

#define LED_PIN 0  // Define the LED pin (PB0)

void setup() {
  pinMode(LED_PIN, OUTPUT);  // Set the LED pin as an output
}

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

  • Power Supply: Ensure the ATTiny85 is powered within its operating voltage range (2.7V - 5.5V).
  • Clock Source: By default, the ATTiny85 uses an 8 MHz internal oscillator. For higher speeds, an external crystal or resonator is required.
  • Pull-Up Resistors: If using the RESET pin as a GPIO, disable the reset functionality in the fuse settings and use a pull-up resistor.

Troubleshooting and FAQs

Common Issues

  1. Problem: The ATTiny85 is not detected by the programmer.
    Solution:

    • Check the wiring between the programmer and the ATTiny85.
    • Ensure the correct board and programmer are selected in the Arduino IDE.
    • Verify that the ATTiny85 is powered correctly.
  2. Problem: The uploaded code does not run as expected.
    Solution:

    • Double-check the pin assignments in your code.
    • Ensure the correct clock speed is selected in the Arduino IDE.
  3. Problem: The LED does not blink in the example code.
    Solution:

    • Verify that the LED is connected to the correct pin (PB0).
    • Check the polarity of the LED and the resistor value (e.g., 220Ω).

FAQs

  • Can I use the ATTiny85 with I²C sensors?
    Yes, the ATTiny85 supports I²C communication using the USI (Universal Serial Interface). Libraries like TinyWire can simplify I²C communication.

  • How do I reset the ATTiny85 to factory settings?
    Use a high-voltage programmer to reset the fuse bits to their default values.

  • Can I use the ATTiny85 for battery-powered projects?
    Yes, the ATTiny85 is ideal for low-power applications. Use sleep modes to conserve power when the microcontroller is idle.