top of page

Programming ATTiny MCU's with Arduino

A Brief Guide to MCU Programming for Guitarists

The astute observer will note that several of the projects utilize the ATTiny-series microcontroller. As discussed in the microcontroller primer, MCU's allow for all kinds of neat control over various types of signals. I enjoy using them because they allow for some novel approaches to certain guitar-related effects and utility-type pedals. That being said, and MCU doesn't do any good unless you can program it. There are many guides out there to programming these chips (like here), but for the sake of completeness, I'll give a really brief guide here.

​

A basic outline of the steps is as follows:

  1. Configure Arduino Nano to function as a programming interface

  2. Create a programming board

  3. Set up the ports for talking to the ATTiny

  4. Programming the chip

​

Sounds easy, right? Well, it is.  So here we go.

​

Configure Arduino as Programming Interface

​

First things first, we need to load a program onto the Arduino that will instruct it to act as a program interface for the ATTiny chips. This is made super simple in the Arduino IDE. Go to File -> Examples -> ArduinoISP -> ArduinoISP. This will open the sketch (program) and all you have to do is upload the sketch to the Arduino using CTL+U or the button in the menu bar.

ArduinoISP.PNG
Configuring Arduino as ISP for ATTiny programming

Create a Programming Board

​

Creating a programming board is rather simple. All it takes are some perfboard, a couple sockets, some wire, and you're ready to go. You can find a perfboard layout for one here. Note that only one chip should be inserted at a time. The two sockets are to allow for programming either the 25/45/85 or 24/44/84 series. Also note, don't try to configure the Arduino as a programming interface while connected to this board. Doing so will cause problems due to the electrolytic capacitor between the reset pin and ground. This cap is necessary for preventing accidental resets when programming the ATTiny, but also prevents the necessary resets when programming the Arduino. I strongly recommend the 15 pin sockets so that popping the Arduino nano in and out is trivial.

Set Up Ports for Talking to ATTiny

​

Once you have your programming board all built up and ready to go, you are now ready for the final steps before pushing your program to the MCU. First up is to make sure you have the proper ATTiny programming library. Adding this is quite simple. Go to File -> Preferences. In the box Additional Boards Manager URL's, put in this link: https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json.

AddATTinyJSON2.png
Adding ATTiny Board URL to Preferences

Next, go to Tools -> Board -> Boards Manager.

BoardManager2.png
Finding the Board Manager

Scroll down to where it says attiny by Davis A. Mellis and click on it and install it. There will now be entries under Tools -> Boards called ATTiny25/45/85 and ATTiny24/44/84.

BoardManagerATTiny2.png
Adding ATTiny library to Board Manager

There are five (5) settings that will need to be made in order for the Arduino IDE to know that you want your code to go to the ATTiny and for the code to actually get there. All five of these are accessed in the Tools menu.

​

First, go down to Boards and select the appropriate board definition for the family of ATTiny you are using. Once that is done, go to Tools -> Processor and select the specific chip that you will be working with. Next, go to Tools -> Clock and select "Internal 1 MHz", as this is the default clock rate for the ATTiny chips. Fourth, go to Tools -> Port and select the port for your Arduino. This will only show valid ports for Arduino's so if you only have one connected, you should only see one option. That's how I roll and it makes it dead simple. Finally, go to Tools -> Programmer and select "Arduino as ISP". When it is all configured correctly, it should look something like this.

FinalBoardConfig.PNG
Example Final Configuration for ATTiny Programming

Programming the Chip

​

You are now ready to program your chip. Just follow these next steps:

​

  1. Place ATTiny in the programming board

  2. Place Arduino in the programming board

  3. Plug in the Arduino

  4. Open the .ino sketch you want to load

  5. Upload the sketch to the part (CTL+U or button on tool bar)

​

You should see a completion message in the terminal window below, like this one:

Successful ATTiny programming message using arduino
What a Successful Chip Programming Message Looks Like

You are now all set! Put that chip in a circuit and test it out! You are now officially in the ranks of MCU-enabled DIY guitarists.

bottom of page