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.

I suspect you have this problem because your batteries could not deliver enough power for the new accessories. 

What version of the Arduino IDE are you using?

 

Sorry, but are you asking me? If so I would clarify that I do not add any new accessories into the robot, just want to burn the new bootloader into it using another mini-driver with separated power source.

I am using 1.0.5. I have tried 1.0.4 and 1.6 but no good.

Hi, I hope this topic is still active though.

I have two dagu mini-drivers, an old (called it A) and a newer one (called it B). The A works fine for my 2WD Magician chassis robot. Recently I want to plug some more sensors and servors to A so that I reprogram the sketch. I tried to upload but failed many times. A very simple program is Blink (LED); I can upload smoothly to the B but not to A. The message from A is: 

avrdude: stk500_recv(): programmer is not responding

Then I suspect that the bootloader of A is problematic (since there are several times the power of the robot suddenly off, maybe due to insufficient voltage or current). I followed your instruction to make B as a programmer to upload the bootloader via ISP to the A. All the parameters are correctly set: Board: Arduino NG/older atmega8, Port: /dev/ttyUSB0, Programmer: Arduino as ISP. I tried to clikc on Burn Bootloader many many times but they constantly talk to me:

avrdude: Yikes!  Invalid device signature.

Double check connections and try again, or use -F to override this check.

One of out one hundred times the burning is silent and just output:

Binary sketch size: 4,884 bytes (of a 7,168 byte maximum)

I  thought the bootloader is already on its place so I try to upload sketches to it using normal serial USB port but again:

avrdude: stk500_recv(): programmer is not responding

I have tried:

  • Arduino IDE 1.0.4 and Arduino IDE 1.6.0 too, but no difference.
  • Supply the USB with more power (I use two USB ports for instance) but no help

Any advice is useful for me. Thank you!

 

Phong

 

Yes, sorry, I was trying to asnwer from my mobile on a train so I accidentally added a comment instead of a reply. I am now in a building that is not moving at 300km/hr.

Ok, what operating system are you using?

It's very strange because you get this error "programmer not responding". If you are trying to upload your code through the serial port then you should not get this error.

As you get the same problem with 3 different versions / installations of the Arduino IDE it sounds more like a driver problem or operating system problem. I would also try a new USB cable as I have had ones with intermittant faults cause a lot of frustration.

The building is still moving at high speed, relatively to the sun.

I am using Ubuntu 14.04 to do all the things. Could you explain a bit more why that "programmer not responding" could not happen with firmware uploading? 

Luckily I have two mini-drivers, so I can easily check whether the problem is due to the USB cable. Using the same cable, I could upload to the driver B while it is impoissible to the driver A. That is why I doubt the bootloader of A is problem.

This is my setup to burn the bootloader to A via ISP, using B as the programmer:

https://drive.google.com/open?id=0B26_kd-0bahhNzVncVFRTlo0aEU&authuser=0

 

If I upload the simple Blink code to the programmer B, then after wiring the ISP, I have the both drivers blinking synchronously. That means the wiring is correct ?

https://drive.google.com/open?id=0B26_kd-0bahhTkgxTW5Hemw3TWc&authuser=0

 

This is the ISP connect on the programmer side:

https://drive.google.com/open?id=0B26_kd-0bahhMm5EWXQ1SzkwZU0&authuser=0

According to your instruction, one has to remove the jumper at D10 and plug the reset wire there, right?

and the ISP connection on the driver A:

https://drive.google.com/open?id=0B26_kd-0bahhTkgxTW5Hemw3TWc&authuser=0

 

 

I have wired a NANO as you specified, and then hooked it up to the ICSP header on a UNO R3 (the one on the opposite side of the USB connector, not the one next to the USB). 
Board is set to Arduino UNO, Programmer set to Arduino as ISP and Port is set to the port of the NANO.
When trying to upload a scetch or burn the bootloader I get the anoying error: 

avrdude: Device signature = 0x000000

avrdude: Yikes!  Invalid device signature. 

Any idéa what has gone wrong? 

Thanks for a very good tutorial. 

Thank you for providing a fairly accurate description of your setup. The one thing you did not specify was which version of the Arduino IDE you are using.

Each Arduino IDE is a little bit different and they are not always backward compatible. For example, different versions of the IDE use different versions of AVRdude.

This tutorial has only been tested on versions 0022 and 1.04. If you are not using it already then download version 1.04.

The Arduino Nano can come with the ATmega168 or ATmega328. Check the chip number.

Make sure that the reset pin of the Arduino UNO is connected to D10 of the Nano.

If I remember rightly the UNO uses an ATmega8 as the USB interface and it has it's own ISP header. I am not sure if this will affect anything. The tutorial was only written for the earlier (pre-UNO boards that use ATmega processors).

After a lot of hairpulling I finally found the problem. It was a pesky wiring problem (lanes on a stripboard was not cut properly, shorting pin 12 and 13 together). 
Anyway we now know that this setup works fine with a Nano 328 as programmer and an Uno R3 as a target connected to the ICSP header. Programming was done with version 1.05, and the setup also works nice if you want to program the 16u2 (USB controller) on the Uno (my Uno now looks like a MIDI device from the computer side).

Thanks again for a very good tutorial and thanks for the assitance.

Hi

Thanks for the detailed tutorial, and have managed to install a bootloader onto 4 arduino clones i unwittingly got which had no bootloaders...

Now I have a nano working as a permenant ISP (without a bootloader delay :D) incase I need it again, either for more arduino's or any future project

 

thanks a million

 

dan

--edit--
I've found it to work in arduino 1.0.5 no problem. I wonder if they updated someting? 

Hello, first of all thank you for this useful tutorial. However when I am trying to burn bootloader into the Arexx board used in Adventure Bot I've got the error "Expected signature for ATMEGA168 is 1E 94 06".

I am using Arduino Mega2560 board as a programmer and I've changed the -F parameter in programmers.txt:

arduinoisp.name=Arduino as ISP 

 arduinoisp.communication=serial

arduinoisp.protocol=stk500v1

arduinoisp.speed=19200

arduinoisp.force=true

 

Is this anything I can do more? I tried to find the answear by Google but it is not very helpful, sometimes posts are very old :(

 

Thank you for your time!