Introduction: How to Program ATtiny2313

Picture of How to Program ATtiny2313

Howdy folks!

When I first got my ATtiny2313 it took me the better part of 4 hours to finally get it programmed. I went through countless tutorials online that were old and outdated. I was never able to get the correct files from one website. I had to combine the files from several websites before I was finally able to program my ATtiny.

NOTE: With the recent update of the Arduino IDE I can't figure out how to get the boards to show up in the list. I'm sure it's easy and I'll figure it out in a bit. For now you are still going to have to use the old version of arduino for programming any ATtiny chips.

The goal of my (Current and Updated!!!) series is to find tutorials online that are old, outdated, or nonworking and make a new tutorial that I have tested and used myself.
My first i'ble in this series is how to use IR remotes to control your Arduino.
I will keep updating my i'bles in this series to work with new Arduino boards, IDEs and the like.

Now I've never tested this process on a windows but I know that it works on a mac. It should be the same for windows, just delete any mac content in the zip.

Step 1: Download the Files

Picture of Download the Files

First you need to download the boards information for the Arduino IDE. This file will need to be downloaded in order to program a ATtiny2313.

Once you have downloaded that you will need to extract the 'tiny' folder to your Arduino hardware folder. Now if you don't know where that is or if you don't have it here are the steps.

  • Go to your Arduino documents. This is where all the sketches are saved (by default).
  • For mac users it's Macintosh HD>Users>username>documents>Arduino.
  • Create a new folder and name it "hardware", just like that. Into this folder you will put the 'tiny' folder that you downloaded.
  • For PC usersProgram Files(x86)=>Arduino=>hardware. Copy the 'tiny' folder into it and restart the Arduino IDE.Delete the extra mac content.

Step 2: Upload the ArduinoISP

Picture of Upload the ArduinoISP
  1. Connect your Arduino to your computer.
  2. Open up the ArduinoISP sketch which is with the other example sketches.
  3. Upload it.

Step 3: Connecting the ATtiny2313 to the Arduino

Picture of Connecting the ATtiny2313 to the Arduino

Make the following connections. You need to be sure that you are connecting these to the ATtiny's actual pins (starting from the top left and counting up counter-clockwise) and not the name of the pin.

  |                   |
5v------------>20 VCC
GND-------->10 GND

Also add an LED with a resistor on the pin (#7) right next to the GND on the ATtiny2313

Step 4: Uploading and Enjoying!

Picture of Uploading and Enjoying!
  1. First make sure that you have already uploaded the ArduinoISP to the Arduino.
  2. Select the (ATtiny2313@1MHz) board. When you go to boards you will notice that you will have a lot more options to use. This is because that 'tiny' folder that we put in the 'hardware' folder gave the Arduino program more board options.
  3. Under 'programmer' select 'Arduino as ISP'.
  4. Open the blink sketch and change the led pin 13 to pin 7.
  5. Click the upload button and pray!
Once you upload it you should have no errors. If you connected the Attiny to the Arduino incorrectly, it'll bring up the an error and it will say 'double check connections'.

After upload your LED should start blinking! Congrats! You now know how to program your ATtiny2313.

  • LED does not blink
    Make sure that you have connected the LED to the proper pins.
    Make sure that in the blink sketch you change the 13 to '7'.
    Replace the LED and try with another one.
  • Unable to program
    Make sure you have properly download, unzipped, and placed the 'tiny' folder.
    Make sure your 'hardware' folder is in the correct place.
    Make sure that you have selected 'Arduino as ISP' under 'programmer'.
    Make sure that you have selected the correct board. The correct board is the 'ATtiny2313@1MGz.

Step 5: Conclusion

I hope this i'ble was able to help you program you chip. You should be able to do this for ATtiny4313. Now I have not actually tried it myself but I will as soon as I get that chip.

Please give it a vote for the microcontroller contest!

and. . .

Don't forget to favorite and subscribe!


JonasN1 (author)2017-08-19

in "additional boards manager ulrs".

add this line

add a "," if you have other urls there.

restart the IDE.

install the ATtinyCore from "boards manger"

you can now chose attiny2313.

remeber to burn bootloader first time.

demetrioudemetrios (author)2017-08-07


danionescu (author)2017-02-20

If i'm using Arduino IDE 1.6.8 is there a way to make 2313 work ? I've downloaded the board definition from:

but it doesn't work, the error is "invalid library found" when i start the ide

Any ideeas?

GabrielC189 (author)2016-10-10

When I try to upload the blink program this error appears.


Arduino: 1.6.9 (Windows 7), Board: "ATtiny2313 @ 8 MHz"

Warning: Board tiny:tiny:attiny44at1 doesn't define a 'build.board' preference. Auto-set to: TINY_ATTINY44AT1

Warning: Board tiny:tiny:attiny84at1 doesn't define a 'build.board' preference. Auto-set to: TINY_ATTINY84AT1

Warning: Board tiny:tiny:attiny84at16 doesn't define a 'build.board' preference. Auto-set to: TINY_ATTINY84AT16

Warning: Board tiny:tiny:attiny84at8 doesn't define a 'build.board' preference. Auto-set to: TINY_ATTINY84AT8

Warning: Board tiny:tiny:attiny4313at8 doesn't define a 'build.board' preference. Auto-set to: TINY_ATTINY4313AT8

Warning: Board tiny:tiny:attiny85at8 doesn't define a 'build.board' preference. Auto-set to: TINY_ATTINY85AT8

Warning: Board tiny:tiny:attiny4313at1 doesn't define a 'build.board' preference. Auto-set to: TINY_ATTINY4313AT1

Warning: Board tiny:tiny:attiny85at16e doesn't define a 'build.board' preference. Auto-set to: TINY_ATTINY85AT16E

Warning: Board tiny:tiny:attiny2313at1 doesn't define a 'build.board' preference. Auto-set to: TINY_ATTINY2313AT1

Warning: Board tiny:tiny:attiny85at1 doesn't define a 'build.board' preference. Auto-set to: TINY_ATTINY85AT1

Warning: Board tiny:tiny:attiny2313at8 doesn't define a 'build.board' preference. Auto-set to: TINY_ATTINY2313AT8

Warning: Board tiny:tiny:attiny85at16p doesn't define a 'build.board' preference. Auto-set to: TINY_ATTINY85AT16P

Warning: Board tiny:tiny:attiny25at1 doesn't define a 'build.board' preference. Auto-set to: TINY_ATTINY25AT1

Warning: Board tiny:tiny:attiny24at16 doesn't define a 'build.board' preference. Auto-set to: TINY_ATTINY24AT16

Warning: Board tiny:tiny:attiny85at128 doesn't define a 'build.board' preference. Auto-set to: TINY_ATTINY85AT128

Warning: Board tiny:tiny:attiny45at8 doesn't define a 'build.board' preference. Auto-set to: TINY_ATTINY45AT8

Warning: Board tiny:tiny:attiny44at8 doesn't define a 'build.board' preference. Auto-set to: TINY_ATTINY44AT8

Warning: Board tiny:tiny:attiny45at1 doesn't define a 'build.board' preference. Auto-set to: TINY_ATTINY45AT1

Warning: Board tiny:tiny:attiny25at8 doesn't define a 'build.board' preference. Auto-set to: TINY_ATTINY25AT8

Build options changed, rebuilding all

recipe.preproc.macros pattern is missing

Error compiling for board ATtiny2313 @ 8 MHz.

This report would have more information with

"Show verbose output during compilation"

option enabled in File -> Preferences.

HavocRC (author)GabrielC1892016-10-12

You have all the boards installed in the wrong place or you are using a bad/outdated boards.txt

SomadityaS1 (author)HavocRC2017-01-11

i am having the same problem

please be elaborate.


SomadityaS1 (author)2017-01-11

it says as an error

recipe.preproc.macros pattern is missing

whitev6 made it! (author)2016-08-08

Instead of using the Blink program, I add my own of program that uses RGB led and three buttons to turn on the individual red, green and blue.

HavocRC (author)whitev62016-08-10

I like it!

Heyup (author)2016-02-29

Great ible, thank you very much from... John :)

JhonDee (author)2015-11-10

Gracias por su Buen trabajo. Él conseguido abrir y cerrar entendre y Programar el siempre utilizado. En Mi Caso, necesito dos Entradas analógicas y Parece Ser Que El att2313, sin DICHO Tiene o mejor, yo no se si las utilizarlo Tiene.

De todos modos gracias.

HavocRC (author)JhonDee2015-11-10

De nada! Comprendé un poco :D

sawala (author)2014-12-02

Nice write up-even a newcomer like me can understand it.I have a question- Is it essential that attiny 2313 first needs to be boot loaded before programming it? sureshparanjape

HavocRC (author)sawala2014-12-04

Not sure. I never had any problems with bootloading one. I just bought it, connected it up to my arduino and it worked fine.

sawala (author)HavocRC2014-12-05

Sorry, I couldn't follow: you didn't have any problem with bootloading or using without bootloading? I purchase my first 4313 and studying it.I am familiar in writing small sketches for atmega 328.May I ask a question related to 4313-can a sketch work with same language on 4313? I have written a sketch for controlling heater and want to use 4313 for the purpose.Thanking you.Sawala

HavocRC (author)sawala2014-12-05

Sorry it was confusing :D . I didn't have to any boot loading or anything. I was able to program it (using the methods in my i'ble) straight from the manufacturer.

If you are just using inputs (i.e. light sensor) and output to like a relay your code will work. Just be aware there are certain functions that don't work such as using servos, melody, or quite a few other functions. Try googling attiny master slave and you should find some things that will allow you to use servos with the attunes.

But if you aren't doing anything complicated then you can just upload the same code for your 328 to the 4313.

Hope that helps. . .

Good luck.

AhamedF (author)2014-09-20

(OR) please send me programming area around MADURAI. i am weighting for your better reply.

AhamedF (author)2014-09-20

Dear friend, i have doing my project, i am using ATtiny 2313, i have program and Hex.code, i have no programmer kit, so i want your help. My mail id is

baecker03 (author)2014-09-02

works great, for clarifications sake... it's sometimes easy to get mixed up between digital pin 7 and the hardware 1-20 "7". before chucking it in frustration, digital pin 7 is actually pin 9, just for people like me who make easy mistakes :)

bobby134 (author)2014-04-17

Thanks a ton for this i was about to lose it before where I was on all of these confusing sites for this board

About This Instructable




Bio: 19 year old hobbyiest and future EE.
More by HavocRC:DIY FPV Antenna Protector CaseControl Your RC Plane With Your Phone's AcclerometerDIY Receiver Controlled Switch (Cheap and Easy)
Add instructable to: