Introduction: How to Use Arduino Mega 2560 As Arduino Isp

About: I like electronics and make allot of stuff. I also enjoy helping other people whit problems that i have endured and couldn't find an easy solution for. I Design pcb's , and i study Embedded Systems Engineerin…

When i build my Atmega328p-pu on a circuit board for my moped i needed to bootload it.
Because i have none external programming equipment i needed to use my Arduino Mega 2560 as ArduinoISP ( http://arduino.cc/en/Tutorial/ArduinoISP  ) . 


You need:
-Arduino mega
-Breadboard or pcb made atmega chip arduino
-100nF capacitor
-usb cable for arduino mega 2560 -> pc
-arduino IDE ( http://arduino.cc )
-some wires to connect the arduino mega 250 to your homemade arduino.

One of the difficulties of the mega board is that all the pins are different so most tutorials who are aimed at the UNO board or the Duemilanove or Diecimila are useless because the Mega board pinout is different.

To know which pinout is needed for the Arduino Mega 2560 the arduino.cc website has a special webpage : ( http://arduino.cc/en/Main/ArduinoBoardMega2560  ) .

This is how you need to wire up your arduino mega 2560 to an Atmega 168/328 (same pinout)  microchip : See picture above

PS. For the exact pinout of an Atmega 168/328 chip look : http://softsolder.files.wordpress.com/2009/09/arduino-vs-atmega168-chip-pinouts.png?w=640&h=302

The High resolution picture of how to hook the arduino up : http://i54.tinypic.com/k55pb9.png

Step 1: Uploading the ArduinoISP Sketch

Now open the latest version of the Arduino IDE (currently 0022) .
Goto Tools
                     -> Board
                                      ->  Arduino Mega 2560

Now choose the correct Com port via Tools -> Serial port -> select the port used by you're arduino mega 2560.

Goto File 
                -> Examples
                                       -> ArduinoISP

The ArduinoISP sketch will open up and now click upload to upload the sketch to the Arduino Mega 2560.

When the sketch is fully uploaded  Put a 100nF Capacitor Between +5V and RESET pin on the Arduino Mega 2560 to disable auto reset. (whitout this tutorial wont work !)

Step 2: Time to Burn the Bootloader

Picture 1: First: select the board you want to upload to. 
Ex. for my Atmega328 chip and an external 16MHz crystal i chose: Arduino Duemilanove or Nano /w Armega 328 ( see pic 1 )

Picture 2:  Goto Tools -> Burn Bootloader -> w/ Arduino as ISP
The board will begin bootloading.

Picture 3: When bootloading is successful you can enjoy your new homemade Arduino.

If you get errors :

1. Make sure you selected the correct board ( Picture 1 )
2. When getting this error:  avrdude: stk500_getsync(): not in sync: resp=0x00
You did not put an 100nF capacitor between +5v and RESET pin on the Arduino Mega 2560
3. IF you still get another error search on google 
4. If you still find no solution goto arduino forum : http://arduino.cc/forum/index.php/board,67.0.html
and post your problem + a link to this instructables.


Step 3: Finally Uploading the Programs to Your New Arduino

When your arduino is not set up whit auto-reset (DTR) you will have difficulties uploading new programs to the arduino.
And you will get this error: " avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51 " 

This means the arduino IDE could not reset the arduino and so the upload has failed.

To fix this you can try (depends on hardware etc...) :
1. Press reset button on your arduino when "Binary sketch size: xxxx bytes (of a xxxxxxx byte maximum)" appears.
2. If that does not work you can try to put the usb cable in the computer but not in the arduino. When the "binary sketch" stuff appears you quickly put the usb cable in the arduino and see if it uploads without and error.
3. If that still doesn't work you can try to hold the reset button on the arduino , press upload in the arduino IDE and release the reset button when the "binary sketch size ... " stuff appears.
4. If that still doesn't work you can try to press reset after the " binary sketch size ... " and hod it for 2-10 seconds ( it depends on hardware how long you need to hold it)
5. If that still doesn't work you can try to bootload it again and see if it was an error in the primary bootloading.
6.If that still doesn't work you can try to use ur other arduino ( if you have another) to program the second arduino 
   This link for more info: http://www.arduino.cc/en/Hacking/Programmer .
7. If that still doesn't work you can ask for help on the arduino.cc forum , maybe ur arduino microchip is dead ?
or a fake .  http://arduino.cc/forum/

i hope i could help you!
Greetz spike

USB Contest

Participated in the
USB Contest