Arduino-based AVR High Voltage Programmer

Arduino-based AVR High Voltage Programmer

Update 01/02/09: A PCB version of this circuit is in the design stages – some preliminary information is here.

Update 03/11/09: Kits based on this design are now for sale!

Update 12/14/10: The original AVR HV Rescue Shield kit has been replaced by the new and improved HV Rescue Shield 2.  Visit the HV Rescue Shield 2 product page for information about the new kit!

As I mentioned earlier this week, I recently “lost” an ATmega168 due to flashing the configuration fuses to disable the RESET pin, without realizing that this makes the device impossible to reflash with SPI.  This is particularly frustrating because the device is still 100% functional, just completely deaf to ordinary serial programmers.  The only way to recover the device is using what Atmel calls “High Voltage Parallel Programming Mode” which very few programmers support, most importantly, not the USBtinyISP I otherwise love.

Fortunately, my trusty Arduino came to the rescue – I created an Arduino-based AVR programmer that uses the high voltage programming mode and can fix pesky fuses like RSTDISBL.

The Arduino has just enough IO to implement the entire HV protocol plus a “go” button.  So far I have only implemented setting LFUSE and HFUSE in software, but there is no reason why the code couldn’t be extended to support chip erase and programming the entire flash as well.


The fuse programming process is simple:

  • Upload the HVFuse sketch to the Arduino, available for download here: HVFuse.pde
  • Install the shield and apply +12VDC to the terminals on the left
  • Wait for the red LED to turn on (if it isn’t already)
  • Install the ATmega to be repaired
  • Push the button
  • As soon as the LED turns back on, the AVR is fixed and ready to be put back into service!


Here is an Eagle schematic of the HV Programming shield (click to enlarge):

Update 12/17/08:  An observant reader pointed out that there were three errors in the way GND/AGND, AREF and VCC/AVCC were connected on the target AVR in the original schematic.  The errors have been fixed and the updated schematic is below.  Apologies for any confusion this caused.


Parts list:

  • An Arduino NG, Diecimila, or compatible
  • A piece of perfboard cut to size
  • Header pins for the Arduino interface (note I had to drill some of the holes to get the headers to fit the nonstandard pin spacing for digital lines 8-13.
  • An LED which indicates when it is ok to insert/remove the AVR
  • A 2N3903 or similar NPN transistor (2N2222, etc.)
  • (20) 1k resistors – these protect the Arduino from short circuits in case something goes wrong
  • A pushbutton switch – this is the ‘go’ button
  • A 28 pin socket for the target AVR


A kit version of this project is available.  Visit the HV Rescue Shield 2 product page for more information.

140 thoughts on “Arduino-based AVR High Voltage Programmer”

  1. I wired as per above schematic on vero board using arduino nano, but no luck so far. I checked my wiring many times and all connections are as per schematic, no short at any pins. I am using 2n2222 and 12v reaches target chip when switch is pressed . Any pointer would really help me recover my 3 locked 328p.
    Thanks in advance

    1. How are the parts “locked”? If the lock bytes are set then you must erase the chip to reset them.

      If you are trying to modify fuse bytes, then make sure you are using the sketch on this page, and not the one that goes with the rescue shield 2 kit (over on the kit product page).

      I haven’t tested this sketch with the nano, or with any recent version of Arduino, so it’s possible that it does not work.

      The only sketch that I officially support is the one that goes with the kit version of this project here:

  2. Does this work with a Atmega32? If so, is there any changes to the circuit diagram to accommodate the mega32 chip?


    1. No, the Atmega32 is not supported. it uses a slightly different HVPP protocol. the sketch could be modified to accommodate the differences.

  3. Using Arduino Severino.
    12v directly to input.
    12v frm pin marked 9v pin.
    Unable to compile.
    HVRescue_Shield212.cpp: In function ‘void loop()’:
    HVRescue_Shield212:410: error: ‘UCSR0A’ was not declared in this scope
    HVRescue_Shield212:410: error: ‘TXC0’ was not declared in this scope

    1. I just tested the sketch and it compiles fine with the latest Arduino 1.6.5 and Arduino Uno selected. I’m not familiar with the Severino but as long as you’re using an ATmega328P it should work fine. The 168 should work also. Make sure you have a compatible board selected.

      1. Thanx for ur reply
        From Arduino Site

        “Arduino Single-Sided Serial Board (version 3)

        If you don’t have an easy way to order an Arduino board or kit, you can etch this PCB design by hand and solder it together. It is pin-compatible with the Arduino Diecimila, and should work with any Arduino shield.

        This is the third revision of the board: the Arduino Single-Sided Serial version 3, or s3v3, or Arduino Severino.”

        my severino uses Atmega8 as main chip.
        So may be i’ll have to use atmega328 as main chip.
        Will try n let u know.

        1. That could very well be the issue. Make sure the IDE is set to compile code for an ATmega88 series part (88/168/328) and it should compile without errors.

  4. I just wanted to say thanks! I run a small business on ebay and one of my items is pre-programmed Atmega328P chips. I developed a batch programmer so I can program many all at once. In my experimentation, I ended up with 6 dead chips that have been stuck on my bench for months and months.

    I quickly breadboarded this up with a Nano and ZIF socket and to my surprise, worked without a hitch!

    So, thank you!

  5. Hi Jeff, if I want to recover my ‘bricked’ Atmega8, where should I modified? Is it enough by changing the values of Hfuse and Lfuse in your given sketch according to the specs of Atmega8? Thanks for the project.

  6. Hi! Thanks for the project, it’s like a cushion against the floor for many of us. I happened to get better results with an N-mosfet 2n7000 instead of the NPN transistor, as it was not being able to fully pull the RST pin to ground, but to a mere 7.3V or so.

  7. Hi, This project looks like exactly what i need to rework some Atmega 168 chips that i can’t get loaded with bootloaders, my question is this, I don’t have any 1K ohm resistors lying around and it takes 3 weeks to goe some from china would 1.5K ohm resistors work if not what other, if any, resistors would work with this. Thanks

    1. The ATmega64 supports HVPP, so there’s a good chance that it will work with the shield. If you try it, please report your findings in the forums.

    1. It will set any valid HFUSE, LFUSE, and EFUSE value, so it can be used to recover from all sorts of bad fuse settings – wrong oscillator, reset disable, SPI programming disabled, etc.

    1. Ron,

      Based on a quick review of the datasheets, it should be possible to adapt the programmer to support the ATmega8A and 16A, with only minor, if any, modifications.

  8. This worked very well for me on an Atmega2560. I only had it hooked up to my ICSP about 10 mins before I bricked it. I did not use any of the resistors on the data lines, just hooked it directly into the the Arduino and changed the fuse bit settings based on the fuse bit calculator you linked. Thank you very much! For those that don’t know, if you have a different chip (like I did) make sure you look at the FULL datasheet and search for parallel. It will tell you how the pins map to that particular processor. Then look at the source code for the Arduino Sketch and it will all make sense on what goes where.

  9. Does this revive Attiny45, I have couple that I’m not sure if they are fried or configuration locked up, any savy could tell me how to tell. The programmer I use quit identify them. If I breadboard this schematic would it be useful for that?
    Please I need help srome someone..

    1. Not as-is, but it should be possible to support the Attiny45 by rewiring the socket to get the right pins to the AVR and adding HV serial mode programming support to the Arduino sketch.

  10. I have many of Atmega8, Atmega88, and Atmega168 and I used parallel port programmer cheap one successfully on all of them, reading fuses, programming and using ipprog software but over the sudden none of them read fuses other than 0xFF for the low, high, and ext fuses, it is wierd and please some one to help me, it cannot brand new, and used mcu same fuses of 0xFF, changed PC and installed fresh sw replaced 74ls08 that protects parallel port and the result is the same. Any hint please now I cannot even program any, and I do not have arduino so how I can fix this issue or debug it?

    1. I have tested the AVR HV Rescue Shield with the ATmega328 and it works fine, so this circuit should work with the 328 as well.

  11. I re-fused two ATmega48s with no problem. I am designing a single side shield for my arduino duemilanove. Thanks very much for publishing this!

      1. I have a 12v 1amp plug pack I used. I just wired from RAW.

        You may have only saved me $12, but I am very grateful. Thanks very much for publishing this.

        I’ll email you the single sided copy when I’ve finished it if you want. I’ll make sure you get full credit!

        In my country kits would cost a bout $25. This seems like a great price, but when I pay for shipping this could easily go up to $40 – $50. I would love to buy a kit just to support you, but I can’t afford it. Sorry mate. I have all the parts I need to build a board from scratch. It will only cost me time =)

        Once again, thank you very much for posting this. My ATmega48s will go on into projects after all =D

        1. No worries, if I didn’t intend for people like yourself to experiment and build their own I wouldn’t publish detailed schematics and source code. 🙂

    1. Rui,

      It should work with the ATmega328P, but until recently I didn’t have any devices so I couldn’t test it. Now that I have a couple 328’s in the lab, I’ll stick them on the AVR HV Rescue Shield and let you know what I find.

Leave a Reply