Using the Arduino Uno to Program ATTINY84-20PU

155K14745

Intro: Using the Arduino Uno to Program ATTINY84-20PU

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).

STEP 2: Program the Arduino to Use As an In-System Programmer (ISP)

9 ) Open the Arduino software on your computer (aka Arduino IDE).

10) Select your Arduino board. I have the Arduino UNO but replaced the processor with a pre-programmed Atmega328P chip from Adafruit, which requires that I select "Arduino Duemilanove with ATmega328."

At this point, you should see additional "boards" listed, such as all of the ATtiny boards that as in your "Boards.txt". Do not select the ATtiny chip at this point. Select your Arduino board so that you can tell the Arduino that you want to use it as an In-System Programmer (ISP).

11) Select AVR ISP programmer by selecting [Tools] [Programmer] AVR ISP.

12) Upload the ArduinoISP sketch to your Arduino by selecting [File] [Examples] ArduinoISP. Once uploaded your Arduino will be programmed to be used as an ISP.

STEP 3: Create Blink Sketch for the Attiny84

13) Open the sketch to be programmed onto Attiny84. This example uses the Blink sketch from the Arduino software.
[File] [Examples] [01.Basics] [Blink]

14) Edit the sketch so the LED pins correspond to the ATtiny84. That is, change "int led = 13;" to "int led = 0;"

STEP 4: Configure the Arduino to Use As an ISP

15) Select ATtiny84 @ 1 MHz (internal oscillator; BOD disabled) by selecting
[Tools] [Boards] Attiny84 @ 1 Mhz (internal oscillator; BOD disabled)

(Note: Do not select a chip for use with an external oscillator unless you have one; it you do so, the chip will not work again until you have connected it to an external oscillator).

Your Arduino is now configured to be used as an ISP.

STEP 5: Connect the Hardware

16) Disconnect USB/power from Arduino

17) Connect the Arduino Pins to the ATtiny84 pins.
Arduino 5V to ATtiny84 Pin 1
Arduino Pin 10 to ATtiny84 Pin 4
Arduino Pin 11 to ATTiny84 Pin 7
Arduino Pin 12 to ATtiny84 Pin 8
Arduino Pin 13 to ATtiny84 Pin 9
Arduino GND to ATtiny84 Pin 14
Arduino RESET to 10uF cap
10uF capacitor to GND

STEP 6: Use the Arduino As an In-System Programmer (ISP)

18) Connect USB/power to Arduino

19) Upload modified Blink sketch to ATtiny84.

Note: An arvdude message appears - something about PAGEL and BS2 - but it is not an error. The program is uploaded successfully.

STEP 7: Use the ATtiny84 As a Stand Alone Chip

20) Disconnect USB/power from Arduino

21) Disconnect hook-up wires between ATtiny84 and Arduino.

22) Hook-up ATtiny to run Blink sketch independently from Arduino:
a. ATtiny Pin 1 to 5V leg, which is the right most leg of the voltage regulator that I used with a 9V battery. Not not connect power source until all connections are made. This way you won't short anything. But just to be complete, the +9V goes to the input leg (left most leg) of the Voltage Regulator, the -9V to Voltage Regulator common leg (middle leg), and 5V output (right leg) to ATtiny Pin 1. But don't connect the battery yet.
b. ATtiny Pin 2 to long leg of LED (I defined this as Pin 0 when writing the modified blink sketch)
c. Short leg of LED to any end of Resistor (I chose 330 Ohm. Any resistor from 100 Ohm to 1000 Ohm should work).
d. Other end of Resistor to Ground
e. ATtiny Pin 14 to Ground

23) Now apply power to ATtiny84 by connecting 9V battery.

STEP 8: Use All of the ATtiny84s Pins

I wanted to understand how to use each pin on the ATtiny84 so I added this as well:

24) Disconnect USB/power from Arduino

25) Tell the Arduino you want to use it as an ISP (that is, repeat step 2)

26) Download Blink sketch that uses all available pinouts (https://github.com/maltesemanTS1/ATtiny84-Blink-all-Pinouts.git) or modify your own sketch to use all pins (that is, repeat step 3).

27) Configure the Arduino as an ISP as shown previously in step 4.

STEP 9: Use All of the ATtiny84s Pins

28) Hook-up ATtiny84 for Blink-On-Each-Pin sketch.

ATtiny Pin 1: 5V
ATtiny Pin 2: myPins[0]
ATtiny Pin 3: myPins[1]
ATtiny Pin 4: RESET pin
ATtiny Pin 5: myPins[2]
ATtiny Pin 6: myPins[3]
ATtiny Pin 7: myPins[4]
ATtiny Pin 8: myPins[5]
ATtiny Pin 9: myPins[6]
ATtiny Pin 10: myPins[7]
ATtiny Pin 11: myPins[8]
ATtiny Pin 12: myPins[9]
ATtiny Pin 13: myPins[10]
ATtiny Pin 14: GND

Connect ATtiny Pins 1 and 14 to 5V and GND, respectively.
Connect all other ATtiny pins, except ATtiny pin 4 (that;s the reset pin), to an LED
Connect a resistor (between 100 and 1k Ohm) between each LED and GND (actually, you can use just one resistor for all LEDs since this program blinks the LEDs one at a time. But it is safer to build with a resistor for each LED in case you mod the sketch at a later time.)

29) Apply power.

STEP 10: Parts List

1. Arduino Uno (Digikey 1050-1024-ND)
2. 330 Ohm 1/4 Watt resistor (from resistor kit, Digikey RS125-ND)
3. 10 uF capacitor (from capacitor kit, Digikey P835-KIT-ND)
4. Breadboard ( Half-size breadboard, Adafruit PID 64)
5. 5V voltage regulator (Digikey 497-12404-ND)
6. 9V battery
7. jumper wire (Breadboarding wire bundle, Adafruit PID 153 or 22 awg solid core wire, Digikey A3051R-100-ND)
8. ATtiny 84 (ATTINY84-20PU, Digikey ATTINY84-20PU-ND)
9. 5mm LED (Digikey 754-1262-ND)

35 Comments

I am little bit confused.
Does the boot loader automatically transfered to the device with the code
OR
The Device is to be first Boot Loaded?
Please clear.
Thanks
My Sencod Question is:
After Boot Loading with Aurduino, can I program ATTiny84 with AVR Studio Program?
I am new to Arduino.
I want to know whether ATTiny84 is preloaded with boot loader.
If not, how it works as stand alone.?
If it is not pre loaded then how to make it boot loaded?
Yay! This is my first attempt and it worked out . Thank you very much
. Used 1MHZ internal and it works on 1.8v i am currently using it on 2.4v(i am using attiny84v 20pu).
glad to hear! thanks!
Hi, what does avrdude: Yikes! Invalid device signature mean? How can I fix it?
I'm wondering if someone can help me.
my digital pins drop to 1.9 volts when adding a load to them. without a load i reed 5 volts. analog pins do not have this problem.
I am using an Attiny84 and i'm trying to light up an led using digital pin 6(pin 7 on dip). iv used arduino uno as 5v supply yo package and if tried a voltage regulator.
sorry fixed my issue. forgot to put pinMode(6, OUTPUT); in code

Great!

Using this setup, when my sketch includes Serial.print() statements, will they be displayed on my pc?

No, sadly the ATTINY series doesn't support hardware serial. The interface used to program is ICSP. You could use the software serial library and hook it up through an arduino board (with the ATMEGA removed), or use a USB to Serial converter. Take a look at step 3&5 for more details: https://www.instructables.com/id/ATtiny85-ATtiny84-Analog-Pins-Serial-Communication/

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.

Thankfully, the sketch to make all LEDs blink did the trick.

Did I miss something?

Well, it's been a long time. But looking at "Step 7: Use the ATtiny84 as a Stand Alone Chip," 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?

No, I don't think the missing jumper is the cause. I routinely use LED's with a current limiting resistor already soldered on.

I did find another site with instructions that has a pinout diagram that matches what I'm seeing: ATtiny44-84.png

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.

Here is the correction.

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 ...
1- burn bootloader = no errors (the same output messages with attiny85)
2- upload sketch = no error (same output messages with attiny85)
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.
Why i can't get my led blinking with attiny84?

did you mod the sketch and the pins you're physically connected to?

attiny84
ATtiny Pin 1: 5V
ATtiny Pin 2: myPin 0
ATtiny Pin 3: myPin 1
ATtiny Pin 4: RESET
ATtiny Pin 5: myPin 2
ATtiny Pin 6: myPin 3
ATtiny Pin 7: myPin 4
ATtiny Pin 8: myPin 5
ATtiny Pin 9: myPin 6
ATtiny Pin 10: myPin 7
ATtiny Pin 11: myPin 8
ATtiny Pin 12: myPin 9
ATtiny Pin 13: myPin 10
ATtiny Pin 14: myPin GND

attiny 85
ATtiny Pin 1: RSEST
ATtiny Pin 2:
ATtiny Pin 3:
ATtiny Pin 4: GND
ATtiny Pin 5:
ATtiny Pin 6:
ATtiny Pin 7:
ATtiny Pin 8: 5 V

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

Hi Juanmolin,
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.

Thanks

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.

attiny84
ATtiny Pin 1: 5V
ATtiny Pin 2: myPin 0
ATtiny Pin 3: myPin 1
ATtiny Pin 4: RESET
ATtiny Pin 5: myPin 2
ATtiny Pin 6: myPin 3
ATtiny Pin 7: myPin 4
ATtiny Pin 8: myPin 5
ATtiny Pin 9: myPin 6
ATtiny Pin 10: myPin 7
ATtiny Pin 11: myPin 8
ATtiny Pin 12: myPin 9
ATtiny Pin 13: myPin 10
ATtiny Pin 14: myPin GND

attiny 85
ATtiny Pin 1: RSEST
ATtiny Pin 2:
ATtiny Pin 3:
ATtiny Pin 4: GND
ATtiny Pin 5:
ATtiny Pin 6:
ATtiny Pin 7:
ATtiny Pin 8: 5 V

More Comments