Summary of How to program a AVR (arduino) with another arduino using atmega168 microcontroller
This article explains how to repurpose an Arduino with an ATmega168 or a clean AVR chip into an In-System Programmer (ISP) using Randall Bohn's Mega-ISP sketch. This setup eliminates the need for external programmers like USBTinyISP, allowing users to program various chips such as ATtiny2313 or ATmega328 directly via breadboard connections or ISP headers.
Parts used in the Mega-ISP Project:
- Working Arduino or clone (e.g., BBB or RBBB)
- Target AVR chip (tested with atmega8, atmega168, atmega368, attiny2313, attiny13)
- Breadboard or board with ISP header
- 3 LEDs
- 3 Resistors
- Breadboard wires
This instructables is usefull if:
* you’ve got your arduino with atmega168 and you bought an atmega328 at you local electronics store. It doesn’t have an arduino bootloader
* you want to make a project that doesn’t use arduino – just a regular AVR chip (like the USBTinyISP) – you have a clean attiny2313/attiny48 etc that you want to burn firmware on.
Normally you would have to have an ISP (In System Programmer) like USBTinyISP to program your new chip. Having the arduino you can teach it to be a programmer thank to a great work done by Randall Bohn. He created Mega-ISP – an arduino sketch that works like a programmer.
Step: 1 What do you need ?
* a working Arduino (or a clone – i’m using the BBB – BareBonesBoard and a RBBB – RealBareBonesBoard by ModernDevices)
* a chip that you want to program (tested with atmega8,atmega168,atmega368, attiny2313, attiny13)
* a breadboard or a board with ISP header
* 3 leds + 3 resistors
* breadboard wires
Step: 2 Making the mega-isp programmer on a breadboard
There are two ways to connect your Arduino to program a chip.
You can plug your avr chip to a breadboard and connect 5v and GND to the respective pins (check the datasheet!) + a pullup resistor to reset and wire pins from you arduino to the chip.
These are the lines on Arduino and their function
13 – SCK
12 – MISO
11 – MOSI
10 – RST (Reset)
Or you can make a 2x3pin ISP header that you can plug into a board that provides one (another arduino board).
The pinout for the ISP header is on the third image
There are 3 leds to indicate the status of the programmer.
pin 9 – blue led – its the hearbeat of the programmer.
pin 8 – red led – indicates an error
pin 7 – green led – indicates that the programming is taking place
(i was lazy so i didn’t match the colors in my setup)
Here are the drawings made in Fritzing
You can alsa make a MEGA-isp shield. Yaroslav Osadchyy designed the shield in eagle. You can get the eagle files on his site: http://drug123.org.ua/mega-isp-shield/
Step: 3 Uploading the sketch
Download the sketch from mega-isp google code.(avrisp.03.zip at the time of writing).
Unpack it and run arduino ide and open avrisp.pde.
Upload it to your arduino board.
Heartbeat led should start beating.
For more datail: How to program a AVR (arduino) with another arduino using atmega168 microcontroller
- What is the primary purpose of this project?
To teach an Arduino to function as an In-System Programmer for other AVR chips. - How can you connect your Arduino to program a chip?
You can either plug the AVR chip directly onto a breadboard with specific wiring or use a 2x3pin ISP header. - Which Arduino pins correspond to SCK, MISO, MOSI, and Reset?
Pins 13, 12, 11, and 10 are assigned to SCK, MISO, MOSI, and RST respectively. - What does the blue LED indicate on the programmer?
The blue LED connected to pin 9 acts as the heartbeat of the programmer. - Can this method be used for chips without an Arduino bootloader?
Yes, it is specifically useful for chips that lack a bootloader or for projects not using the Arduino environment. - Where can I find the Eagle files for the Mega-ISP shield?
The Eagle files designed by Yaroslav Osadchyy are available on his website drug123.org.ua. - What file must be opened in the Arduino IDE to start the process?
You must open the avrisp.pde file after unpacking the downloaded avrisp.03.zip archive. - Does the green LED always stay lit during programming?
No, the green LED on pin 7 indicates that the programming is actively taking place.


