Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use ATtiny85: Examples, Pinouts, and Specs

Image of ATtiny85Design with ATtiny85 in Cirkit Designer

Introduction

The ATtiny85 is a compact, high-performance microcontroller from Microchip Technology, designed for use in a variety of applications due to its small size and low power consumption. Based on the AVR RISC architecture, it features 8KB of in-system programmable flash memory, making it ideal for simple embedded projects, such as DIY electronics, wearables, and IoT devices.

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 ATtiny85 and OLED Display Based Interactive Game with Buzzer and LED: 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.

Open Project in Cirkit Designer
Image of ATtiny-Controlled LED Blinker Circuit: 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.

Open Project in Cirkit Designer
Image of ATmega328P-Based Sensor Hub with OLED Display and LIDAR: 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.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

Key Technical Details

Pin Configuration and Descriptions

Pin Number Name Description
1 PB5 Reset and programming interface, also serves as I/O pin
2 PB3 Analog input or digital I/O, ADC3
3 PB4 Analog input or digital I/O, ADC2
4 GND Ground pin
5 PB0 Digital I/O, OC0A (PWM output)
6 PB1 Digital I/O, OC0B (PWM output), ADC1
7 PB2 Digital I/O, INT0 (external interrupt), ADC0
8 VCC Positive supply voltage

Usage Instructions

How to Use the ATtiny85 in a Circuit

  1. Powering the ATtiny85:

    • Connect the VCC pin to a power supply within the operating voltage range (2.7V - 5.5V).
    • Connect the GND pin to the ground of the power supply.
  2. Programming the ATtiny85:

    • Use an AVR programmer or an Arduino as an ISP (In-System Programmer) to upload code to the ATtiny85.
    • Ensure the correct pin mapping is used when programming the ATtiny85 with an Arduino.
  3. Connecting I/O Pins:

    • Configure the I/O pins as input or output according to your application needs.
    • Use the PWM pins for analog output applications like dimming LEDs or controlling motor speed.
  4. Using ADC Channels:

    • Connect analog sensors to ADC pins for analog-to-digital conversion.
    • Ensure proper reference voltage is set in your code for accurate readings.

Important Considerations and Best Practices

Troubleshooting and FAQs

Common Issues

Solutions and Tips for Troubleshooting

FAQs

Example Code for Arduino UNO as ISP

#include <avr/sleep.h>
#include <avr/power.h>

void setup() {
  // Set up code here
}

void loop() {
  // Main code here

  // Example: Entering sleep mode to save power
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  sleep_enable();
  power_all_disable(); // Disable all peripherals
  sleep_mode();        // Enter sleep mode

  // The device will wake up here after an interrupt
  power_all_enable();  // Re-enable all peripherals
  sleep_disable();
}

Note: This example demonstrates how to put the ATtiny85 into a power-down sleep mode to conserve energy, which is useful for battery-operated devices. The actual implementation will vary based on the specific application and the required wake-up sources.