Introduction: Attiny Programmer (using Arduino UNO)

Picture of Attiny Programmer (using Arduino UNO)

Playing with your Arduino is great fun. However, sometimes size does matter.

The Arduino UNO is small, but if you require your project to be in a small enclosure, the UNO might be way too big. You could try using a NANO or MINI, but if you really want to go small, you go tiny, Attiny to be precise.

They are quite small, cheap chips (basically small Arduinos) and can be programmed in the Arduino IDE, however you might notice that there is no USB connection. So how do we program it???

For every problem, there is a solution. You can easily make your Arduino UNO into a programmer, connect it with the Attiny and program it that way.

Now, if you do it once, that's a good option, however if you get into playing with your Attiny, you might notice that connecting all those wires over and over again gets pretty annoying.

If only there were some way we could just connect the Attiny to the Arduino without having to use a breadboard and all those wires. And there is!

In this insturcable I will show you how to make your very own Arduino Attiny shield, that works with Attiny25/45/85.

You can either make it on a breadboard (which looks quite messy) or you can use a PCB.

Step 1: What You'll Need

Picture of What You'll Need

For this project you will require:

-Arduino IDE (a newer version is recommended, but anything 1.6.x or newer should work)

-Attiny25/45/85 (you don't actually need it to make the programmer, but there's no point in making the programmer if you don't own a chip)

-2pcs 4pin male header (you can buy a row of 40 and carefully break 4 off)

-1 electrolytic capacitor (anywhere from 10uF to 100uF is fine)

-8pin socket (or you can use 2pcs of 4pin female headers)

-Arduino UNO (of course clones work just as well)

-1 pcb board that fits on the UNO (or a breadboard and some wires if you just want to test things out)

For those of you who want a more elegant solution in an even smaller package (on the second picture), I recommend buying a finished micro usb Attiny programmer that I sell on ebay:

http://www.ebay.com/itm/Attiny25-45-85-programmer-/192330044508

(please note that you still need to originally program the Attiny with an Arduino in order for the usb programmer to later work)

Step 2: Pinout and Connections

Picture of Pinout and Connections

Here is a picture of the Attiny85 pinout. It is the same for the Attiny25 and Attiny45. Notice the small half circle at the top. Pay attention to it. It is there so you don't plug it into the circuit backwards by mistake.

The half circle is represented by a small black dot on the chip (in the picture with the circuit connections)

Those who bought the Attiny programmer that I sell on ebay can simply plug in the Attiny and that's it.

For everyone else that's making the board from scratch, the connections should be as follows:

UNO------->Attiny

Pin 10----->Pin 1

Pin 11----->Pin 5

Pin 12----->Pin 6

Pin 13----->Pin 7

5V---------->Pin 8

Gnd-------->Pin 4

DO NOT FORGET to connect the capacitor between the Gnd and the reset pin on the Arduino UNO.

I recommend you put the male headers into the UNO's female headers, place the board on top so everything is as still as possible and then begin soldering so it will all fit later.

Once you've connected everything, check the connections again and the actual orientation of the Attiny. (remember the little dot on the chip)

If there are no mistakes, you can move on to the software part.

Step 3: Setting Up the IDE

Picture of Setting Up the IDE

The first thing you need to do is copy open up the Arduino IDE.

Go to File->Preferences

In the "Additional Boards Manager URLs:" paste this:

https://raw.githubusercontent.com/damellis/attiny/...

and click OK

Next go to Tools->Boards->Boards Manager (at the very top of the list)

In "Filter your search..." type attiny. It should only find one selection. Click on it and hit Install.

Once it's done installing, close the IDE so everything resets.

Congratulations! You have just finished the hard part, but you still need to prep your UNO to program the Attiny.

Step 4: Prepping the UNO for Programming

Picture of Prepping the UNO for Programming

To program the Attiny, you have to (always) first upload a special sketch to the UNO first.

You can find the sketch in File->Examples->ArdionoISP->ArduinoISP

Once that opens up, go to tools->Boards and select your UNO

Upload the sketch to it as you normally would.

Once that's done, your UNO has transformed into a programmer for the Attiny.

Go ahead and plug in the shield you've made in the previous steps, being careful to connect the correct pins and putting the Attiny in the right way!

Now on to actually uploading a program to the Attiny!

Step 5: Programming the Attiny

Picture of Programming the Attiny

Open up the IDE again (hit File and click New) and go to Tools->Boards

If you scroll down, there you will find that you can now select the Attiny25/45/85 as a board.

Go ahead and select the Attiny25/45/85 option and now go back to Tools and in "Processor:" select which ever Attiny you intend to use.

But that's not all.

You also need to change the "Programmer" option to: Arduino as ISP (not ArduinoISP, be careful)

Now once that's done, you should be able to upload your code to the Attiny the same way as you would a regular Arduino.

Step 6: Additional Tips

Picture of Additional Tips

If you want to change the clock speed of the Attiny, you can do so by clicking Tools->Internal X MHz and then clicking on Burn bootloader, while your Attiny is plugged into the UNO.

This will tell the Attiny to switch the clock speed to the speed you selected. (If you put in a delay of 1s and the actual delay is way shorter or way longer than that, you should probably try switching the clock speed)

Also when you'll want to take the Attiny out of the programmer, I recommend using some tweezers or something small and flat, so you can slip it under the Attiny and lift all the left and right side at the same time. That way you won't bend the pins when lifting it up.

Comments

stannickel made it! (author)2017-10-08

Very nice article. Everything is in one place. I have been using this homemade shield for several years now. It is very handy. I use the UNO for various things, so the shield version comes in very handy. I use whiteout to mark the attachment pins. Also, I did photoshop the ground and 5V wires, because my real shield is a mess--green and red for pin 8 and red and green for pin 4.

A simple shield is the way to go. Been using something similar for the past several years as well.

srhnz (author)2017-10-09

If you can, use ZIF sockets (search "universal ZIF socket"). I use them on a home baked board that stacks onto a UNO, and also have one plugged into my breadboard. Saves the pins on the chips from too much stress through pushing/pulling them out of the DIP socket. Lost a couple of chips through having the legs finally give up after several visits back and forth to the programmer. They come in various sizes, so can easily make a board that will take a range of chip sizes.

On the breadboard they are great for any DIP/DIPP/DIL chip. Used them with OpAmps, shift registers, motor drivers..the works.

ндогонят (author)2017-10-08

Thank you for this, it might be useful some time.

Now, you can use the USBASP thing (around $2) to do the same, but, with all the other components required, it's not going to be smaller than a Nano-clone (around $2, with a lot more functions and a lot more usable pins) because the Nano is SMD, so the argument "size sometimes matter" is not very valid until you go SMD (where the ATTiny can hide in the USB plug itself). The through-hole version of the ATTiny is not very interesting for makers anyway, the ATMega8-16PU has become cheaper and a lot more powerful, while not being that much bigger with the other necessary components (6 pin ISP, the power supply, the reset button...).

ArturZ9 (author)ндогонят2017-10-08

Even tough there are other solutions, ATtiny chips still do have their charm.
Affordable, compact, wide powering options, potentially very low power consumption, have good community behind, are both reasonably compact and quite simple for uninexperienced DIYers. So if you need something that uses just couple of pins and lasts for years off battery, ATtiny is still way to go.

ндогонят (author)ArturZ92017-10-08

I agree... mostly.
There are ways to get that off an ATMega8, and it has become cheaper than an ATTiny (now, we're talking a few cents out of a couple of quids...). The ATMega8 too has a "deep sleep" function that will make its consumption near nought (to the point where a 3V battery would deplete more by itself than by the consumption of the chip), it has the Arduino community behind it (although the community tends to shift to the ATMega328...) and the same In-System Programming interface (same family). For its environment, both chips have pretty much the same requirements in terms of current regulation and external components.
Now, where I am interested with the ATTiny is when you're using I2C or SPI and everything else is already wired (with no ISP). I get that the ATTiny makes a nice sensor or actuator, and I have already a few applications for that in the near future, wired to the GPIOs of an ESP8266 (again, around $2). But for the sake of required space, price and consumption, the arguments don't quite stand against the ATMega8 (unless you play "deadbugs")

ArturZ9 (author)ндогонят2017-10-08

Are you sure about pricing?
According to Microchip MEGA8-16PU costs 2.41 per piece, ATTINY85-20PU is 1.20
Never mind, ebay offers mega for .99 and tiny for 1.11 :)
Though mega won't come in DIP8 package, if size does matter.

kksjunior (author)2017-10-04

I was searching for the right tutorial for this! Thank you!

pgs070947 (author)kksjunior2017-10-08

Have a look at Hightech Lowtech (MIT tutorial) for some basic stuff nicely explained and also Nick Gammon's site (gammon.au) where he goes into some depth on Atmel programming and some useful articles on sleeping and pinchange interrupts using the ATtiny85.

When you order some, be aware of the two versions in DIP-8 packages. One has a wider supply range and the other operates up to 20-MHz.

A useful little chip for timing projects and a lot more versatile than messing about with CMOS timers etc.

BrownDogGadgets (author)2017-10-04

85s are great little chips for projects. Cheap, run on 3V, and small. Just a great tool overall.