Inquire: Call 0086-755-23203480, or reach out via the form below/your sales contact to discuss our design, manufacturing, and assembly capabilities.
Quote: Email your PCB files to Sales@pcbsync.com (Preferred for large files) or submit online. We will contact you promptly. Please ensure your email is correct.
Notes: For PCB fabrication, we require PCB design file in Gerber RS-274X format (most preferred), *.PCB/DDB (Protel, inform your program version) format or *.BRD (Eagle) format. For PCB assembly, we require PCB design file in above mentioned format, drilling file and BOM. Click to download BOM template To avoid file missing, please include all files into one folder and compress it into .zip or .rar format.
The ATtiny85 changed how I think about embedded projects. When you realize that an 8-pin chip costing less than $2 can run Arduino code and fit almost anywhere, design possibilities explode. After years of cramming Arduino Unos into projects where space was precious, discovering ATtiny85 Arduino programming felt like finding a secret weapon for compact designs.
This guide covers everything you need to know about programming the ATtiny85 with Arduino IDE, from initial setup to advanced techniques that squeeze maximum capability from this tiny microcontroller.
What is the ATtiny85 Microcontroller
The ATtiny85 is an 8-bit AVR RISC-based microcontroller from Microchip (formerly Atmel). Despite its small 8-pin package, it packs impressive features that make it suitable for standalone embedded applications. The chip achieves throughputs approaching 1 MIPS per MHz, executing powerful instructions in single clock cycles.
What makes ATtiny85 Arduino programming particularly appealing is the combination of Arduino IDE compatibility and minimal external component requirements. You can run the same familiar Arduino functions on a chip small enough to hide inside a bottle cap.
The “85” in ATtiny85 indicates 8KB of flash memory, which may sound limiting compared to the ATmega328P’s 32KB. However, for focused applications like LED control, sensor monitoring, or simple automation tasks, 8KB provides plenty of program space.
ATtiny85 Technical Specifications
Understanding the specifications helps you determine what’s achievable with ATtiny85 Arduino programming.
ATtiny85 Core Specifications Table
Specification
Value
Architecture
8-bit AVR RISC
Flash Memory
8 KB
SRAM
512 bytes
EEPROM
512 bytes
Clock Speed
Up to 20 MHz (8 MHz internal)
Operating Voltage
2.7V – 5.5V
GPIO Pins
6 (5 usable, 1 reset)
ADC Channels
4 (10-bit resolution)
PWM Channels
4
Timers
2 (8-bit)
Communication
USI (I2C/SPI capable)
Package Options
8-pin PDIP, SOIC, QFN
The ATtiny85 operates reliably from 2.7V to 5.5V at full speed, making it ideal for battery-powered projects. At lower voltages (1.8V-2.7V), the chip runs at reduced clock speeds but consumes remarkably little power.
ATtiny85 Pinout for Arduino Programming
With only 8 pins total, every connection matters. Understanding the ATtiny85 pinout is essential for successful Arduino programming.
ATtiny85 Pin Functions Table
Physical Pin
Port
Arduino Pin
Functions
1
PB5
5 (Reset)
Reset, ADC0, PCINT5
2
PB3
3
ADC3, PCINT3, XTAL1, OC1B
3
PB4
4
ADC2, PCINT4, XTAL2, OC1B
4
–
–
GND
5
PB0
0
MOSI, SDA, PCINT0, OC0A, AIN0
6
PB1
1
MISO, OC0B, OC1A, PCINT1, AIN1
7
PB2
2
SCK, SCL, ADC1, PCINT2, T0, INT0
8
–
–
VCC
The most critical thing to understand: Arduino pin numbers in your code don’t match physical pin numbers. When you write digitalWrite(0, HIGH), you’re controlling physical pin 5 (PB0). This trips up nearly everyone starting with ATtiny85 Arduino programming.
Pin 1 (PB5) serves as the reset pin by default. You can reprogram it as a general I/O pin, gaining a sixth GPIO, but doing so disables the standard programming interface. Once disabled, you’ll need a high-voltage programmer to restore normal functionality.
Setting Up Arduino IDE for ATtiny85 Programming
Before writing any code, you need to configure Arduino IDE to recognize the ATtiny85. This involves installing a board support package that provides the necessary definitions and tools.
Installing ATtiny Board Support
Step 1: Open Arduino IDE and navigate to File → Preferences
Step 2: In the “Additional Boards Manager URLs” field, add one of these URLs:
For ATtinyCore by Spence Konde (recommended):
http://drazzy.com/package_drazzy.com_index.json
For ATtiny by David Mellis (simpler, fewer options):
Step 5: Search for “attiny” and install your chosen package
Step 6: After installation, you’ll find ATtiny options under Tools → Board
ATtiny Core Options Comparison
Feature
ATtinyCore (Spence Konde)
ATtiny (David Mellis)
Clock Options
Many (1-20 MHz)
Limited (1, 8 MHz)
PWM Support
Enhanced
Basic
Millis/Micros
Configurable
Fixed
Library Support
Extensive
Basic
Bootloader Options
Multiple
Standard
Complexity
More options
Simpler
I recommend ATtinyCore for most projects due to its flexibility, but the Mellis core works fine for basic applications.
Programming ATtiny85 Using Arduino as ISP
The ATtiny85 lacks a USB interface, so you can’t program it directly like an Arduino Uno. Instead, you’ll use an Arduino as an In-System Programmer (ISP) to upload code.
Required Components
Component
Quantity
Purpose
Arduino Uno/Nano
1
ISP Programmer
ATtiny85
1
Target microcontroller
10µF Capacitor
1
Prevent Arduino reset
Breadboard
1
Circuit assembly
Jumper Wires
6
Connections
Wiring Connections Table
Arduino Pin
ATtiny85 Pin
Function
5V
Pin 8 (VCC)
Power
GND
Pin 4 (GND)
Ground
Pin 10
Pin 1 (Reset)
Reset control
Pin 11
Pin 5 (PB0/MOSI)
Data out
Pin 12
Pin 6 (PB1/MISO)
Data in
Pin 13
Pin 7 (PB2/SCK)
Clock
Step-by-Step Programming Process
Step 1: Upload ArduinoISP sketch to your Arduino
Connect Arduino to computer
Open File → Examples → 11.ArduinoISP → ArduinoISP
Upload to your Arduino
Step 2: Wire the ATtiny85 to Arduino according to the table above
Step 3: Add the 10µF capacitor between Arduino’s RESET and GND pins (positive to RESET). This prevents the Arduino from resetting during programming.
Step 4: Configure Arduino IDE
Tools → Board → ATtiny25/45/85
Tools → Processor → ATtiny85
Tools → Clock → Internal 8 MHz (or your preference)
Tools → Programmer → Arduino as ISP
Step 5: Burn the bootloader
Tools → Burn Bootloader
This sets the fuse bits for your selected clock configuration
Step 6: Upload your sketch
Write or open your code
Sketch → Upload Using Programmer (not the regular Upload button!)
The “Upload Using Programmer” step catches many beginners. Using the regular Upload button won’t work because there’s no bootloader running on the ATtiny85 to receive serial data.
ATtiny85 Arduino Programming Clock Configuration
Clock speed affects timing functions, power consumption, and maximum operating frequency. The ATtiny85 offers flexible clock options.
Clock Options Table
Clock Source
Frequency
External Parts
Accuracy
Best For
Internal RC
8 MHz
None
±10%
General use
Internal RC
1 MHz
None
±10%
Low power
Internal PLL
16 MHz
None
±10%
Maximum speed
External Crystal
8-20 MHz
Crystal + caps
±0.005%
Precise timing
The internal 8 MHz oscillator requires no external components and works well for most ATtiny85 Arduino programming projects. Timing-sensitive applications like serial communication may benefit from the accuracy of an external crystal.
When you burn the bootloader, the fuse bits are configured for your selected clock. Changing clock settings requires re-burning the bootloader—simply changing the menu selection isn’t enough.
Writing Your First ATtiny85 Arduino Program
Let’s create a simple LED blink sketch to verify your ATtiny85 Arduino programming setup works correctly.
Basic Blink Code
// ATtiny85 LED Blink
// Connect LED (with resistor) to physical pin 5 (Arduino pin 0)
Connect an LED with a 220-330Ω current-limiting resistor between pin 0 (physical pin 5) and ground. After successful upload, the LED should blink at 1Hz.
If the LED blinks much slower or faster than expected, you likely have a clock configuration mismatch. Re-burn the bootloader with the correct clock setting.
ATtiny85 Arduino Programming Limitations
Understanding limitations helps you work around them effectively.
Memory Constraints
With only 8KB flash and 512 bytes SRAM, large libraries often won’t fit. The standard Serial library, for example, consumes significant resources. Use lightweight alternatives:
Standard Library
ATtiny85 Alternative
Serial
SoftwareSerial (limited), TinyDebugSerial
Wire (I2C)
TinyWireM, TinyWireS
Servo
SoftwareServo, ATTinyServo
SPI
USI-based implementations
Pin Limitations
Six GPIO pins (five if keeping reset function) require creative solutions for complex projects. Techniques include:
Charlieplexing: Drive many LEDs from few pins by exploiting tri-state behavior. With 5 pins, you can control up to 20 LEDs individually.
Multiplexing: Share pins between inputs and outputs that don’t need simultaneous access.
I2C Expansion: Add port expanders like the PCF8574 to gain additional I/O.
No Hardware Serial
The ATtiny85 lacks a hardware UART. Software serial implementations work but consume processor cycles and can be timing-sensitive. For debugging, consider using a single LED or the USI peripheral.
Advanced ATtiny85 Arduino Programming Techniques
Once you’ve mastered basics, these techniques unlock more capability from the tiny chip.
Using PWM for Analog Output
The ATtiny85 provides four PWM channels, but Arduino’s analogWrite() only works on certain pins depending on your core. With ATtinyCore:
// PWM on pin 0 (physical pin 5)
analogWrite(0, 128); // 50% duty cycle
// PWM on pin 1 (physical pin 6)
analogWrite(1, 64); // 25% duty cycle
Reading Analog Inputs
Four ADC channels provide 10-bit resolution:
int sensorValue = analogRead(A1); // Read from ADC1 (physical pin 7)
int anotherValue = analogRead(A2); // Read from ADC2 (physical pin 3)
Power-Saving Sleep Modes
For battery-powered projects, sleep modes dramatically extend battery life:
#include <avr/sleep.h>
#include <avr/interrupt.h>
void enterSleep() {
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
sleep_cpu();
// Execution continues here after wake
sleep_disable();
}
In power-down mode, the ATtiny85 draws only 0.1µA—enabling years of operation from a coin cell battery for interrupt-driven applications.
ATtiny85 Arduino Programming Project Ideas
The ATtiny85’s compact size and low power consumption make it perfect for specific applications.
Ideal ATtiny85 Projects
Project Type
Complexity
Key Features Used
LED Jewelry
Beginner
PWM, sleep modes
USB Devices (Digispark)
Intermediate
V-USB library
Sensor Nodes
Intermediate
ADC, I2C, sleep
Motor Controllers
Intermediate
PWM, interrupts
IR Remote
Beginner
Timer, interrupts
Wearable Gadgets
Advanced
Multiple peripherals
POV Displays
Advanced
Precise timing
The ATtiny85 excels in projects where size constraints matter more than processing power. Wearables, art installations, and distributed sensor networks benefit enormously from its tiny footprint.
Useful ATtiny85 Resources and Downloads
Here are essential resources for ATtiny85 Arduino programming:
Can I use all standard Arduino libraries with ATtiny85?
No, many standard libraries are too large or require hardware the ATtiny85 lacks. Libraries designed for the ATmega328P often assume more memory, specific timers, or hardware UART. However, the community has created ATtiny-specific alternatives for most common functions. Always check library compatibility before starting a project, and look for “tiny” versions of popular libraries.
Why does my ATtiny85 run at the wrong speed after programming?
Clock speed is set by fuse bits, not just the IDE menu selection. Selecting a different clock speed in the IDE only changes what the compiler assumes—it doesn’t change the chip’s actual configuration. You must burn the bootloader (Tools → Burn Bootloader) after changing clock settings to actually reprogram the fuse bits on the chip.
How do I debug code on ATtiny85 without Serial?
Several approaches work for debugging ATtiny85 Arduino programming. The simplest is using an LED to indicate program states—blink patterns can convey significant information. For more sophisticated debugging, use TinyDebugSerial with a USB-to-serial adapter, or implement I2C communication to send debug data to another microcontroller with serial capability.
Can I reprogram an ATtiny85 after disabling the reset pin?
Only with a high-voltage serial programmer (HVSP), which applies 12V to the reset pin to override the fuse settings. Standard ISP programming won’t work once reset is disabled. I recommend avoiding reset pin disabling unless absolutely necessary, as recovery requires specialized equipment most hobbyists don’t own.
What’s the difference between ATtiny85 and ATtiny45/ATtiny25?
These chips are pin-compatible with identical features except for memory capacity. The ATtiny25 has 2KB flash and 128 bytes each of SRAM/EEPROM. The ATtiny45 has 4KB flash and 256 bytes SRAM/EEPROM. The ATtiny85 has 8KB flash and 512 bytes SRAM/EEPROM. Code written for any of them runs on the others if it fits in memory, making the ATtiny25 attractive for cost-sensitive production runs of simple programs.
Troubleshooting Common ATtiny85 Arduino Programming Issues
Even experienced developers encounter issues when starting with ATtiny85 Arduino programming. Here are solutions to the most common problems.
“Device Signature Mismatch” Error
This error occurs when the IDE expects a different chip than what’s connected. Verify your wiring, especially the MOSI, MISO, and SCK connections. Also confirm you’ve selected the correct processor in the Tools menu. A loose jumper wire causes this error frequently.
Sketch Uploads But Doesn’t Run
Usually a clock configuration mismatch. If you programmed with 8 MHz selected but the chip’s fuses are set for 1 MHz, your delays will be eight times longer than expected. Burn the bootloader to synchronize fuse bits with your IDE settings.
Upload Times Out
Check that the 10µF capacitor is installed correctly between the Arduino’s RESET and GND pins. Without it, the Arduino resets during programming attempts. Also verify you’re using “Upload Using Programmer” rather than the standard Upload button.
Erratic Behavior or Random Resets
Add a 0.1µF decoupling capacitor between VCC and GND, as close to the ATtiny85 as possible. Inadequate decoupling causes voltage fluctuations during pin switching that can reset the chip or cause unpredictable behavior.
ATtiny85 vs Other Small Microcontrollers
How does the ATtiny85 compare to alternatives for compact projects?
Feature
ATtiny85
ATtiny84
ATmega328P
ATtiny1614
Pins
8
14
28
14
Flash
8 KB
8 KB
32 KB
16 KB
SRAM
512 B
512 B
2 KB
2 KB
GPIO
6
12
23
12
ADC
4-ch
8-ch
6-ch
10-ch
Price
~$1.50
~$1.80
~$2.50
~$1.20
The ATtiny85 wins on size and simplicity when you need minimal I/O. For projects requiring more pins but still compact size, consider the ATtiny84 or the newer ATtiny1614 which offers more memory at competitive pricing.
Final Thoughts on ATtiny85 Arduino Programming
The ATtiny85 represents a different design philosophy than typical Arduino boards. Rather than providing abundant resources for any project, it offers just enough capability for focused applications in the smallest possible package.
Mastering ATtiny85 Arduino programming teaches efficient coding practices that benefit all embedded development. When you have only 512 bytes of RAM, you think carefully about every variable. When you have six pins, you design clever circuits that maximize utility.
Start with simple LED projects, graduate to sensor reading and PWM control, then tackle more ambitious designs. The constraints that initially seem limiting become creative challenges that produce elegant, efficient solutions. That $2 chip might just become your favorite microcontroller for compact projects.
Inquire: Call 0086-755-23203480, or reach out via the form below/your sales contact to discuss our design, manufacturing, and assembly capabilities.
Quote: Email your PCB files to Sales@pcbsync.com (Preferred for large files) or submit online. We will contact you promptly. Please ensure your email is correct.
Notes: For PCB fabrication, we require PCB design file in Gerber RS-274X format (most preferred), *.PCB/DDB (Protel, inform your program version) format or *.BRD (Eagle) format. For PCB assembly, we require PCB design file in above mentioned format, drilling file and BOM. Click to download BOM template To avoid file missing, please include all files into one folder and compress it into .zip or .rar format.