Introduction: 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
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:
(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
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:
Pin 10----->Pin 1
Pin 11----->Pin 5
Pin 12----->Pin 6
Pin 13----->Pin 7
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
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:
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
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
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
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.
stannickel made it!
We have a be nice policy.
Please be positive and constructive.