The ATtiny85 is the Swiss Army knife of tiny microcontrollers — just 8 pins, 8 KB of flash, and a footprint smaller than your thumbnail, yet capable of running Arduino code. For ATtiny85 projects with Arduino, this chip is ideal when an Arduino Uno is simply too big, too expensive, or too power-hungry. From wearable LEDs to miniature sensor nodes, the ATtiny85 proves that great things come in small packages.
Table of Contents
- What Is the ATtiny85?
- Programming ATtiny85 with Arduino IDE
- Project 1: USB NeoPixel Controller
- Project 2: Wearable Temperature Logger
- Project 3: Miniature Plant Watering Timer
- Project 4: IR Remote Tester
- Project 5: Tiny Game Console
- Tips and Limitations
- Frequently Asked Questions
- Conclusion
What Is the ATtiny85?
The ATtiny85 is an 8-bit AVR microcontroller from Microchip (formerly Atmel) — the same AVR family as the ATmega328P used in Arduino Uno. Here are its key specifications:
- Flash: 8 KB (enough for simple to moderate programs)
- SRAM: 512 bytes
- EEPROM: 512 bytes
- Clock: Up to 20 MHz (internal 8 MHz oscillator, no crystal needed)
- GPIO Pins: 6 (5 usable when using reset pin normally)
- ADC: 4 channels, 10-bit resolution
- PWM: 2 channels
- Interfaces: I2C (USI), SPI (USI)
- Operating Voltage: 2.7V – 5.5V
- Package: 8-pin DIP or SOIC
- Price: ₹30-60 per chip in India
The beauty of the ATtiny85 is its simplicity. With only 8 pins (VCC, GND, RESET, and 5 I/O), there are fewer decisions to make, less wiring to do, and the entire circuit can fit in remarkably small enclosures.
Programming ATtiny85 with Arduino IDE
Programming the ATtiny85 is straightforward using an Arduino Uno as an ISP (In-System Programmer). Here is the step-by-step process:
Step 1: Set Up Arduino as ISP
Open Arduino IDE, load the “ArduinoISP” example sketch (File > Examples > 11.ArduinoISP), and upload it to your Arduino Uno.
Step 2: Install ATtiny Board Support
In Arduino IDE preferences, add this URL to “Additional Boards Manager URLs”:
https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
Then install “attiny” from the Board Manager.
Step 3: Wire the ATtiny85 to Arduino
Arduino Uno -> ATtiny85
Pin 10 -> Pin 1 (RESET)
Pin 11 (MOSI) -> Pin 5 (PB0/MOSI)
Pin 12 (MISO) -> Pin 6 (PB1/MISO)
Pin 13 (SCK) -> Pin 7 (PB2/SCK)
5V -> Pin 8 (VCC)
GND -> Pin 4 (GND)
Add a 10uF capacitor between Arduino RESET and GND
to prevent auto-reset during programming.
Step 4: Program
Select Board: “ATtiny25/45/85”, Processor: “ATtiny85”, Clock: “Internal 8 MHz”, Programmer: “Arduino as ISP”. First burn the bootloader (Tools > Burn Bootloader), then upload your sketch using Sketch > Upload Using Programmer (or Ctrl+Shift+U).
Project 1: USB NeoPixel Controller
Using a Digispark-compatible ATtiny85 USB board (which includes a USB bootloader), you can control a strip of WS2812B NeoPixels directly from a computer.
// ATtiny85 NeoPixel Rainbow
#include
#define PIN 1 // PB1
#define NUM_LEDS 12 // Number of NeoPixels
Adafruit_NeoPixel strip(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin();
strip.setBrightness(50);
}
void loop() {
rainbowCycle(20);
}
void rainbowCycle(uint8_t wait) {
for (uint16_t j = 0; j < 256; j++) {
for (uint16_t i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, wheel(((i * 256 / strip.numPixels()) + j) & 255));
}
strip.show();
delay(wait);
}
}
uint32_t wheel(byte pos) {
pos = 255 - pos;
if (pos < 85) return strip.Color(255 - pos * 3, 0, pos * 3);
if (pos < 170) { pos -= 85; return strip.Color(0, pos * 3, 255 - pos * 3); }
pos -= 170;
return strip.Color(pos * 3, 255 - pos * 3, 0);
}
This entire project — controller, LED strip connection, and power — fits into a space barely larger than a coin. Perfect for wearable fashion tech, bike lights, or decorative lighting.
Project 2: Wearable Temperature Logger
Build a tiny temperature logger using ATtiny85 and a DS18B20 sensor that stores readings to EEPROM:
// ATtiny85 Temperature Logger
#include
#include
#define DS18B20_PIN 3 // PB3
#define LED_PIN 4 // PB4
OneWire ds(DS18B20_PIN);
int eepromAddress = 0;
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop() {
float temp = readTemperature();
// Store temperature as integer (x10 for one decimal)
if (eepromAddress < 510) {
int tempInt = (int)(temp * 10);
EEPROM.write(eepromAddress, highByte(tempInt));
EEPROM.write(eepromAddress + 1, lowByte(tempInt));
eepromAddress += 2;
// Blink LED to confirm logging
digitalWrite(LED_PIN, HIGH);
delay(100);
digitalWrite(LED_PIN, LOW);
}
// Log every 5 minutes
for (int i = 0; i < 300; i++) {
delay(1000); // Sleep would be better for battery life
}
}
float readTemperature() {
byte data[9];
ds.reset();
ds.write(0xCC); // Skip ROM
ds.write(0x44); // Start conversion
delay(750);
ds.reset();
ds.write(0xCC);
ds.write(0xBE); // Read scratchpad
for (int i = 0; i < 9; i++) data[i] = ds.read();
int16_t raw = (data[1] << 8) | data[0];
return (float)raw / 16.0;
}
With 512 bytes of EEPROM, you can store 256 temperature readings — over 21 hours of data at 5-minute intervals. Retrieve the data later by reading the EEPROM via an Arduino Uno.
Project 3: Miniature Plant Watering Timer
A simple timer that activates a water pump at set intervals. Uses the ATtiny85’s internal watchdog timer for low-power operation:
// ATtiny85 Plant Watering Timer
#include
#include
#define PUMP_PIN 1 // PB1 (drives MOSFET gate)
#define WATER_TIME 5 // Seconds to run pump
#define INTERVAL 43200 // Seconds between watering (12 hours)
volatile int wdtCounter = 0;
ISR(WDT_vect) {
wdtCounter++;
}
void setup() {
pinMode(PUMP_PIN, OUTPUT);
digitalWrite(PUMP_PIN, LOW);
// Water once on startup
waterPlant();
setupWatchdog();
}
void loop() {
// Each WDT cycle is ~8 seconds
// 43200 / 8 = 5400 cycles for 12 hours
if (wdtCounter >= 5400) {
wdtCounter = 0;
waterPlant();
}
enterSleep();
}
void waterPlant() {
digitalWrite(PUMP_PIN, HIGH);
delay(WATER_TIME * 1000);
digitalWrite(PUMP_PIN, LOW);
}
void setupWatchdog() {
MCUSR &= ~(1 << WDRF);
WDTCR |= (1 << WDCE) | (1 << WDE);
WDTCR = (1 << WDIE) | (1 << WDP3) | (1 << WDP0); // 8 sec
}
void enterSleep() {
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
sleep_mode();
sleep_disable();
}
In deep sleep mode, the ATtiny85 draws only ~4 uA. A single CR2032 coin cell (225 mAh) can power this circuit for over 6 years of sleep time, with the pump powered separately through a MOSFET.
Project 4: IR Remote Tester
A pocket-sized device that receives IR signals and blinks an LED to confirm your remote control is working. Uses just the ATtiny85, an IR receiver (TSOP1738), and an LED:
// ATtiny85 IR Remote Tester
#define IR_PIN 2 // PB2 (IR receiver output)
#define LED_PIN 1 // PB1
void setup() {
pinMode(IR_PIN, INPUT);
pinMode(LED_PIN, OUTPUT);
}
void loop() {
// IR receiver output goes LOW when signal detected
if (digitalRead(IR_PIN) == LOW) {
digitalWrite(LED_PIN, HIGH);
delay(100);
digitalWrite(LED_PIN, LOW);
delay(50);
}
}
Total cost: under ₹100. Total size: fits inside a 35mm film canister. This is a practical tool that every electronics workbench should have.
Project 5: Tiny Game Console
Using an ATtiny85 and a 128×64 SSD1306 OLED display (I2C), you can build a tiny game console with two buttons. Games like Snake, Pong, and Tetris have been successfully implemented in 8 KB of flash.
The trick is using the TinyWireM library for I2C communication and the Tiny4kOLED library for display output. These libraries are optimised for ATtiny’s limited resources.
// ATtiny85 Tiny Snake Game (simplified)
#include
#include
#define BTN_LEFT 3
#define BTN_RIGHT 4
void setup() {
oled.begin(128, 64, sizeof(tiny4koled_init_128x64br), tiny4koled_init_128x64br);
oled.clear();
oled.on();
pinMode(BTN_LEFT, INPUT_PULLUP);
pinMode(BTN_RIGHT, INPUT_PULLUP);
}
void loop() {
// Game logic here
// Use only 2 buttons: left turn and right turn
// Snake moves continuously, buttons change direction
// Entire game fits in <4KB of flash
}
Tips and Limitations
Limitations to Be Aware Of
- No hardware UART: Use SoftwareSerial if you need serial communication, but it uses significant flash and RAM.
- Limited pins: Only 5 usable I/O pins (6 if you disable RESET, but then you cannot reprogram without a high-voltage programmer).
- Small memory: 8 KB flash fills up quickly, especially with libraries. Avoid heavy libraries when possible.
- Limited debugging: No serial monitor by default. Use an LED for status indication or SoftwareSerial for output.
Power-Saving Tips
- Use the watchdog timer for periodic wake-up instead of delay loops
- Disable ADC when not in use (
ADCSRA &= ~(1 << ADEN);) - Run at 1 MHz instead of 8 MHz when speed is not critical
- Use POWER_DOWN sleep mode for minimum current draw (~4 uA)
When to Use ATtiny85 vs Arduino Nano
Use ATtiny85 when: space is critical, power consumption matters, cost per unit matters (production), or the project needs fewer than 6 I/O pins. Use Arduino Nano when: you need more pins, serial debugging, more memory, or faster development time.
Frequently Asked Questions
Where can I buy ATtiny85 chips in India?
ATtiny85 DIP-8 chips are available from electronics component stores across India for ₹30-60 each. Digispark-compatible USB development boards (which include an ATtiny85 and USB connector) cost ₹100-200 and are more convenient for getting started.
Can ATtiny85 use Arduino libraries?
Many Arduino libraries work on ATtiny85, but not all. Libraries that depend on hardware UART, multiple timers, or large memory will not work. Always check library compatibility before starting a project. Libraries with “Tiny” variants (like TinyWireM, SoftwareSerial) are specifically designed for ATtiny chips.
What is the difference between ATtiny85 and ATtiny85V?
The ATtiny85V is the low-voltage version that operates from 1.8V (vs 2.7V for standard). It runs at a maximum of 10 MHz instead of 20 MHz. The V variant is better for battery-powered projects using coin cells.
Can I use WiFi or Bluetooth with ATtiny85?
Directly, no. The ATtiny85 lacks the memory and processing power for WiFi/Bluetooth stacks. However, you can interface it with an ESP-01 module via SoftwareSerial for WiFi connectivity, though an ESP32 or ESP8266 would be a better choice for wireless projects.
Conclusion
The ATtiny85 is proof that you do not always need a powerful microcontroller. For space-constrained, battery-powered, or cost-sensitive projects, this tiny 8-pin chip delivers more than enough capability. From wearable gadgets to automated plant care, the ATtiny85 handles simple tasks with minimal power and minimal cost.
Start by programming an ATtiny85 using your Arduino Uno as an ISP programmer, then graduate to standalone circuits. The skills you develop — efficient coding, power management, working within constraints — will make you a better embedded developer regardless of the platform you use next.
Find all the components you need at Zbotic’s online store and start building your next miniature project today.
Add comment