How to Program ATtiny2313

About: 19 year old hobbyiest and future EE.

Intro: 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

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. http://www.mediafire.com/download/ju012s124w4gbl2/tiny.zip

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

  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

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.

Arduino--------Attiny2313
  |                   |
13------------>19
12------------>18
11------------>17
10------------>1
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!

  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.

Troubleshooting:
  • 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!

Share

Recommendations

  • Tiny Home Contest

    Tiny Home Contest
  • Fix It! Contest

    Fix It! Contest
  • Metalworking Contest

    Metalworking Contest

29 Discussions

0
None
SpikeSmall

6 months ago

I cannot work out how to fix this error message: avrdude: Yikes! Invalid device signature. Double check connections and try again, or use -F to override this check.

Is there any one way to fix this? I've read that I may need to use an external clock, which would make sense as I acquired my 2313 from a Maplin DIY alarm clock kit, but I though perhaps it wasn't necessary...

Any ideas??

3 replies
0
None
RubenD48SpikeSmall

Reply 6 months ago

Hello SpikeSmall,

Connect a 10 uF capacitor between “Reset” and “Ground” pins on the Arduino Uno board as shown in the diagram. The stripe of the capacitor with the negative sign (“-”) goes to the Arduino “Ground” pin. This prevents the Arduino Uno from resetting and ensures that the Arduino IDE talks to the ArduinoISP (and not the bootloader) during the upload of the sketches to the ATTiny.

I think this is the problem.

Grz Ruben

0
None
SpikeSmallRubenD48

Reply 6 months ago

Thanks for the reply, but I still get the same error.

I used a 100uf capacitor instead as it was the only one I had.

0
None
abeautifulplace

6 months ago

Hello, noobish question, can i program ATtiny with an Adruino Micro or Nano ? Thanks !

4 replies
0
None
HavocRCabeautifulplace

Reply 6 months ago

Yep you absolutely can. Just look up the pinout, you will need +5v, GND, MISO, MOSI, RST (Reset) and SCK.

Yes you can use the Arduino language across it's different chips, just keep pinouts in mind. Some various libraries won't work with certain chips too, so keep that in mind.

hello sir thnx for ur answer.i want to make wheel spoke pov light.and i finally found in adfruit.but problem is they use attiny 2313 chip and attinyusbisp for programme.but here i cant found this kind of chip here.and my question is how can i run same code in atmega 328p and run code same as attiny 2313. what is different between usbasp and usbisp....

0
None
amitchautmal

9 months ago

this massage continuously showing while i programming delay sketh why?

i have done all correct connection and setup as shown above. want a solution.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Warning: platform.txt from core 'Arduino Tiny' contains deprecated tools.avrdude.cmd.path={runtime.ide.path}/hardware/tools/avr/bin/avrdude, automatically converted to tools.avrdude.cmd.path={path}/bin/avrdude. Consider upgrading this core.

Warning: platform.txt from core 'Arduino Tiny' contains deprecated tools.avrdude.config.path={runtime.ide.path}/hardware/tools/avr/etc/avrdude.conf, automatically converted to tools.avrdude.config.path={path}/etc/avrdude.conf. Consider upgrading this core.

Warning: platform.txt from core 'Arduino Tiny' contains deprecated recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{build.path}/{archive_file}" "{object_file}", automatically converted to recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{archive_file_path}" "{object_file}". Consider upgrading this core.

Warning: platform.txt from core 'Arduino Tiny' contains deprecated recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm, automatically converted to recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} -o "{build.path}/{build.project_name}.elf" {object_files} "{archive_file_path}" "-L{build.path}" -lm. Consider upgrading this core.

exec: "avr-g++": executable file not found in %PATH%

Error compiling for board ATtiny2313 @ 8 MHz.

This report would have more information with

"Show verbose output during compilation"

option enabled in File -> Preferences.

1 reply
0
None
amitchautmalamitchautmal

Reply 9 months ago

i have downloaded new file from arduino website for at tiny 2313 a and its working good as expected . insted of downloading abou file use arduino official vebsite file.

0
None
JonasN1

1 year ago

in "additional boards manager ulrs".

add this line

http://drazzy.com/package_drazzy.com_index.json

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.

0
None
GabrielC189

1 year ago

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

ERROR COMPILING FOR BOARD ATTINY2313 @8 MHZ

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.

2 replies
0
None
HavocRCGabrielC189

Reply 1 year ago

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

0
None
SomadityaS1HavocRC

Reply 1 year ago

i am having the same problem

please be elaborate.

thanks

0
None
SomadityaS1

1 year ago

it says as an error

recipe.preproc.macros pattern is missing

0
None
Heyup

2 years ago

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

0
None
JhonDee

2 years ago

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.