Let's Make Robots!

Make an Arduino into ISP programmer

Burn the bootloader or write sketches directly to the MCU

The Arduino and Arduino compatible boards all use a small program called a bootloader to take serial data from your computer and store it in the Arduino's memory. You will need to "burn" the bootloader into the chip if:

  1. You are building your own board and have bought a blank chip.
  2. Your 5V rail dropped too low for too long and your bootloader was corrupted (perhaps due to flat batteries).
  3. You overwrote your bootloader at some time to save memory.

Fortunately The Arduino IDE includes a program called "ArduinoISP" that allows you to use one Arduino board as a programmer to burn the bootloader into another board (the target).

Using the latest versions of the Arduino IDE (V1.0 or later) you can write your code directly to the MCU without using the bootloader. This can overwrite the bootloader to give you more memory. The disadvantage of this is that you cannot update your code later using the USB interface.

PLEASE NOTE: This tutorial was written using Arduino 1.02 which was the latest at the time. I have used these techniques with 1.04 without any problems but some people have had trouble with 1.05 and later. If you cannot get this tutorial to work with 1.05 or later then please use 1.04.

I normally use an Arduino Nano as a programmer because of it's small size. This allows me to burn a bootloader or write code directly to the MCU by simply plugging it into the ISP header. I have used some hotglue to hold my jumper wires in a 3x2 configuration so that all I need to do is line up my white wire with pin one on the board.

In this tutorial I will show you how to convert almost any Arduino, Arduino clone or Arduino compatible board that uses an ATmega 8,168, 328, 1280 or 2560 into a programmer. I will then show you how to use it to program any other board that uses one of these processors. This tutorial does not cover some of the newer boards such as the Leonardo or the Due. You will need:

  • An Arduino, Arduino clone or Arduino compatible board with 5V logic to use as your programmer. 
  • 6x female to female and 6x male to male jumper wires. 

Optional parts if you want to program both 3.3V boards such as the LillyPad as well as 5V boards.

  • 3x 4K7 resistors.
  • 1x diode (1N4001 or 1N4148).

 

Step 1
Open your Arduino IDE version 1.2 or later. If you have an earlier version then these instructions may not work. You can download the latest version here: http://arduino.cc/en/Main/Software

Step 2
Go to File menu and select ArduinoISP from the Examples menu. There are instructions at the start of the program that explain the ISP interface pins. There are also instructions for adding LEDs but these are optional and are not shown in this tutorial.

Step 3
Go to the Tools menu and select the com port and board type that matches the board you are going to use for a programmer. Upload the ArduinoISP sketch into your programmer.

Step 4
Disconnect the USB cable and any other power source before you begin. At the begining of the ArduinoISP sketch there is information about what pins to use for the programmer as shown below. There is also some instructions for wiring up LEDs but these are optional and not included in the tutorial.

Note: in the above diagram that pin 5 of the target ISP header is always connected to reset. When you connect your wires to the programmer this wire will connect to D10 or D53 instead.

Start by connecting wires to your programmer. In my photos I use a different colour for each wire but I always use red for +Vcc and  black for ground. Be very careful with Vcc and Gnd. If you accidentally swap them then you could fry something.

Below I show 4 different boards wired as a programmer. In each case, I am using the yellow wire for reset and it is plugged into D10 or D53. Note that all my boards have male header pins so I am using female to female jumper wires.

If you are using an Arduino that only has female headers for your programmer then you can join a male to male jumper wire with a female to female jumper wire to make a male to female jumper wire.

Step 5
You can skip this step if you only want to program 5V target devices or if your target is a Micro Magician controller from DAGU. The Micro Magician already has the resistors and diode installed and can be programmed by both 5V and 3.3V programmers.

If you want to program both 5V and 3.3V target boards you will need to cut some of your wires and solder the resistors and diode in the middle of the wire as shown in the diagram below. make sure to use heatshrink or electrical tape to insulate your components and solder joints.

All ATmega processors have clamping diodes on the I/O pins to protect them from static. By placing 4K7 resistors in series for MISO, MOSI and SCK we limit the current through these clamping diodes to a safe level to prevent damage. The clamping diodes can then limit the 5V programmer's signals to a safe level for the 3.3V target. The diode allows the programmer to pull the target's reset pin low otherwise the target's reset pin is held high by a pullup resistor within the taget PCB.

The diagram below shows the standard programming cable and then the 5V to 3.3V version.

Note that the Vcc is not connected. When programming a 3.3V target, the target should be powered seperately. The grounds are linked by pin 6 of the target ISP header.

Step 6
Connect the jumper wires to your target board ISP header. It is very important that you connect them correctly to prevent possible damage. There will always be some indication which pin is pin 1 of the ISP header. It is often a triangle or spot printed next to the pin.

In the case of the Lily Pad PCB shown below, pin 1 of the header has a square pad while the other pads are round. In the case of the Lily Pad shown below, you may want to use alligator clips to connect to the apropriate petal. As you can see here, ISP pin 1 connects to petal D12.

Once you have connected your target, recheck all your pins, especially your power pins, Vcc and Gnd.

 

Step 7
Plug in your USB cable to the programmer. If the power LEDs on your boards light up dimly or not at all then quickly unplug your cable and recheck your wiring. Go back to the Tools menu and this time select yhe board type to match your target board. Your com port will still be that of your programmer. In my example here, the target is a MiniDriver from DAGU which uses an ATmega8A.

Step 8
Go to the Tools menu again and make sure you have your programmer set to Arduino as ISP. You can now click on Burn Bootloader.

I have found that sometimes you will get an error message for no apparent reason.

Select Burn Bootloader a second time and it should work. If not, re-check your wiring. Be patient, Burning the bootloader is slower than uploading a sketch. You will see the RX, TX and D13 LEDs on your programmer flash slower than with a normal upload.

Step 9
Once you know your wiring is correct and the bootloader has burned successfully you might want to glue the ISP header wires together so that you have a single 3x2 header rather than 6 individual wires. I cable tied my wires first and then applied some hot glue. This makes it easier for future use.

Step 10
Using your programmer to load a sketch directly into the MCU via the ISP header is a relatively new feature of the Arduino IDE. This method of programming has 2 advantages.

  1. You can use the memory normally reserved for the bootloader which is useful for big sketches.
  2. You can program boards that do not have a built in USB interface.

The only disadvantage is you must always use a programmer to update your sketch. If your board does not has a built in USB interface then you will still need an external interface to use the serial monitor for debugging.

To upload your sketch via the programmer you must first go to the Tools menu and make sure that the com port is set to that of your programmer but the board type is set to that of the taget board (same as when you burn the bootloader).

Open your sketch, I'm using the blink example, and then go to the Files menu again to select Upload Using Programmer.

As with burning the bootloader, you may get an error on the first attempt but it should work fine by the second attempt. Once you have uploaded a sketch by this method you will need to re-burn the bootloader before you can upload sketches the normal way.If you do not then you will get this error:

Burning the bootloader is no different to uploading any other sketch except for it's location in memory. Re-burning the bootloader will not reduce the life expectancy of your Arduino.

One advantage of writing your sketch to a board that uses an ATmega8 is that you eliminate that annoying wait at the start. In the photo below I have written the Arduino ISP sketch directly to the Mini Driver and am now using the Mini Driver as a programmer without any start up delay.

The Arduino Mega and compatible controllers can also be used as programmers just as easy. Normally I do not use them as a programmer simply because of their larger size.

 

 

 

 

 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

sometimes i get the common mistake for burning it for the first time...But some other times i get this

avrdude: stk500_getsync(): not in sync: resp=0x00

ot this:
avrdude: stk500_getsync(): not in sync: resp=0x15
 why??
please help

The not in sync error generally means your processor did not reset. It would help if you told us what is your terget board and what is your programmer board. A photo of your wiring would also be helpful. Below is a list of possible causes.

  • Check you connected the reset wire to reset on the target board and either D10 or D53 on the programmer.
  • Check you selected the target board type and not the programmer board type (assuming they are different).
  • Check you have the right serial port (the programmers serial port).
  • Check that nothing is connected to the boards during programming.
  • Check you have adequate power (USB might not be enough, especially if you have other stuff connected).
  • Check your USB cable. Previously I had a cable that only failed occasionally depending how it was bent.
  • Re-load your USB drivers, perhaps there is a problem with your computer?

I'm using a Duemilanove (Atmel 328 based) programmer board to put a bootloader on the Doodlebot mindriver (AtMega8_NG).  I am getting the avrdude: stk500_getsynd(): not in sync error on clicking Burn Bootloader.  I wired the ISP connectors, pin for pin.  Are there any other mods needed to get the bootloader on the minidriver?  I'm going this route since the minidriver quit working and I thought I'd start with the bootloader.  The blue (D13) LED blinks on power up a few times then stops.  It only blinks once when any programming or sketch upload starts.

Thanks,

Note in my tutorial that I would often get this error the first time but if I clicked "Burn Bootloader" a second time it worked fine.

I have not tested this tutorial on Aduino 1.05 but from what I hear it may not work so be sure to either use 1.02 which is what was used when i wrote the tutorial or 1.04 which I've had no problem with.

I'm using a Windows XP machine and a Windows 7 machine. Some users using other machines found their USB driver for the CP2102 needed to be re-installed.

I've also been caught out once with a cable that had an intermittant fault.

im trying to upload a bootloader to a atmega 238p-pu using a uno the bootloader is from this webpage http://arduino.cc/en/Tutorial/ArduinoToBreadboard its the one that uses the internal 8mhz clock

the atmega238 allready has a bootloader on it which is why i think im having a problem because the bootloader uses a external 16mhz clock and there is not one connected to the 238 im trying to upload to but im not sure if it needs one just to upload the bootloader not unless as soon as it gets power it locks up because it has no external clock

the atmega238 is wired as so pin 1 to d10, 17 to d11, 18 to d12, 19 to d13, I've tryed it with and with out the reset of the uno connected to a 10uf capacitor how ever pin 4 on the atmega238 is connected to a led so i can upload the blenk sketch to the atmega238 so i know the bootloader was uploaded correctly

 

 

it gives this error within a second of clicking "burn bootloader"

 

I'm guessing you mean an ATmega328P-pu? You keep calling it a 238P-pu.

I'm sorry but you really need to contact the person who wrote the tutorial your following. I am not an expert on bootloaders, this tutorial only covers what I have learned.

Judging by your error I think you need to make certain you have the correct chip.

yah i meant ATmega328P-pu my bad ok thanks any way

Hi, you have very nice tutorial!!!

Last year (2012) i programmed some attiny85 with my nano 3.0 and the isp connections, not big deal, it worked well in Windows XP and Arduino 1.01 at that time.

But now (2013) i was fustrated, i tried infinite times and only get some avrdude errors.....I use Arduino 1.0.5, first In Window XP (but updating java+sp3+netframeworks was a nigthmare.., that but now is working) and second in Ubuntu 10.04 without success

I only get "avrdude: stk500_getsynd(): not in sync" or similar, testing differents bauds (9600, 19200, 57200), putting arduino in debug mode for transfers, pressing reset button, and googleing to much without find a solution.

Please coud you give me a little help?

Best Regards, Pescadito

I haven't used Arduino 1.05 but it works fine with Arduino 1.04 in Windows XP. The tutorial was originally written using 1.02.

The Arduino IDE is not 100% backward compatible and from time to time they change what version of AVRdude they use.

Try using the earlier versions.

 

hello.....how are you doing, my name is frantz.

i am working on a robot project using the red back spider board with the servos shield however i have a rangefinder sensor that i am using and i plug it in on the red back spider board. when all my 21 servos active the sensor doesn't work. i was wondering if you may have an idea of what is going on with that.