Arduino as AVR Programmer

For my project I need two Arduino boards, but I have only one Arduino Mega 2560 board (refer Fig. 1). I can either buy an Arduino Uno board (that costs approx. Rs. 1400 in India) or I can make an Arduino board using a fresh ATmega328/ATmega328P chip.

Suppose you have an Arduino board that is built on ATmega328P or ATMega8A-PU chip and, due to some reasons, the chip has gone bad (like in my case). You can buy another chip from the market for approx. Rs. 140, replace the old chip and then try to upload some Arduino sketches from EFY DVDs.

Arduino Mega 2560 board

Arduino Mega 2560 board (Courtesy:

Wow! Nothing happens and the board behaves like a dead rock! That’s right! Because you have inserted a raw chip that does not have an Arduino boot loader preloaded.

There are a number of AVR programmers available in the market for uploading the codes into chips, but most of these work with hex files or assembly-level programming languages, which I hate to work with.

I kept exploring the Internet, looking for someone who might be able to program a raw microcontroller using Arduino Uno as an in-system programmer. But success with bigger microcontrollers like ATMega2560 chip is hardly known. After trying and tweaking, this is what I finally got, and it is just wonderful. It is possible to make Arduino as an AVR programmer as described in this article.

I can now program ATmega328P, ATmega328, Attiny 13A, 44, 45, ATMega8A-PU and ATMega8L-PU chips using my Arduino Mega 2560 board as a programmer. Arduino Mega 2560 board is based on the ATMega 2560 chip.

Basic requirement for making Arduino
First, transfer the Arduino boot loader onto a raw factory-cut chip, which requires nearly 512 bytes of space. Once that is done, upload the Arduino sketch onto the remaining space of the chip to do the bull work. But, these two steps are not that simple. You need relevant software and hardware set-up as described here.

Software. Relevant codes are: avr_isp.ino, avrdude.conf and boards.txt.

Download source code: click here

You also need Arduino IDE. Arduino IDE version 1.0 is the most stable version that I use on my Ubuntu laptop. It is assumed that you too have one of the stable Arduino IDEs installed and working perfectly on your PC. You can find the boot loader code under hardware/Arduino folder.

Hardware. You need Arduino Mega 2560 board, a fresh ATmega328 or ATmega328P chip, 16MHz quartz crystal, two 22pF ceramic capacitors, one 1µF, 16V electrolyte capacitor, an LED and optional push-to-on switch for the reset button (not shown here). The circuit connection details are shown in Fig. 2. 5V at CON1 is not required during programming.

The quartz crystal of 4MHz/ 8MHz/16MHz can be used, but it is optional. Note that, once a chip is programmed with a 16MHz crystal, you cannot re-program it back to 8MHz internal oscillator. If no quartz is used, then 22pF capacitors are not required.

Make your Arduino as AVR programmer
First, connect your Arduino Mega 2560 board to your PC, start Arduino IDE and upload avr_isp.ino file onto your Mega 2560 board. Once this is uploaded, your Mega 2560 board is ready for acting as a programmer.

Loading boot loader into ATmega328P. Now, it is time to look at the chip that you have purchased. If it is ATmega328P, then it can be programmed very easily because it has a common signature, which has been taken care of in Arduino IDE.

 Connections to make Arduino Mega 2560 board

 Connections to make Arduino Mega 2560 board as AVR programmer

Just make the connections as shown in Fig. 2 and select the board as ATmega328 (on a breadboard with 8MHz internal clock) or Arduino Uno if you connect 16MHz quartz crystal. Then, put the capacitor between the reset pin and ground pin of Arduino Mega 2560 board (now call it the AVR programmer board). The capacitor prevents the programmer board from self re-setting, while uploading the boot loader code into the target board. Open Arduino IDE, go to Tools → Board (select your board). Next, go to Tools → Burn Boot loader.

Now, lights on the programmer board start blinking. If you have put LED on pin 19 of the target board, this too will start blinking, and after some time everything will stop. The boot loader has now been burnt into the new ATmega328P chip.

Loading boot loader into ATmega328. If the chip that you have purchased is ATmega328 (without a P), it makes all the difference. The programmer window will say that the chip signature is different—that is no reason to worry.

ATmega328 chip has an onboard 8MHz internal oscillator. That means, in absence of a quartz crystal oscillator, the chip can still be programmed and work at 8MHz speed. Unfortunately, this is not visible in the boards section, unless boards.txt file of Arduino is changed to make so. Replace /usr/share/arduino/hardware/arduino/boards.txt file with the new boards.txt file that you have downloaded.

Read More Detail: Arduino as AVR Programmer

About The Author

Ibrar Ayyub

I am an experienced technical writer with a Master's degree in computer science from BZU Multan University. I have written for various industries, mainly home automation, and engineering. I have a clear and simple writing style and am skilled in using infographics and diagrams. I am a great researcher and is able to present information in a well-organized and logical manner.

Scroll to Top