Programming ATtiny45/ATtiny85 with a USBasp AVR Programmer

So, you’ve created a project on an Arduino and want to deploy it in to the world.  The problem is that an Arduino is a big and relatively expensive device that has far more things than necessary for your project.

What you really need is just the microcontroller to run your code and control the pins.  All you need to do is buy an ATtiny45, ATtiny85 or similar Atmel chip, and then upload your program to it.

The Arduino makes putting your code and powering your Atmel chip very easy.  Getting your code on to the stand-alone Atmel chip is a little more tricky; there are ways to program the chip with an Arduino, but they aren’t as easy as using a USBasp AVR programmer.  The one I used is this one found on Ali Express.

If you are on Windows, you will need to install the drivers for the programmer.  A lot of sites will say you need to disable driver signing and do a whole bunch of steps, but the drivers found here will install on Windows 10 (they are signed) when installed using the installer (but not when you try to install the drivers yourself).  Once the drivers are installed, plug in the programmer and confirm your the drivers are working in device manager:

USBasp Drivers installed correctly.

Next, you need to install the ATtiny board in to the Arduino IDE.  To do this, follow these steps:

  1. Go to File > Preferences.
  2. Click on the button to edit the “Additional Board Manager URLs”.
  3. Add “https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json” on a new line.
  4. Click “OK” to close the URL editor, and “OK” again to close preferences.
  5. Then go to Tools > Board Managers
  6. Search for “ATtiny”.
  7. Install the attiny boards that appear (you should only have 1 result).

Next we need to set the board to be the ATtiny and the programmer to “USBasp”, use the following screenshot for reference:

Settings for USBasp

We are now all set from the software end, we need to then wire up the hardware. The following pins will need to be connected:

  1. The MOSI from the programmer to the MOSI of the ATtiny (Pin 5)
  2. The MISO from the programmer to the MISO of the ATtiny (Pin 6)
  3. The SCK (Clock) from the programmer to the SCK of the ATtiny (Pin 7)
  4. The RESET from the programmer to the RESET of the ATtiny (Pin 1)
  5. The Vcc from the progammer to the Vcc of the ATtiny (Pin 8)
  6. Ground from the programmer to the ground of the ATtiny (Pin 4)

Setting these pins up can be done in a couple of ways, I decided to make a dedicated board for this with a socket, so I can program chips quickly in the future.  If you do this, I recommend running some tests on a breadboard first and making sure you have all your pins properly connected before soldering it together.  Here is my programmer.

I can quickly program ATtiny chips by putting the chip in the IC socket and plugging an USBasp in the ribbon socket.
I can quickly program ATtiny chips by putting the chip in the IC socket and plugging an USBasp in the ribbon socket.

Now, all that needs to be done is plug the USBasp in to the USB port of a computer and hit play, here is what the console will look like when it is all working:

Successful ATtiny Programming via Arduino IDE

Now, you can use the newly programmed ATtiny chip in a project, without have to log around the entire Arduino with it.

Running a simple blink program on a breadboard with a stand-alone ATtiny85.
Running a simple blink program on a breadboard with a stand-alone ATtiny85.

3 thoughts on “Programming ATtiny45/ATtiny85 with a USBasp AVR Programmer”

Leave a Reply to Gianluca Cancel reply

Your email address will not be published. Required fields are marked *