How to Install an ATtiny Bootloader With Virtual USB

Pages
Contributors: Shawn Hymel
Favorited Favorite 13

Install Micronucleus

Micronucleus is a bootloader created for ATtiny microcontrollers. It has V-USB built in so that we can send compiled firmware over a virtual USB connection.

When we say "virtual USB," we're actually mimicking low-speed USB with GPIO pins on the ATtiny, since there is no actual USB hardware on the ATtiny84. Essentially, the V-USB library bit-bangs the differential pair signaling of USB communications to make the USB host on our computer think we're transferring information using the USB protocol.

Warning: Once again, this is extremely hackerish. SparkFun can't promise this will work with all computers.

Hardware Setup

Add a 10μF capacitor between the RESET and GND pins of the Arduino. Watch the polarity! The capacitor will prevent the Arduino from entering bootloader mode so that it will pass the compiled firmware to the connected ATtiny rather than trying to program itself.

Add capacitor to the Arduino ISP

Upload Micronucleus to the ATtiny84

Head to the micronucleus GitHub repository to clone the bootloader or download the zip here.

Unzip the folder.

The Arduino IDE comes with a tool called AVRDUDE, which is a piece of software that can be used to download and upload firmware, read and write fuses, and manipulate ROM and EEPROM on AVR microcontrollers. Whenever you upload code to an AVR-based Arduino, the Arduino IDE is quietly calling AVRDUDE in the background to make that happen.

We're going to call AVRDUDE manually to send a piece of pre-compiled firmware to the ATtiny.

Open a command terminal and navigate to \/hardware/tools/avr/bin:

cd \<Arduino Directory\>/hardware/tools/avr/bin

Enter the following command, changing \ to wherever you downloaded and unzipped the micronucleus repository and \ to the serial port connected to your Arduino ISP (e.g., COM65 on Windows).

avrdude -C ../etc/avrdude.conf -c arduino -p t84 -P <Serial Port> -b 19200 -U flash:w:<micronucleus Directory>/firmware/releases/t84_default.hex

Your output should look similar to the following.

Uploading micronucleus with AVRDUDE