ArduinoISP

Author Gravatar Image TYLER COOPER

Introduction

A lot of people start learning about microcontrollers with an Arduino but then want to build their own projects without having to sacrifice their dev board. Or maybe they want to make their own Arduino variant, that is compatible with the IDE. Either way, a common problem is how to burn the bootloader onto the fresh AVR chip. Since AVRs come blank, they need to be set up to be Arduino IDE compatible but to do that you need an AVR programmer (like the USBtinyISP).

The good news is that you can burn bootloader using your existing Arduino with only a little bit of work. There's even a minitutorial on the arduino.cc site.

This tutorial is an extention of that tutorial. First we'll show how you can make a permanent bootloader-burner by soldering a 28-pin ZIF socket to a proto shield and use the PWM output line of the Arduino to generate a clock. This will let you 'rescue' many chips that have been set to the wrong type of oscillator, or change ones that are set from external oscillator (most Arduino bootloaders) to internal (such as the lilypad).

Parts

You will need…If you bought the kit from Adafruit, you'll have an extra few items such as a Piezo beeper, LEDs, buttons, etc. that you can use for the Standalone version of this project, just ignore them for now!

Assemble

First up, place the ZIF socket on the proto shield like so:
Solder all 28 pins for a solid connection!
Solder the following wires to the ZIF socket
  • Pin 1 to digital 10 - Blue Don't forget to bend the wire over underneath to connect to the ZIF socket pin when soldering!!!
  • Pin 7 to 5V - Red
  • Pin 8 to Ground - Black
  • Pin 9 to digital 9 - Gray
  • Pin 17 to digital 11 - Brown
  • Pin 18 to digital 12 - Orange
  • Pin 19 to digital 13 - Yellow
  • Pin 20 to +5V - Red
  • Pin 22 to Ground - Black
Follow the protoshield tutorial to solder in the Red LED into LED1 position, Green LED into LED2 position. Also solder in the two 1.0K resistors next to the LEDs. We'll use the LEDs as indicators. Then solder a wire from the LED2 breakout (white) to analog 0 and a wire from LED1 breakout (white) to digital 8.
Finally, you'll need to solder on the header to allow the shield to be placed on, break the 0.1" male header and place it into the Arduino sockets. Then place the shield above on top to solder it in place.

Load the Code

Time to load the sketch! Grab the code from our Github repository and paste it into a new sketch. Then upload it to the Arduino.
We have a report that this procedure does not work with Arduino 1.5.2. Use the latest mainstream Arduino release instead!
Plug the shield on top, lift the latch, pop in the chip and then lower the latch. Make sure the chip orientation is like so (so with the lever on the left side you can read the text):
With the USB cable still plugged in (and the same Serial port selected as before) Select Tools→Burn Bootloader→w/Arduino as ISP
On newer versions of the Arduino IDE, select Arduino as ISP from the Tools→Programmer menu, then select Burn Bootloader from the Tools menu.
The Green LED will be on during the programming, when its done you'll see this message and the LED will turn off.
Thats it! Don't forget, you can burn a few different kinds of bootloaders, such as Uno, Duemilanove, Lilypad so depending on your situation you may want to use one over the other.

Bonus! Using with AVRdude

You can use ArduinoISP from the command line very easily, with AVRdude which is the standard program used to program AVRs by running:
Copy Code
avrdude -c arduino -p atmega328 -P COMPORT -b 19200 -U flash:w:filetoburn.hex
Instead of atmega328 you can also program atmega8 atmega88 atmega48 atmega168, etc.
Last updated on 2014-04-24 at 09.30.23 PM Published on 2013-01-12 at 10.00.13 PM