Use Arduino as an ISP programmer to program non-Arduino AVR microcontrollers

Program ATMega 16 using Arduino as ISP Programmer

After reading my recent tutorial on using Arduino code in non-Arduino microcontrollers, one of my readers asked me if it is possible to use Arduino as an ISP programmer to program these micro controllers, instead of using a separate dedicated AVR programmer.

The answer is a definite yes and I use it all the time, since I have a lot of Arduinos lying around. I thought of writing a tutorial, so that it will be useful for others who want to do this.

In this tutorial, I will show how you can program a non-Arduino AVR microcontroller like AtMega 16/16A using Arduino as an ISP programmer.

Loading Arduino ISP sketch

By default Arduino IDE comes with an ISP sketch. All you need to do is to open it up in your Arduino IDE (or using my Arduino makefile), then connect your Arduino to your computer and then upload the sketch to your Arduino.

You should not connect anything else to your Arduino at this point and you will find the Arduino ISP sketch in File -> Examples -> ArduinoISP

Installing Arduino core for your microcontroller

The next step is to find the Arduino core support for the microcontroller you want to program and then install it.

If you want program ATMega 16/16A, then you can use my “Arduino extra core“. I have also written a separate tutorial explaining how to use it. Or if you want to program ATtiny microcontrollers, then you can use the ATtiny core by David Mellis, one of the co-founders of Arduino.

Most of the time, you just have to place these core files inside /hardware directory in your sketchbook folder, but consult the documentation of the actual core library you are using.

Connect the circuit

The next step is to connect the microcontroller to your Arduino. The below diagram shows how to connect ATMega 16/16A. In general the principle remains the same for other micro controllers as well.

Program ATMega 16 using Arduino as ISP Programmer

Program ATMega 16 using Arduino as ISP Programmer

The following are the different pin connections

  • Arduino Pin 13 to ATMega 16 Pin 8 (or SCK of another microcontroller)
  • Arduino Pin 12 to ATMega 16 Pin 7 (or MISO of another microcontroller)
  • Arduino Pin 11 to ATMega 16 Pin 6 (or MOSI of another microcontroller)
  • Arduino Pin 10 to ATMega 16 Pin 9 (or RESET of another microcontroller)
  • Arduino 5+ to ATMega 16 Pin 10 (or Vcc of another microcontroller)
  • Arduino Gnd to ATMega 16 Pin 11 (or Gnd of another microcontroller)
  • 10 uF capacitor between Arduino Reset Pin and Gnd Pin (+ve leg of capacitor should go to Reset pin)
  • LED through proper resistor on any pin of the microcontroller, which you will be controlling through code

This is how my connection looks like

Program ATMega 16 using Arduino as ISP Programmer

Program ATMega 16 using Arduino as ISP Programmer

Burn bootloader/fuse

The next step is to burn the bootloader or/and fuses. For most cores, you don’t need to use the bootloader.

My Arduino extra core doesn’t need any bootloader, but only needs some fuses to be set.

You can burn the bootloader and/or the fuses, by selecting Tools -> Burn Bootloader. Make sure you have chosen the correct board type before you do that.

Upload your sketch

Now, everything is ready, and all you need to do is to write your sketch and then upload it. The ISP sketch that your burned into your Arduino, will take care of the rest.

To use serial monitor, with your microcontroller, you can use my other tutorial which shows how you can use another Arduino as a bridge.

Upload your sketch using makefile

My Arduino makefile also supports uploading sketches through Arduino ISP programmer. Follow all the normal instructions and then define ALTERNATE_CORE and ISP_PORT in your makefile and run make ispload target.

Happy Hacking ;)

28 thoughts on “Use Arduino as an ISP programmer to program non-Arduino AVR microcontrollers

  1. davidhengo

    Hi Sudar, i followed the steps and i finally could upload my sketche, Thank you.

    Do you know the reason why four of my new atmega16A chips donĀ“t work the digital pins 18,19,20,21 and PWM on D11?

    I’ve been trying to debug but still no conclusions.

    Best Regards.

  2. Meraj

    thanks for making it easier to access avr controllers with arduino. I was able to burn bootloader succesfully on atmega16l but cannot upload the sketches.The error shows:
    avrdude: stk500_getsync(): not in sync: resp=0×00. It would be a privilege to have your assistance in this problem.

  3. Meraj

    I am programming via IDE and using a USB-UART cable to do the communication. The converter consists of RX/TX/5v/3.3v/GND pins. Since there is no DTR pin for autoreset, I used a button to reset manually at intervals during the upload. It worked for me with atmega328 but not with atmega16L. I still have the issue on the term L which is low frequency,and arduino ide needs 16Mhz to work with. Is there any way to rectify this problem?

    1. Meraj

      It finally worked, I forgot to change the pin no. declaration in blink sketch. Thanks once again. I still have problem on how to do serial communication via ide with atmega16l without using the arduino?

  4. Intex

    i would like to connect the RTC module with the Atmega16-16u microcontroller , could this be possible ?

    1. Sudar Post author

      I am not sure if I understand your question.

      Can you explain what you are trying to do and what is the problem that you are facing?

  5. NicoHood

    do you know if you can program the 16u4 from the arduino uno/mega with another uno? I have no idea where i could find a profile for this chip. I want to patch a hid function

  6. Akki

    hey there,
    i have atmega 32A chip which i want to program using arduino uno. I have done the above steps. But i am stuck at burning the bootloader. When I burn the bootloader, the arduino IDE says,
    avrdude: Expected signature for ATMEGA16 is 1E 94 03
    Double check chip, or use -F to override this check.

    What could be possibly wrong?

    1. Sudar Post author

      In the above article I am using Atmega 16 core. In your case you are using atmega 32A. So you should a core that is compatible with atmega 32A, not my core which is only for atmega 16.

      1. Akki

        I got the core files for atmega32A . But got another problem now.
        While burning bootloader, it says
        avrdude: verification error, first mismatch at byte 0×3891
        0xff != 0x3c
        avrdude: verification error; content mismatch

          1. Akki

            Ok now finally burning the bootloader is done… Now which type of program should i upload?
            I have uploaded both arduino one and the atmega32 supported program but neither one is working.

          2. Sudar Post author

            Which core are you using? Also refer to your core to make sure that you are using the proper pin mapping.

          3. Akki

            When the code uploads, it gives an error:

            avrdude: verification error, first mismatch at byte 0×0002
            0x2a != 0×28
            avrdude: verification error; content mismatch

  7. Ojasvi Yadav

    The pin numbers in the standard pinout diagram of Atmega16 don’t coincide with the actual pin numbers required while programming. By Hit and trial i figured out that you need to name the pin 19 as ’36′ while programming. I mean, if you’re programming and you are to use the pin 19 of Atmega16, you must refer it’s location as ’36′, otherwise it doesn’t work. Is there any direct list available where all these actual pin numbers with their programming counterparts are listed?

    1. Sudar Post author


      Can you let me know pins by functionality instead of pin number? I don’t have the datasheet handy so I am not able to refer to find out what pin 19 and 36 refer to.

      1. Ojasvi Yadav

        When I type the program in Arduino IDE, I have to define the pin name as ’36′ when I want to refer to pin ’19′ on the Atmega16. Similarly, I have to write the pin name as ’34′ when i need to program any input/output on the actual pin ’17′ of the Atmega16. Now these corresponding adjustments I figured out by myself, but it would be very handy if there was a valid information as to what every pin should be referred to as.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>