ATtiny2313 Tutorial Introduction

Created on: 23 January 2013

Part 1 of the ATtiny2313 Tutorial

In this first part of the multi-part ATtiny2313A tutorial, we look at what hardware and software is needed to start development work using this 20-pin 8-bit AVR microcontroller from Microchip (formerly from Atmel). This includes the older ATtiny2313 part.

All aspects of development will be covered, including hardware interfacing, software development, internal peripherals, fuse programming and more. An electronic breadboard will be used to build the circuits in this tutorial series.


In order to follow this series of tutorials on the ATtiny2313, you will need to have some experience in the following fields.

Building Circuits

It is assumed that you have some basic knowledge of electronics and that you can build breadboard circuits. If not, learn about electronics and how to build breadboard circuits in the Start Electronics Now course.

Software Development

To be able to do your own software development, you will need to be able program in the C programming language. If you do not know the C programming language, then it is still possible to follow the tutorials as you will be able to load the C program examples to the microcontroller without having to write your own programs.

Hardware Requirements

Electronic Components

An ATtiny2313 microcontroller in a dual inline package (DIP) is needed (this package is called PDIP in the Atmel literature – Plastic Dual Inline Package). It is recommended to get the ATtiny2313 microcontroller with part number ATTINY2313-20PU.

Other electronic components such as LEDs, resistors, capacitors, etc. are also needed. The required components will be listed in each part of this tutorial as needed in each part.

Breadboard and Power Supply

An electronic breadboard and wire links are needed for building the circuits.

A 5V (five volt) power supply is required for powering the circuits. The 5V from a PC power supply can be used.

Hardware Tools

In order to load a program to the ATtiny2313, a programming device is needed. This device is connected to the USB port of a PC. The header of the programming device is then connected to certain pins of the ATtiny2313 in order to load a program to it.

There are several AVR programming devices to choose from. Some are for programming the AVR microcontroller only, but others have debugging capabilities as well. Some popular programmers are listed below.


The AVRISP mkII is an AVR programmer from Atmel for in-system programming (ISP) of AVR microcontrollers. This programmer does not have any debugging capabilities.

AVR Dragon

The AVR Dragon is an AVR programmer from Atmel for in-system programming, debugging and high-voltage programming (HV programming). HV programming is used to reset certain internal fuse bits of the AVR that ISP programmers can't reset.

The AVR Dragon is a good choice of programmer as it has more capabilities than a plain ISP programmer.

Be aware that the AVR Dragon is not supplied with any cables. You will need to buy a standard USB cable (not the miniature type) as well as a ribbon cable with a 6-pin (2 by 3 pin) IDC female header on each end. That will be fine for use on this course.

There are two other ribbon cables that can also be plugged into the AVR Dragon. One is for the JTAG connector which is used on some AVR microcontrollers (not the ATtiny2313) and is a 10-pin header (2 by 5 pins). The other ribbon cable is for connecting to the 20-pin (2 by 10) HV programming header and is needed only if doing HV programming.

Home Made Programmer

There are several AVR programmers that can be built at home (for ISP programming only, not for debugging). There is one that works from the PC parallel port and one that works from the PC serial port. Do a search on the Internet to find these.

Another home built AVR programmer that works from a USB port is the open source USBtinyISP. You can build this programmer yourself from scratch or buy a kit and build it.

These home built programmers may need other software to be loaded in order to use them and may not be able to be used directly from within the Atmel AVR Studio software that we will be using in this course.

Software Requirements

Microchip Studio (formerly Atmel Studio version 6.0) is the software development environment and toolchain used in this course. This course was designed and tested using Atmel Studio 6.0 running on Windows 7.

Other versions of Atmel Studio and other versions of Windows should also work.

Getting Set Up

To get the required software installed and to test program the hardware, follow the article Starting AVR 8-bit Development on this website.

This article uses the AVRISP mkII to program a ATtiny2313 microcontroller circuit that flashes an LED on and off. If you are using the AVR Dragon instead, just select the AVR Dragon in the Atmel Studio settings instead of the AVRISP mkII. For other programmers, you will need to follow their specific software requirements and usage instructions.

Once you have followed the above article, you will have the software and hardware installed and tested. You will then be ready to follow the rest of the parts of this tutorial.