Introduction: Bootloading ATmega328 With Arduino Mega2560
Today we are going to burn a bootloader in to ATMega328PU using an Arduino Mega 2560. This method can also be used on the ATMega8 16PU and other microcontrollers.
Parts List: 1xATmega328
1xArduino Mega 2560
1x 16Mhz Crystal
1 x 100uF capacitor
2 x 22pF capacitors
1 x 1k Ohm resistors
1 x LED
And some jumper wires
The wiring is very simple
pin name: ATMega328 Mega(1280 and 2560)
RESET:1:53
MOSI:17:51
MISO:18:50
SCK:19:52
Note: LED goes to pin 19 with the 1K resistor on the ATMega328 and the 100uF Capasitor is needed after we upload the sketch to the arduino Mega 2560.
Step 1: Uploading the ArduinoISP
Uploading the Arduino ISP sketch
After you have made all the connections beetween the arduino and the ATMega328 (Do not Have the 100uF capacitor connected on this step)
Wew need to upload the ISP sketch into the arduino.
Go to File>Examples>ArduinoISP
Now we need to select our arduino board Tools>Board>Arduino Mega2560
Now we need to Set our Serial Port in my case is COM 4
Tools>Serial Port>COM4
Ok now we are ready to upload the Sketch.
We hit upload and wait till the sketch is uploaded.
Step 2: Burning the Bootloader
To Burn the bootloader we neet to select our microcontroller.
We go to
Tools>Board>Arduino Pro or Pro Mini (5v, 16mhz) With ATmega328 We leave the port the same COM 4 in this case.
Now we need to add that 100uF Capasitor between the Mega2560 Reset and 5V.
Now all we do is go to Tools>Burn Bootloader.
The LED is gonna start to flash and seconds later we are done.
The LED will stay on once the bootloader is uploaded into the microcontroller, if you want to upload a sketch just leave everything connected the way it is and open the sketch for example blink and go to file>upload using programmer and you should see the LED blinking. I have used this method many many times with Atmega328 and the older ATmega8 16 and I have never encounter any problems at all.
12 Comments
5 years ago
Note that with Arduino IDE 1.6.6 and newer the ArduinoISP sketch is found at File > Examples > 11.ArduinoISP and you need to connect pin 10 of the programmer board (Mega in this case) to the reset pin of the target microcontroller, not pin 53 of the Mega as it used to be with earlier versions of the ArduinoISP sketch.
7 years ago
I can't find 'arduino pro or pro mini(5v,16mhz) w/ atmega328 pu' in board menu.
Should i have to install and additional board?
Please help.
Thanks!!
Reply 5 years ago
you have to use 1.0.5 IDE thank you
5 years ago
if you upload all step properly using 1.8.5 IDE will be more helpfull
5 years ago
i get-----avrdude: stk500_getsync(): not in sync: resp=0x00
error when i load program to breadboard Atmega328. my port com4 and programmer ----Arduino as isp and also broad set as you say... i can properly burn bootloader but failed to upload program to breadboard Atmega328
Please Help me sir............thank you
7 years ago
Works perfectly! This tutorial is the only complete, functioning way that I can see on the net to make the Arduino Mega ADK function as an ISP. Just out of curiosity and learning, why is the 100uf cap needed across reset and +5 rails? I ask, because the boot loader will not burn without it.
Reply 7 years ago
to disable the autoreset function on the mega.
if the autoreset is still there the sketch will not upload to the pro mini
8 years ago on Introduction
Try holding down the shift button when uploading the sketch. Otherwise you upload the sketch to the mega. When you hold your cursor over the upload button then press SHIFT with the latest 1.6.3 Arduino IDE it will say UPLOAD "USING PROGRAMMER"
8 years ago on Introduction
I have tries this method several times with my 2560 and ATmega328-PU to no avail. The bootloader completes successfully but when I upload a sketch, such as blink on digital pin 8, nothing happens.. Any help would be much appreciated
Reply 8 years ago
Does the sketch upload to your microcontroller with out any problems?
Reply 8 years ago on Introduction
I actually think it was just a bad chip. I tried another one and it worked flawlessly. Thank you :)
9 years ago on Introduction
To burn the bootloader onto a ATMega8 16PU, everything stays the same except when choosing the microcontroller you go to Tools>Board>Arduino NG or Older w/ATMega8
Like I said before I have never run into any problems using this method.