Logo

AVR Microcontroller ISP programming tutorial

Back

Introduction

Here's a short tutorial on how to program an 8-bit AVR microcontroller with ISP (In-System Programming). I'll show a basic circuit for connecting an ATtiny microcontroller to an external programmer, and hopefully we will be able to send a couple of lines of code to the microcontroller.


Hardware

For this tutorial I'll be using an ATtiny45 microcontroller, an 8-bit, 8-pin microcontroller with 4KB of programmable flash memory. It's not a powerful microcontroller in terms of speed, number of input/outputs and ADCs, but it's a good place to start C-programming AVR microcontrollers.


Circuit

First, get one of those 400 point solderless breadboards, and place the microcontroller like in the following picture. I use the upper red rail for supply voltage (red wires), and the lower rail for ground (black wires). The ATtiny45 requires a supply voltage between 2.7-5.5V, and make sure you don't exceed the upper limit. I connect pin 8 on the microcontroller to +5v, and pin 4 to ground.


Next step is to wire the reset pin on the microcontroller. I've added a second supply voltage rail (lower red rail). I connect a 4.7kOhm resistor to this rail, and add a blue wire to the reset pin (pin 1). I add a pushbutton and wire it to ground. The resistor will keep the reset pin at a logical high voltage level, but pushing the pushbutton will ground the reset pin, and reset the microcontroller. A 1uF capacitor is used for debouncing the pushbutton.



Only thing left to do now is to connect the ISP programmmer to the circuit. There are two versions of ISP connectors, 10-pin and 6-pin. In this tutorial I'm using the 10-pin connector, but I'll show the pinout of both below.



Here's how the final circuit will look like. Be careful if you're connecting the programmer to the microcontroller via an ISP header, because the pins will be mirrored. The USBasp programmer can provide +5v to power up the microcontroller (from the Vcc pin). If your programmer cannot provide power to the microcontroller, an external power source must be used.


Back

last edited: 2016.12.16

Components used

ATtiny45 Microcontroller

USBasp ISP programmer

Solderless breadboard

Innovation + Robotics = Innovabotics