loading
After this Instructable you should be able to program an A Ttiny85/45 with an arduino. It may sound complex but it really isn't. After doing some research I could not find to much info on how this could be done. I however did find https://www.instructables.com/id/Program-an-ATtiny-with-Arduino/. This Instructable is my interpretation of what I learned from Randy. 

Step 1: Things You Will Need

Arduino 
AT tiny 85/45 - available from Mouser  556-ATTINY85-20PU  Need more info on the AT tiny check out the data sheet here.
Bread board ( or the 8 pin shield from Instructables )
Bread board jumper wires
Led- 5
330 ohm resistor-5
1uf 50V electrolytic capacitor

Step 2: Set Up

You will be using the following arduino pins (see pic)
5V +
5V Ground x2
10
11
12
13
Reset

Wire up the bread board with the jumper wires as follows or see pic:
Note: be sure to not the dimple direction.

ATtiny  pin# 1 to arduino pin# 10
ATtiny  pin# 4 to arduino 5v ground
ATtiny  pin# 5 to arduino pin# 11
ATtiny  pin# 6 to arduino pin# 12
ATtiny  pin# 7 to arduino pin# 13
ATtiny  pin# 8 to Arduino 5v +


Now lets move onto adding our leds. Add the leds to the bread board as see in the pic keeping in mind the polarity of the leds.
Add the resistors to the positive side ( side without the flat part ) each led with get a resistor. Take some jumper wires from the resistors and connect them to the following ATtiny pins.


ATtiny pin# 5 this will be programmed as pin 0 in the sketch
ATtiny pin# 6 this will be programmed as pin 1 in the sketch
ATtiny pin# 7 this will be programmed as pin 2 in the sketch
ATtiny pin# 2 this will be programmed as pin 3 in the sketch
ATtiny pin# 3 this will be programmed as pin 4 in the sketch


Step 3: Setting Up the Arduino to Program

Setting up the arduino to program is not a permanent thing. All this will do is load a sketch that will allow you to program the chip then when you want to use the arduino you simply change the sketch. 
Fist things first you will need the program, down load it by clicking attiny45_85.zip  be sure that you are using arduino program version 0022.

Next:

Installing ATtiny45 / ATtiny85 support in Arduino

Download: attiny45_85.zip
Locate your Arduino sketchbook folder (you can find its location in the preferences dialog in the Arduino software)
Create a new sub-folder called “hardware” in the sketchbook folder.
Copy the attiny45_85 folder from the attiny45_85.zip to the hardware folder.
Restart the Arduino development environment.

Next:


Turning the Arduino board into a programmer

We’re going to use the Arduino board to program the ATtiny45 or ATtiny85. First, we’ll need to turn the Arduino board into an “in-system programmer” (ISP). To this:

Run the Arduino development environment.
Open the ArduinoISP sketch from the examples menu.
Select the board and serial port that correspond to your Arduino board.
Upload the ArduinoISP sketch.


Next:

Connect 1uf 50V electrolytic capacitor as follows:
 side with stripe to arduino ground
side with no stripe to arduino reset pin



Next:

In the arduino development environment click on tools, board and select ATtiny85 (w/ arduino as ISP ) be sure if using ATtiny 45 you select the correct one. Now you can write your sketch and upload it as you would normally to the arduino. While uploading a new sketch the leds will blink crazy for a sec then the program will take over and will run as programmed. 

Once the sketch is uploaded you can remove the electrolytic capacitor.

         Sometimes after you upload your sketch you may get the following errors:

avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85

Do not worry the sketch will have loaded just fine. You can now remove all but the 5V+ and ground wires you how successfully  programmed an ATtiny chip!

The following Arduino commands should be supported:

pinMode()
digitalWrite()
digitalRead()
analogRead()
analogWrite()
shiftOut()
pulseIn()
millis()
micros()
delay()
delayMicroseconds()




Step 4: The Sketch

This will blink all 5 leds

Step 5: Returning Arduino Back to Normal Operation

This is easy, 

Run the Arduino development environment go to tools, board then select the board you are using and load what ever sketch you would like. That's it! 


Well I hope I have covered everything in as much but not overly confusing detail as possible. Feel free to contact me on any new updates regarding the programming and or sketches and I will add them.
<p>There is also another good tutorial titled:</p><p><strong>&quot;Arduino Uno R3 as a true ISP programmer for any Attiny and Atmega AVR&quot;</strong></p><p>see:</p><ul> <br><li><a href="http://forum.arduino.cc/index.php?topic=317138.0" rel="nofollow">http://forum.arduino.cc/index.php?topic=317138.0</a><li><a href="https://app.box.com/s/ol1z8jjnrpy6wly4w61imt7wcbxk3fcg" rel="nofollow">https://app.box.com/s/ol1z8jjnrpy6wly4w61imt7wcbxk3fcg</a></ul><br>
<p>Hey I have a question.If I want to use one of these but i need a little more pins can I use 2 of them(like connected in some way or something similar),or I am just unlucky?</p>
<p>I'm planning on using an ATTiny as a coprocessor for a larger chip via an SPI slave. Unfortunately this would use 4 pins for the SPI so it would make it difficult to drive a 7 segment. Your best bet would actually be to use a serial in parallel out shift register.</p><p>This essentially allows you to use SPI to drive any number of lines. You would clock 8 (or 16) bits into the shift register and then latch it. Once it's latched each line coming out of the chip will be representitive of one of those bits.</p>
<p>That is something I need to give a search to.I'll let you know if I find something.THaaanks!!!</p>
<p>If you need more pins, they make an ATtiny 84 with 8-Bit Processors. 8K of program space, 12 I/O lines, and 8-channel See data sheet link. <a href="http://www.atmel.com/Images/doc8006.pdf" rel="nofollow">http://www.atmel.com/Images/doc8006.pdf</a> I did some searching and I can't find anything to support connecting 2 together. What are you trying to accomplish? </p>
<p>(Yeah I know it's been a while since you replied:/ ) I want to program a 4digit 7segment display to work with an AtTiny(but the only one I have right now is the 85)</p>
<p>Is the 7segment display 4 separate digits or 1 display with 4 digits? A picture of the front and back would help. Also any manufacture or product number would help. Some displays are inter connected, some with a common anode and some with a common cathode. Any specific info will help. Over all some shift registers will be needed. How many depend on the display information. </p>
<p>I cannot avoid in any way the shift registers can i????thanks anyway</p>
<p>Very nice. Complimentary info also on this Instructable.</p><p><a href="https://www.instructables.com/id/Using-the-Arduino-Uno-to-program-ATTINY84-20PU/" rel="nofollow">https://www.instructables.com/id/Using-the-Arduino-...</a></p>
<p>Thank you! Great write up as well. </p>
<p>Thanks for your instructable! Couple of routine questions. I appreciate you used an available capacitor. Most sites use 10microF, but it works for 1microF. Why a capacitor in this range?</p><p>In your pic, the capacitor is not hooked up to the Arduino. Usual GRD -- RESET pins?</p><p>You have 5 small current LEDs. If you had larger lumen LEDs, how would you put in a Darlington or other transistor [ maybe with additional external power ]?</p><p>Regards, lee</p>
<p>Thank you for viewing. In the picture I hadn't hooked up the capacitor yet. I do make mention of its connection in step 3 about 4 steps down. The best way to connect high lumen leds would be a transistor with the external power. </p>
<p>Sorry to see that you are having this issue. Please post the code you are using. Are you getting this message when setting up the arduino, or during programing of the ATiny?</p>
<p>I get it when i'm trying to program the attiny </p><p>int led = 0;</p><p>void setup() {</p><p> pinMode(0, OUTPUT); </p><p>}</p><p>void loop() {</p><p> digitalWrite(0, HIGH); </p><p> delay(1000); </p><p> digitalWrite(0, LOW); </p><p> delay(1000); </p><p>}</p>
<p>I get the &quot;OUTPUT was not declared&quot; error when using the following:</p><p>Arduino 1.0.2 IDE</p><p>attiny45_85 Core download</p><p>(Both items referenced in this instructable)</p><p>I do not get an error with this combination:</p><p>Arduino 1.0.4 IDE from <a href="http://arduino.cc/en/Main/OldSoftwareReleases" rel="nofollow">http://arduino.cc/en/Main/OldSoftwareReleases</a></p><p>ATtiny master Core download from <a href="http://highlowtech.org/?p=1695" rel="nofollow">http://highlowtech.org/?p=1695</a></p><p>The problem I have with the blinking light is that the blinking is inconsistent.</p><p>I'm using an ATtiny85-20PU chip for this and have 3 chips.</p><p>1st Chip - The light blinks 3 times and then stays off.</p><p>2nd Chip - The light blinks 1 and the light stays on.</p><p>3rd Chip - The light blinks 1 and the light stays off.</p><p>Because of the inconsistency between the 3 chips I am led to believe there is additional programming I need to set in the chip to fix what appears to be a counter issue.</p>
<p>I've done all that with my ATTiny85 and i keep getting OUTPUT was not declared in this scope </p>
<p>Will this work with an arduino mega?</p>
<p>Sorry for the late reply. It should work the same. If you set it up and run into a problem let me know and I will try my best to help get it working. </p>
Thanks for the reply! I have my arduino now and will post if it works the same with an arduino 2560.
Thanks for your reply. I'm getting my arduino mega tomorrow. As soon I can get an ATtiny I'll tell you if it worked.
Hello ! <br>The link isn't working :( <br>
I have updated the links, They should be working now. Please let me know if they are not.
Here is some extra help for those using the Mega ADK or Mega 2560.<br> <br> Check it out:<br> <a href="https://www.youtube.com/watch?v=DebJ1s5I3QM" rel="nofollow">https://www.youtube.com/watch?v=DebJ1s5I3QM</a>
How come the other instructables use a 10uF capacitor, and this one only uses a 1uF?
The 1uF is the only one I had on hand at the time and it worked so I stuck with it.
I did it with a 33uF coz that was the only one I had at that time. Works wonders
I get the &quot;please define PAGEL and BS2,&quot; but I ALSO get &quot;avrdude Yikes! Invalid Device Signature. Double check con....&quot; <br>What? The? Heck?
A few questions, What chip are you trying to program? What version of Arduino are you using? What version of Arduino programmer are you using? Can you upload some pics of the wire layout?
Oh. Wait... prob solved. There was an LED hanging out, so I took it out and it works.
Hmm, thanks for the instructable, but I have a question, which pins would go to which on an Arduino Mega?
Thanks for looking. Looking at the mega pin lay out it should be the same pins and same code. I even looked at the &nbsp;<a href="https://store.instructables.com/products/8-pin-programming-shield" rel="nofollow">8 pin shield from</a> instructables and that will fit the mega. If you would like to make one check out <a href="https://www.instructables.com/id/8-Pin-Programming-Shield/?ALLSTEPS" rel="nofollow">Randy's assembly instructions</a>&nbsp;creator of that sheild&nbsp;and you can see the parts needed and layout. &nbsp;Hope this helps!

About This Instructable

51,289views

74favorites

License:

More by wirenut1980:Garden storage Wet Shelf Talking Pumpkin Costume Arduino Light Display With Vixen 
Add instructable to: