If you are searching for a Digispark ATtiny85 guide, you have probably already been amazed by how much computing power can be crammed onto a board barely larger than a USB plug. The Digispark is an ATtiny85-based microcontroller development board that brings Arduino-compatible programming to one of the smallest form factors available to hobbyists. Despite its minuscule size, it packs enough punch to handle a wide variety of real-world tasks — from automating keystrokes to controlling LEDs and reading sensors — making it a favourite among makers, hardware hackers, and space-constrained IoT builders across India and worldwide.
Table of Contents
- What Is the Digispark ATtiny85?
- Hardware Specifications and Pinout
- Setting Up Arduino IDE for Digispark
- Writing and Uploading Your First Sketch
- USB HID: Keyboard and Mouse Emulation
- Power Saving and Sleep Modes
- Practical Project Ideas
- Frequently Asked Questions
What Is the Digispark ATtiny85?
The Digispark is an open-source microcontroller board originally designed by Digistump, built around the Microchip ATtiny85 8-bit AVR microcontroller. Unlike a full Arduino Uno or Nano, it has no dedicated USB-to-serial chip. Instead, it uses the V-USB software USB library burned into the ATtiny85 itself, allowing it to enumerate as a USB device directly.
This approach keeps the board incredibly small — measuring roughly 25 mm × 18 mm — and inexpensive. The trade-off is a reduced flash size (8 KB, of which about 2 KB is consumed by the bootloader), only 512 bytes of SRAM, and six I/O pins, two of which are shared with the USB data lines. For the right project, however, these constraints are irrelevant, and the board delivers outstanding value.
The Digispark is particularly popular in India for automation scripts, small sensor nodes, wearable electronics, and USB HID gadgets because it can be hidden almost anywhere and powered directly from a USB port.
Hardware Specifications and Pinout
Understanding the hardware before writing a single line of code is essential. Here is a quick reference for the Digispark ATtiny85:
- Microcontroller: ATtiny85 (8-bit AVR, Atmel/Microchip)
- Clock Speed: 16.5 MHz (internal oscillator, PLL-boosted)
- Flash Memory: 8 KB (approximately 6 KB usable after bootloader)
- SRAM: 512 bytes
- EEPROM: 512 bytes
- Operating Voltage: 5 V (USB-powered) or 5 V via VIN pin
- I/O Pins: 6 total (P0–P5)
- PWM Pins: P0, P1 (hardware), P4 (Timer1)
- ADC Pins: P2 (A1), P3 (A3), P4 (A2), P5 (A0)
- I2C: P0 (SDA), P2 (SCK) — using TinyWireM library
- SPI: P0 (MOSI), P1 (MISO), P2 (SCK)
- USB: P3 (D–), P4 (D+) — shared with GPIO
- Onboard LED: P1
- Reset Pin: P5 (also used as ADC0, weakly pulled up)
A critical detail: P3 and P4 are connected to the USB data lines. You can use them as GPIO only when USB communication is not active (e.g., in non-HID sketches where the USB enumeration completes at boot and then goes idle). Avoid driving these pins with strong currents while USB is connected.
Pin P5 is the reset pin. It can be repurposed as a GPIO or ADC input by disabling the reset function via a fuse bit, but doing so will permanently prevent future ISP programming — only HV (High Voltage) programming can recover such a device.
Setting Up Arduino IDE for Digispark
The Digispark does not appear in the default Arduino IDE board manager. You need to add Digistump’s board support package manually. Follow these steps:
- Open Arduino IDE (version 1.8.x recommended; IDE 2.x also works).
- Go to File → Preferences.
- In the “Additional Boards Manager URLs” field, add:
https://raw.githubusercontent.com/digistump/arduino-boards-index/master/package_digistump_index.json - Click OK, then open Tools → Board → Boards Manager.
- Search for “Digistump” and install Digistump AVR Boards.
- Select Tools → Board → Digispark (Default — 16.5 mhz).
Driver Installation (Windows): On Windows, you must install the Digispark USB drivers separately. Download the Digistump Drivers package, run Install Drivers.exe, and follow the prompts. Windows 10 and 11 users may need to disable driver signature enforcement temporarily.
Linux and macOS: No additional drivers are required. However, on Linux you may need to add a udev rule to allow non-root access to the USB device. Add the following line to /etc/udev/rules.d/49-digispark.rules:SUBSYSTEMS=="usb", ATTRS{idVendor}=="16d0", ATTRS{idProduct}=="0753", MODE:="0666"
Writing and Uploading Your First Sketch
The Digispark bootloader uses a unique upload mechanism: you upload the sketch first, then plug in the board. The process is:
- Write your sketch and click Upload in the Arduino IDE.
- When the IDE says “Plug in device now… “, connect the Digispark via USB.
- The bootloader listens for upload traffic for about 5 seconds on power-up, then launches your sketch.
Here is the classic Blink sketch adapted for the Digispark’s onboard LED on P1:
void setup() {
pinMode(1, OUTPUT);
}
void loop() {
digitalWrite(1, HIGH);
delay(1000);
digitalWrite(1, LOW);
delay(1000);
}
One important difference from standard Arduino: the delay() function works normally, but interrupts are used by the USB stack. If your sketch does anything timing-critical in the millisecond range, be aware of the 1.5 ms USB interrupt overhead that occurs periodically when USB is active.
The 6 KB of usable flash goes surprisingly far. Well-optimised code can run I2C sensors, drive small OLED displays, and handle serial communication — just be disciplined with library choices and avoid String objects.
USB HID: Keyboard and Mouse Emulation
The Digispark’s most powerful and distinctive feature is its ability to act as a USB Human Interface Device (HID) — specifically as a keyboard and/or mouse. This is enabled by the DigiKeyboard and DigiMouse libraries that ship with the Digistump board package.
The DigiKeyboard library allows the Digispark to send keystrokes to any computer as if it were a real keyboard — no drivers needed on the host side because it uses the standard USB HID protocol. This opens up a world of automation possibilities:
- Auto-typing credentials or text templates
- Launching applications with keyboard shortcuts
- Sending USB wake-up signals to sleeping computers
- Building custom macro keypads (combined with tactile switches)
- Rubber Ducky-style automation scripts (for legitimate pen testing and IT automation)
Here is a basic DigiKeyboard example that opens a browser and types a URL:
#include "DigiKeyboard.h"
void setup() {
DigiKeyboard.sendKeyStroke(0); // Wake up USB
DigiKeyboard.delay(2000); // Wait for OS to recognise device
DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT); // Win + R (Run dialog)
DigiKeyboard.delay(500);
DigiKeyboard.println("chrome https://zbotic.in");
DigiKeyboard.sendKeyStroke(KEY_ENTER);
}
void loop() {}
A few important notes on HID usage:
- Always add
DigiKeyboard.delay()calls between keystrokes to give the OS time to react. - The
sendKeyStroke(0)call at the start ensures the USB connection is properly initialised before sending any keystrokes. - Some antivirus software flags HID injection devices — this is expected for security reasons.
- Language layouts matter: the DigiKeyboard library sends USB HID keycodes, not characters. What you type in the sketch maps to the host’s active keyboard layout. A sketch that types “Hello” on a US layout will produce wrong characters on an Indian INSCRIPT layout.
Power Saving and Sleep Modes
The ATtiny85 is already frugal on power — it runs at about 5–10 mA during normal operation at 16.5 MHz from USB. But for battery-powered applications using an external 3.3 V or 5 V supply, you can dramatically reduce consumption using the AVR’s built-in sleep modes.
The avr/sleep.h and avr/power.h headers give you direct access to power management. The deepest sleep mode (SLEEP_MODE_PWR_DOWN) can bring current consumption down to under 1 µA, with wake-up triggered by watchdog timer or external interrupt.
#include <avr/sleep.h>
#include <avr/interrupt.h>
ISR(WDT_vect) { /* watchdog fires — just wake up */ }
void setup() {
// Configure watchdog for 8-second timeout
WDTCR = (1 << WDPE) | (1 << WDE) | (1 << WDP3) | (1 << WDP0);
WDTCR = (1 << WDIE) | (1 << WDP3) | (1 << WDP0);
sei();
}
void loop() {
// Do work here
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
sleep_cpu();
sleep_disable();
}
Note that USB communication is not possible while the ATtiny85 is in deep sleep — the V-USB stack requires the processor to be running. For battery-powered projects that do not need USB HID, remove USB enumeration by using the Digispark firmware without the USB stack, freeing up even more flash space.
Practical Project Ideas
Here are some well-suited project ideas that take advantage of the Digispark’s unique capabilities:
1. USB Password Typer
Store a password in EEPROM and type it when a button on P0 is pressed. The Digispark appears as a keyboard to the host OS, so no software installation is required on the computer side. Useful for logging into shared lab computers without leaving password text files around.
2. Capacitive Touch RGB LED
Use the ATtiny85’s internal ADC with a high-impedance resistor to build a simple capacitive touch sensor on one pin, and drive an RGB LED on the remaining pins. The compact size means the whole circuit fits under a translucent resin dome.
3. I2C Temperature Logger
Connect a DHT20 or DS18B20 sensor and store readings in EEPROM, then dump them over USB when plugged into a computer. The ATtiny85 has enough EEPROM for hundreds of readings at 4-byte resolution.
4. USB Rubber Ducky Replacement
Security researchers and IT administrators use HID injection devices for automated testing. The Digispark can replicate much of the Rubber Ducky’s functionality at a fraction of the cost, using the DigiKeyboard library with DuckyScript-inspired logic written in Arduino C.
5. Wearable Step Counter
Combine the Digispark with a small accelerometer over I2C to build a wrist-worn step counter. The tiny board fits inside a watch case or wristband. Results can be displayed on a small I2C OLED or sent to a computer via USB HID keyboard emulation (typing the step count into a text field).
Frequently Asked Questions
Can the Digispark ATtiny85 run the full Arduino library?
No. Many standard Arduino libraries are incompatible with the ATtiny85 because they rely on hardware that the ATtiny85 lacks — such as hardware UART, multiple hardware timers, or more than 512 bytes of SRAM. You need to use ATtiny-specific libraries like TinyWireM for I2C, TinySoftwareSerial for UART, and DigiKeyboard for USB HID. Always check library compatibility before starting a project.
Why does my Digispark not get detected by the computer?
The most common causes are: missing or outdated USB drivers on Windows, a USB cable that carries power only (no data lines), plugging in the board before the IDE is ready to upload, or a damaged V-USB bootloader. Try a different cable first, then reinstall drivers. On Linux, check dmesg output after plugging in to see if the OS detects any USB device at all.
How do I program the Digispark without the bootloader?
You can use an ISP programmer (such as another Arduino running ArduinoISP) connected to the ICSP pads on the Digispark. This bypasses the bootloader entirely and gives you the full 8 KB of flash. You lose USB programming convenience but gain the extra 2 KB and can set fuse bits freely.
Is the Digispark ATtiny85 suitable for production use?
For low-volume production of simple gadgets, yes. However, the V-USB software USB stack is not certified to the full USB specification and may behave unexpectedly on some computers or USB hubs. For critical or high-volume production, consider a proper USB microcontroller like the ATmega32U4 (used in the Arduino Leonardo) or a dedicated USB bridge chip.
Can I use the Digispark with 3.3 V sensors?
The ATtiny85 on a standard Digispark board runs at 5 V. Connecting 3.3 V-only sensors directly risks damaging them. Use a level shifter for I/O lines, or use the 3.3 V version of the Digispark Pro which includes an onboard 3.3 V regulator. Alternatively, power the board from 3.3 V and bypass the onboard regulator — but check that the ATtiny85 specifications allow operation at 16.5 MHz at 3.3 V (they do not; drop to 8 MHz for reliable 3.3 V operation).
The Digispark ATtiny85 is proof that powerful electronics do not need to be large. Whether you are building a tiny USB gadget, a hidden sensor node, or a wearable prototype, this board offers an unbeatable combination of size, cost, and capability. Explore the full range of Arduino-compatible boards and accessories at zbotic.in’s Arduino & Microcontrollers category and find the right board for your next project.
Add comment