loading

Using the Arduino Uno to program ATTINY84-20PU (Newark item # 68T3783). This Instructable shows how to use the Arduino platform to work with physically smaller processors, such as the ATtiny84 (84/44/24), ATtiny85 (85/45/25), and ATtiny2313. This example is specifically for the ATtiny84-20PU processor (Newark item # 68T3783) but can be adapted for the others boards by selecting the appropriate board from the Arduino software (i.e., Arduino IDE) and modifying the pinouts as required.

Step 1: Configure the Arduino IDE Software

1) Ensure the Arduino software (aka Arduino Integrated Development Environment [IDE]) is NOT running on your computer.

2) Create new folder named "tiny" in your Arduino "hardware" folder
C:\Projects\Arduino\hardware\tiny

3) Download the Arduino-Tiny archive (ZIP-file)
http://code.google.com/p/arduino-tiny/downloads/detail?name=arduino-tiny-0100-0016.zip

4) Copy and paste the contents of the ZIP-file into the "tiny" folder.

5) Create a new file named "boards.txt" in the tiny directory using any text editor. Make sure to save as a text file (.txt).
C:\Projects\Arduino\hardware\tiny\boards.txt

6) Open the "boards.txt" file and the "Prospective Boards.txt" file using a text editor.

7) Copy board entries of interest from "Prospective Boards.txt" to "boards.txt". Or just simply copy the entire contents from "Prospective Boards.txt" to "boards.txt" like I did.

8) Save and close "boards.txt". Close "Prospective Boards.txt" (see picture for how the contents should look).

<p>Great!</p><p>Using this setup, when my sketch includes Serial.print() statements, will they be displayed on my pc?</p>
<p>Hi, thanks for this tutorial. It works now. I had some trouble getting it to work, though. Physical pin 2 on the ATTINY84 does not map to pin0 in the code. Instead, I had to use pin10 in the code as in: digitalWrite(10, HIGH); to make the LED on physical pin 2 blink. I've been pulling out my hair wondering why the LED wasn't blinking.</p><p>Thankfully, the sketch to make all LEDs blink did the trick. </p><p>Did I miss something?</p>
Well, it's been a long time. But looking at &quot;Step 7: Use the ATtiny84 as a Stand Alone Chip,&quot; the photo didn't match the schematic. I believe the schematic was missing a jumper to connect the resistor to AtTiny84 pin 14. The schematic has been corrected. Before thinking about other possibilities, do you think this could have been the source of the problem?
<p>No, I don't think the missing jumper is the cause. I routinely use LED's with a current limiting resistor already soldered on. </p><p>I did find another site with instructions that has a pinout diagram that matches what I'm seeing: <a href="http://highlowtech.org/wp-content/uploads/2011/10/ATtiny44-84.png" rel="nofollow">ATtiny44-84.png</a></p>
<p>I think I know what's going on here. I'm using a different set of Board definitions. Of course that could be mapping the phyiscal ports differently.</p>
Here is the correction.
<p>Hi, i've used arduino to program a lot of ATtiny85, no problems. Now i need more pins, then i need attiny84. Connect it to my arduino uno, recheck the connections, select Attiny84 8mhz in boards, load blink example ...<br>1- burn bootloader = no errors (the same output messages with attiny85)<br>2- upload sketch = no error (same output messages with attiny85)<br>and the led is not blinking. Check again, change to 1mhz for test ... same result. Have test with 3 attiny84, with an attiny85 (and selecting the board) it's working.<br>Why i can't get my led blinking with attiny84?</p>
did you mod the sketch and the pins you're physically connected to? <br><br>attiny84<br> ATtiny Pin 1: 5V<br> ATtiny Pin 2: myPin 0<br> ATtiny Pin 3: myPin 1<br> ATtiny Pin 4: RESET <br> ATtiny Pin 5: myPin 2<br> ATtiny Pin 6: myPin 3<br> ATtiny Pin 7: myPin 4<br> ATtiny Pin 8: myPin 5<br> ATtiny Pin 9: myPin 6<br> ATtiny Pin 10: myPin 7 <br> ATtiny Pin 11: myPin 8<br> ATtiny Pin 12: myPin 9 <br> ATtiny Pin 13: myPin 10<br> ATtiny Pin 14: myPin GND<br><br> attiny 85 <br>ATtiny Pin 1: RSEST<br>ATtiny Pin 2:<br>ATtiny Pin 3:<br>ATtiny Pin 4: GND<br>ATtiny Pin 5:<br>ATtiny Pin 6:<br>ATtiny Pin 7:<br>ATtiny Pin 8: 5 V<br><br>
<p>Hi gain, now i have blinking led on attiny84!, thanks. Only a question, why pin0 is the attiny pin2? if you search for attiny84 pinout, you can find http://fc04.deviantart.net/fs70/f/2013/038/3/7/attiny_web_by_pighixxx-d5u4aur.png (for example). The Arduino pin0 is located at attiny84 pin 13 o_O</p>
<p>Hi Juanmolin,<br>It's been a long time but I only just found your post. Just wondering if you remember what you did to get your attiny84 to work. I have the same problem led blinks with attiny85 but not with attiny84. I've been at it for days trying all sorts of things.</p><p>Thanks</p>
<p>There are physical differences between 85 pins and 84 pins. So first ensure the proper physical connections with the attiny84, which will absolutely be different from any connections you made with the attiny85. I (re)pasted the pinouts below. Let me know how it goes.</p><p>attiny84<br> ATtiny Pin 1: 5V<br> ATtiny Pin 2: myPin 0<br> ATtiny Pin 3: myPin 1<br> ATtiny Pin 4: RESET <br> ATtiny Pin 5: myPin 2<br> ATtiny Pin 6: myPin 3<br> ATtiny Pin 7: myPin 4<br> ATtiny Pin 8: myPin 5<br> ATtiny Pin 9: myPin 6<br> ATtiny Pin 10: myPin 7 <br> ATtiny Pin 11: myPin 8<br> ATtiny Pin 12: myPin 9 <br> ATtiny Pin 13: myPin 10<br> ATtiny Pin 14: myPin GND<br><br> attiny 85 <br>ATtiny Pin 1: RSEST<br>ATtiny Pin 2:<br>ATtiny Pin 3:<br>ATtiny Pin 4: GND<br>ATtiny Pin 5:<br>ATtiny Pin 6:<br>ATtiny Pin 7:<br>ATtiny Pin 8: 5 V</p>
naw mean
I guess it is a matter of choice. I know in programming they start counting at zero rather than one. So in my sketch I chose to define my first usable Pin as pin0 even though it might physically be a different pin on the attiny (and on the Arduino for that matter). When I define the first useable pin this way, I see the first led blinking and I know it's pin0 in my sketch. And the second blinking led is pin1 and so on. In other words, once the physical connections are made, I'm mostly concerned about the programming, not the physical relation to the pinout diagram of any particular atTinyXX. If you want to define you're pins deferently in your sketch so to match the pinout diagram of the atTinyXX, you certainly can. Whatever you do, just don't confuse the Arduino pins with the atTiny pins with the pin definitions of your choosing that are in your sketch.
<p>Great instructable. Worked first time so long you follow the instructions.</p><p>I made one mistake - I used the:</p><p>ATtiny84 @ 8 MHz (internal oscillator; BOD disabled) option in step 15 and not the: </p><p>ATtiny84 @ 1 MHz (internal oscillator; BOD disabled) as specified, thinking it would run eight times faster but it ran the sketch eight times slower i.e. 1 second became 8!!</p>
Interesting. I wouldn't have thought that would have happened. Glad it worked anyways!
<p>I found the solution to my problem. If you want to use the 8MHz option (and some libraries require 8Mhz and not the default 1MHz) then after step 15 insert 15a which is to select the 8Mhz speed then choose the Burn Bootloader option from the Tools menu. This will set the fuses to allow 8MHz operation.</p><p>Source:</p><p><a href="http://42bots.com/tutorials/programming-attiny84-attiny44-with-arduino-uno/" rel="nofollow">http://42bots.com/tutorials/programming-attiny84-a...</a></p><p>I have tested the above and the blink sketch now runs correctly at 1 second.</p>
after a few tries it worked perfectly fine<br>nice instructable with very good explanations<br><br>the arduino in the 2nd picture is only for power supply because i didn't have a voltage regulator at hand
<p>glad it worked!</p>
<p>hey thanks!</p>
<p>it's works :)</p>
<p>If using IDE v1.6.4 onwards it is a bit easier (replacing steps 5-8 above), since libraries and hardware can be copied to a local folder. So:</p><p>1. Locate the {Sketches} folder as shown in Arduino Preferences:Sketchbook location, e.g. ~/Documents/Arduino/Sketches/ </p><p>2. If there is no hardware folder create one, e.g. {Sketches}/hardware</p><p>3. Copy the tiny folder into there, e.g. {Sketches}/hardware/tiny</p><p>4. Restart Arduino IDE</p><p>Now the Board appears in the Boards List and the code compiles and uploads fine. No more &quot;Missing Arduino.h&quot; errors!</p>
<p>I am getting a compiling error? What am I doing wrong when I try to upload this?</p><p>thanks</p><p>Blink.ino:16:21: fatal error: Arduino.h: No such file or directory</p><p>compilation terminated.</p><p>Error compiling.</p>
<p>I'm not totally sure. But clearly the compiler cannot find the Blink sketch. A sketch is a *.ino file. </p><p><a href="http://arduino.cc/en/guide/environment" rel="nofollow">http://arduino.cc/en/guide/environment</a></p><p>My Blink.ino is located in the Examples menu. I searched my computer to confirm that the Blink.ino sketch is actually located there. I found it at C:\Program Files (x86)\Arduino\examples\01.Basics\Blink</p><p>Confirm your sketch is in the directory that it should be for your computer. If not copy it again and save it. From what I've read there may be some subtleties to where you save the Blink.ino so I'd save it in the location that it was originally located, again in my case, C:\Program Files (x86)\Arduino\examples\01.Basics\Blink</p><p><a href="http://arduino.cc/en/Tutorial/Blink" rel="nofollow">http://arduino.cc/en/Tutorial/Blink</a></p><p>Focus on the location of the sketch file and let me know what you come up with. Sorry I can't give a more direct answer.</p>
<p>Thanks for your instructable!</p><p>I noticed that ecen for the single LED project you used what looked like a transistor on the breadboard??? Looking at the multiple LED project you mention a </p> <br> 5. 5V <br> voltage regulator (digikey part number 497-12404-ND)<p>Is this also used for the single LED?</p><p>Can you explain or direct me to a sit which further explains the use and options of a voltage regulator for Ardino?</p><p>Thanks in advance, lee</p>
Thank you for the comment.<br> <br> In both examples (one LED or 11 LEDs), there are only the following components:<br> 9 VDC battery<br> 5 VDC voltage regulator (not shown in the photo of example with 11 LEDs, sorry, but it is shown in both schematics)<br> ATtiny84<br> LED(s)<br> resistor(s)<br> <br> To your point, the voltage regulator is packaged in a TO-220 style package, so it may look like a transistors but it's actually an IC voltage regulator. According the its datasheet, the required supply voltage for the ATtiny84 is between 2.7VDC and 5.5VDC. Since I was using a 9 VDC battery, I needed to step down the voltage. I chose to do this with a simple-to-use voltage regulator. I could have made a voltage divider from a couple of resistors, but I would have to make sure the proper current was also supplied. I didn't want to make things more complicated than necessary, so I went with the Vreg.<br> <br> Note: the voltage regulator was not required while programming the ATtiny84 because I used the Arduino Uno to power the chip. The Arduino Uno voltage is already at 5VDC, which is within the acceptable range for the ATtiny84.<br> <br> The use of a voltage regulator is dependent on the design your particular project, the particular components that you're using, and your available voltage sources. For example, if the ATtiny84 could accept a 9VDC source, I wouldn't need the Vreg at all. But this is not the case. The max recommended voltage for the IC is 5.5VDC and I had a 9VDC battery available.<br> <br> Similarly, if I had a voltage source within the acceptable range of the ATtiny84 (2.7VDC and 5.5VDC) then I would not have needed a voltage regulator at all. I mean I could have wired two AA batteries, which are 1.5VDC each, in series to get 3 VC and not needed the voltage regulator.<br> <br> A different circuit or a different IC may have entirely difference power or voltage requirements. Even an LED has a min and max recommended voltage (and current). Once you know the power (i.e., voltage and current) requirements of every component in your circuit then you know if a voltage regulator or any other power related device will be required.
<p>Nice tutorial! If you want to know how to do this with an Arduino Mega and an ATtiny85, check out my blog at: http://jamestav.blogspot.com/2014/08/programming-attiny85-microchip-using.html</p>
thx!<br>
Thx!

About This Instructable

113,954views

124favorites

License:

Bio: Mech Eng
More by tsant:Mexican Tile Table sugru surgery on Umbra Drinking Buddies and Topper Charlieplexing the Arduino 
Add instructable to: