After some research I found that my first option was the straight one. Just plug it as a normal Arduino, the last two needed something else. The last two options were missing something called a bootloader. A bootloader is “a small program that has been loaded on to the microcontroller.
≡ PagesFavoritedFavorite10Introduction
In this tutorial, we'll show you how to use Arduino to install the micronucleus bootloader, which has V-USB, onto an ATtiny84. These steps will work for other ATtiny chips, but you'll need to change things like the pins_arduino.h file and target parameters in avrdude.
By following this guide, you will be able to upload Arduino sketches directly to the ATtiny84 over USB without needing to use a programming device (such as another Arduino or FTDI chip).
The Atmel AVR ATtiny84 is very similar to the ATtiny85 but with a few more I/O pins (six more, to be exact). If you like working with very small, inexpensive microcontrollers, the ATtiny84 and lower-power ATtiny84A are good options. Either the ATtiny84 or ATtiny84A will work for this tutorial.
AVR 14 Pin 20MHz 8K 12A/D - ATtiny84
COM-11232In this tutorial, we'll show you how to:
- Load Arduino ISP (In-System Programmer) on an Arduino
- Install the micronucleus bootloader on the ATtiny84
- Manually change fuses in the ATtiny84 to allow USB programming
- Create a new board definition in Arduino for the ATtiny84
- Install any necessary USB drivers
- Upload example firmware from Arduino IDE to the ATtiny84
The ATtiny microcontrollers are fantastic little chips but often suffer from low programming space. The ATtiny84 and 85 have 8k of flash memory (compared to 32k in the ATmega328p, the most commonly found microcontroller on Arduino platforms). A bootloader like micronucleus allows us to upload firmware to the microcontroller over a 'virtual' USB (V-USB) connection rather than using a separate microcontroller for programming. The downside is that micronucleus uses 2k of the available flash, leaving us with only 6k of flash for our program!
However, using a bootloader potentially reduces the production cost of a custom Arduino board if you don't want to rely on separate hardware for programming.
Parts List
To follow along, you will need these parts:
You will also need the following:
Arduino Uno Bootloader Download
- 2x 68Ω Resistors
- 1x 1.5 kΩ Resistor
Suggested Reading
Before moving along, we recommend you have familiarity with the following concepts.
Load Arduino ISP
To get started, we'll need to use another Arduino as an In-System Programmer (ISP) to send firmware to the target device (our ATtiny84). We'll only need to do this once in order to upload the micronucleus bootloader.
Hardware Connections
To start, make the following connections:
Upload ArduinoISP Sketch
Download the latest Arduino IDE.
Connect an FTDI breakout to the Arduino Pro Mini. In Arduino, select File > Examples > ArduinoISP > ArduinoISP. Select your Arduino board in Tools:
- Board: Arduino Pro or Pro Mini
- Processor: ATmega328 (3.3V, 8MHz)
- Port:
Click upload to burn the Arduino ISP firmware to the Arduino Pro Mini.
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.
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.
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:
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).
Your output should look similar to the following.
Change Fuses
Most microcontrollers come with a number of configuration bits that reside in nonvolatile memory outside of the normal program space. In AVR chips, like our ATtiny84, these bits are known as 'fuses.' By default, the fuses on a new ATtiny84 are set to:
- Divide the clock by 8
- Disabled brown-out detection
- No self-programming
We want to change the fuses so that we have:
- No clock divider
- Brown-out detection at 2.7V (not necessary, but useful if running off battery)
- Self-programming
To see which fuses need to be changed, select ATtiny84 from the dropdown list on the AVR Fuse Calculator site.
Burning Fuses with AVRDUDE
If you change the features on the fuse calculator, you'll see that we need to set the following:
- Low Fuse Byte:
0xE2
- High Fuse Byte:
0xDD
- Extended Fuse Byte:
0xFE
To do that, we'll use AVRDUDE. Once again, navigate to the directory with AVRDUDE in Arduino and execute the following command:
Verify that the fuses have been written with the following:
While you are telling AVRDUDE to specifically read the lfuse, it will print out the state of all the fuses. You should see the following at the bottom of the printout:
Create an Arduino Board Definition
To be able to program the ATtiny84 from Arduino, we need to make a custom board definition. There are three main parts for a board definition, and we'll create each one:
- boards.txt -- Information about the microcontroller (clock speed, program space, etc.)
- platform.txt -- Extra information the compiler might need and which loader tool to use (e.g., AVRDUDE)
- pins_ardiuno.h -- Tells the compiler which pins in code map to which pins on the microcontroller
Additionally, we'll need to copy over the micronucleus loader tool from the micronucleus project directory to the Arduino directory. The loader tool will be used to send compiled firmware to the ATtiny84 (much as AVRDUDE does).
boards.txt
Navigate to /hardware and create a directory that corresponds to the class of platforms or company name that our ATtiny84 will belong to. I'll call mine mytiny.
In that directory, create another directory that corresponds to the target microcontroller family, 'avr' in this case.
In the avr directory, create a file named boards.txt and copy in the following text:
platform.txt
In the avr directory, create a file named platform.txt and copy in the following:
Pin Definitions
At this point, we need to create a custom pin definitions file. Create a directory in avr with the name variants:
Arduino Uno Bootloader Download Hex
Create another directory in variants named tiny14. In tiny14, create a file named pins_arduino.h.
Copy the following code into pins_arduino.h. Note that the original contents of this file come from the ATtiny cores for Arduino project.
If you look through the platform.txt file, you'll see that the loader tool is micronucleus and not avrdude. Because Arduino does not come with the micronucleus loader tool, we need to build it or copy it from the micronucleus project directory.
Build the Micronucleus Loader (Mac)
First, you'll need to make sure you have Homebrew installed. Then, open a command terminal and enter:
Navigate to
Copy the Micronucleus Executable (Windows)
Navigate to Because micronucleus requires custom drivers based on libusb, many operating systems will need to have the custom drivers installed or perform some custom configuration. Find your operating system below and follow the instructions. Unfortunately, Windows doesn't know what to do with the micronucleus bootloader on the ATtiny84. It comes up as an Unknown USB Device, so we'll fix that with a custom driver. Lucky for us, the micronucleus project already comes with one. Plug in a USB micro cable from your computer to the USB micro breakout on the breadboard. Windows will likely tell you that no driver could be found. Navigate to You have two choices. You can either run Arduino with root privileges in order to send data to an 'unknown' USB device, or you can install a set of udev rules to allow regular users to upload programs. To install the udev rules, run the following commands: We should have everything set up to flash a program onto the ATtiny84 from the Arduino IDE! But first, let's simplify the hardware. We can modify our hardware to disconnect the programming lines from the Arduino Pro Mini, which will free up some GPIO on the ATtiny. We'll still want to use the Pro Mini's voltage regulator to drop the USB voltage from 5V to 3.3V. Close and reopen the Arduino IDE to load the new board definition files. In a new sketch, copy in the following: In Tools > Board, you should see only one option under MyTiny Boards. Select it. And that's it! You should see the LED begin to blink on and off. While this is a lot of information to take in, it shows how to hack the Arduino IDE to load custom board definitions. These steps should work for other ATtiny devices that are supported by the micronucleus project, such as: You might have to modify the pins_arduino.h file, however, if you plan to use a different ATtiny. If you need additional support, please check out the following resources. If you want to go further with the ATtiny, please check out our additional tutorials that showcase the ATtiny:Install USB Drivers
Windows
Linux
Example: Blinky
Hardware Setup
The Code
Upload and Run
Resources and Going Further
ATtiny84 Pinout
Electronic E-craft Terrarium
Roshamglo Hookup Guide
Qwiic Quad Relay Hookup Guide
Atmega328 With Arduino Bootloader
Qwiic Twist Hookup Guide
Arduino Bootloader Source Code Download