HV Rescue Simple




About: These Arduinos are driving me up the wall.

High voltage programming of ATmega328P and other Atmel chips on a breadboard

This procedure shows how to set up an Arduino as a high voltage programmer using a very small number of components: transistor, small inexpensive 12V battery, a paper clip, three resistors, LED, and assorted wire and breadboard. It works with just about any Arduino you may have handy, including Uno or older, Leonardo, Micro, Pro Mini, Nano, Mega2560, etc. The sketch has an easy-to-use menu with simple commands you send to it via Serial Monitor to read or set fuses on the target chip.

If you set this up and become comfortable with using the programmer, you can exploit features of the ATmega328P that you may have not used before, because prior to today most people think they've hopelessly bricked their processors once they set wrong fuse bits. Well, the fuse bits aren't wrong, they are available for use. For example, you can disable the reset pin and start using the reset pin as a general-purpose digital pin. You can disable ISP programming, if you have the need for that. You can set the 128K internal oscillator and experiment with the processor. You can now easily restore factory fuse settings or Uno fuse settings, or whatever fuse settings you want, whenever you have experimented with fuse settings that make your processor unrecoverable via the usual ICSP programming.

I recommend uploading the sketch to the Arduino before connecting the Arduino to the breadboard. The sketch was originally started by Jeff Keyzer for version 2 of his HV Rescue Shield (mightyohm.com/hvrescue2), and I have done extensive reorganization and alterations and simplification, to include giving it a user-friendly menu, changing some of the wiring, making it compatible with various Arduinos, and simplifying the reset circuit for breadboard use.

I recommend becoming familiar with the datasheet for your target processor before using high voltage programming.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Wiring a Pro Mini As HV Programmer

The pictures show the progress I made as I wired the breadboard, and finally it was completed and my FTDI-like adapter connected with the sketch running.

In order to stay organized and make sure the wiring has the best chance of being done right, print out labels that show what each pin is used for on the target chip and on the Arduino. Print them out on regular paper, cut the labels out, and run them through a Xyron Create-a-Sticker machine (which you may find in your better half's scrapbooking tools), or put double-sided tape on them. Then use them and start laying out the breadboard components and wire according to the schematic. Notice the sketch uses digital pins 1-13, and all of the analog pins A0-A5. Digital pin 0, which is the RX pin, is not used.

I have found the small Arduinos such as Pro Mini or Nano result in the neatest breadboard wiring. If you use a Pro Mini or Nano it is also easy to use a multimeter to check continuity of all the connections, to make sure you haven't missed any connections. Note that on Pro Mini the RX pin is marked RXI and TX pin is marked TXO. The TXO pin is pin 1 and RXI pin is pin 0 regardless of how confusing the labeling on the Pro Mini looks. Connect the TX pin to the DATA1 line of the target chip, and do not connect the RX pin to any pin of the target chip.

Use pieces of a paperclip for a battery holder and bend them to get a little spring tension. You can use a 27A or A23 or other similar 12V battery. I have also borrowed a sealed lead acid 12V battery from a UPS. EBay has listings for extremely inexpensive step up converters that are breadboard friendly and can provide 12V. I am contemplating ordering a MT3608 DC-DC Step Up, which costs between $1 and $3 USD postage included. Those modules have the interesting requirement of keeping peak current "no more than TV University." You do not require much 12V current for this, it is just a signal to indicate to the target processor it should enter parallel programming mode, it is not burning anything with high current. If you leave your 12V battery connected to the circuit for a long time, it will drain. So, it would be a good idea to insert it right before programming, and remove it when done.

Notes about the labels I suggest using for keeping your work organized:

Vsup represents the pin 12 of the Arduino supplying operating voltage to the target chip, and that should be connected to the pins labeled V on the target. 12VG represents the pin A0 of the Arduino which controls the 12V switch or gate, and that should be connected to the resistor leading to the base of the transistor.

Step 2: Using Different Arduinos As HV Programmers

Here are photos of completed wiring for Uno, Leonardo, and Mega2560 setting the fuses on ATmega328P.

Step 3: Using the Sketch

To use the sketch:

  • Attach the Arduino to the computer with the USB cable.
  • Insert the 12V battery.
  • Open the Serial Monitor and set for 115200 baud.
  • The menu should appear and show you the proposed new fuses.
  • Type r and click send to read the existing fuses on the target.
  • If you like the proposed fuses, type w and click send to write them to the target.
  • To set custom fuses, type l, h, or x followed by a number to set the low, high, or extended fuse value, and click send. Repeat for any of the fuses you want to change. Then type w and click send to write them to the target.
  • Remove and insert the next processor you want to work with, or remove the 12V battery and disconnect the Arduino from the computer.

If the fuse readings show 02, 00, or FF for all fuse values it is likely the target chip is not inserted properly, wiring is wrong, battery polarity is reversed, or the battery is not producing something near 12V. Check everything with a multimeter, make corrections, and try again.

Step 4: Other Targets and Miscellaneous Notes

The schematic and sketch also handle setting fuses on ATtiny2313, ATtiny85, ATmega168P, and other targets. I have also used this to set the fuses on an assembled Digispark tiny85 board. Read the sketch and schematic, and especially study the data sheet for your target chip, to figure out the wiring.

If your target is a chip soldered on a board, such as Uno SMD or Nano or something like that, you should temporarily remove the DTR-to-Reset 0.1uF capacitor, the pull-up resistor for the reset pin, and the diode connected to the reset pin (if your board has one). You can put them back when you are done using the HV Rescue procedure.

Some of the pin connections serve dual purposes when programming ATtiny2313. To clarify what you see in the schematic, the BS1 pin of the Arduino (analog pin A2), goes to PD4 physical pin 8 on the ATtiny2313 and you leave the Arduino PAGEL pin of the Arduino (digital pin 5) unconnected. The PAGEL signals are sent through the BS1 pin by the sketch. The same thing is true of XA1 pin. The XA1 pin of the Arduino (analog pin A4), goes to PD6 physical pin 11 on the ATtiny2313 and you leave the Arduino BS2 pin of the Arduino (digital pin 9) unconnected. The BS2 signals are sent through the XA1 pin by the sketch.

How does the transistor switch on and off 12V to the reset pin of the target chip? Explanation: 12V is applied to the target chip reset pin through a resistor. So, you could say normally 12V is just applied to the reset pin. The transistor is switched on when it receives a 5V high signal from one of the Arduino pins, through the resistor to the base pin of the transistor. When the transistor is switched on, it conducts between the collector and emitter pins. This shorts to ground the 12V which was going to the reset pin, making it effectively 0V at the reset pin. When the Arduino sends 0V low signal to the base of the transistor, it switches off the transistor, and it no longer conducts, essentially taking it out of the circuit. 12V is once again applied to the target chip reset pin.

This is called inverting, because a low signal is applied to make an output go high, and a high signal is applied to make the output go low.

The resistor attached to the base of the transistor is a current limiting resistor. The resistor attached to the 12V battery does double duty: it is a current limiting resistor when the transistor is switched on and shorting the 12V to ground, and it is a pull-up resistor for the reset pin when the transistor is switched off.

The programming happens very quickly, but if you insert a delay(5000); in the sketch before the two lines "digitalWrite(RST, HIGH); // exit programming mode", it would allow you enough time to observe with a multimeter the voltage at the reset pin of the target chip, and see that it goes to 12V during reading or writing of the fuses.

Step 5: Links

6 People Made This Project!


  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

34 Discussions


3 months ago

Hi there,

I made your instructable to try and revive a bricked Nano clone. At first I had to replace the Schottky diode on the Nano because that was broken. Then the Nano/Ch340 had USB again but alas no working m328pb. I tried several different programmers, but always had wrong output. Using an Arduino as ISP I could read the signature but was unable to write any fuses.
I then tried using the HVP sketch and schematic your instructable is based on but had no succes.
After implementing your schematic I can read the fuses, but writing doesn't change them. What could be wrong?
Would it be easy to implement reading the signature to check if the chip is indeed still working?

Edit: I checked if the needed 12v is applied with a dmm by setting the delay you proposed in another reply.
I also checked if the clock pulse is going to Xtal1 with logic pen tester, which is also the case.
Edit2: Could it be because i haven't removed the cap between rst-dtr and the pullup resistor?
Edit3: removed the cap and resistor but its still not writing the fuses. read out stays the same value though.

Enter a command:

Read Low Fuse hex: FF bin: 11111111
Read High Fuse hex: 1E bin: 00011110
Read Ext Fuse hex: F5 bin: 11110101

Enter a command:

Enter a command:
Proposed High Fuse hex: DE bin: 11011110

Enter a command:
Burning fuses
Burn complete

Read Low Fuse hex: FF bin: 11111111
Read High Fuse hex: 1E bin: 00011110
Read Ext Fuse hex: F5 bin: 11110101

Enter a command:

2 replies

Reply 3 months ago

If Arduino as ISP works well enough to read the signature, then I think ISP programming is possible and high voltage programming will not increase likelihood of reviving the Nano. Some of the pins of the MCU may be damaged internally.


Reply 3 months ago

USBASP and MKII cannot read signature, only garbled hex values. Arduino as ISP can read the signature but the fuses are all zeros. The HVP programmer can read the fuses but not set them.
I have sent the Nano to the graveyard.


Question 6 months ago

thank you for the great project.

can i apply the same wiring of atmega328 28 pins with atmega32 40 pins ?

1 answer

Answer 6 months ago

I had a brief look at the data sheet for the ATmega32. When I compare the parallel programming sections of the data sheets for ATmega32 and ATmega328P I notice they are very similar, but there are differences in how to go into programming mode. On the ATmega328P all you do is set 4 pins low, power the target VCC at 5V and a short time later bring RST high to 12V. On the ATmega32 there is a more complex way described where you bring RST low and toggle XTAL1 at least 6 times, then set 4 pins low and bring RST high to 12V. I don't believe the provided sketch for programming does those elaborate steps. However, it is interesting that the data sheet mentions an alternate way of going into programming mode of powering the target VCC at 5V and simultaneously bring RST high to 12V, used in certain circumstances to reprogram the fuses.
So, with all that said, I suggest just try it and see what you get. If you need to remove the delay between the time VCC gets power and RST gets 12V, that should be an easy fix in the sketch. But it could be the sketch as-is provides close enough to simultaneous applying of voltages to accomplish entering programming mode.
You'll have to study the data sheets to figure out the wiring.


6 months ago

Every time I read fuses I get different values. I checked the connections and they seem fine. Question : Should I get 12V in the Reset Pin at the standby ?

6 replies

Reply 6 months ago


I don't know what you mean by "at the standby".

The idea of this high voltage programming is 12V is applied to the reset pin of the target MCU during the very brief period that programming is happening, to read or write the fuses. 12V is not applied to the reset pin all the time. The transistor keeps the 12V signal from the battery grounded and effectively at 0V most of the time, and the sketch turns off the transistor for a brief period to allow the 12V to flow to the target MCU reset pin and do the fuse reading or writing.

I mention in the last paragraph of the instructable that programming happens very quickly, but if you want to "see" the 12V signal with a multimeter you can add a delay to the sketch and monitor the reset pin voltage with your multimeter.

If you can't get the process to work or can't get consistent results, it could be you have a bad MCU that you are trying to program. The circuit does not fix broken parts, but it will "rescue" you from fuse settings that prevent normal programming, such as when you previously (and intentionally) set the fuses to disable ICSP programming or to disable the reset pin.

I would call this a medium difficulty project, because although there are very few parts, there is a lot of wiring. Chances for wiring mistakes are high, if not being very careful and if not using stick-on labels for guidance.


Reply 6 months ago


Thanks for your quick response!! In my case, I used an NPN 2N2222A transistor instead of 2N3904 which is not a problem I think. Despite your answer, I always get 12V in the RESET pin (standby) and not only at the fuse write procedure. Does that mean that the base of the transistor doesn't get 5V? The emitter is grounded to the Arduino GND, is that a problem ?

By the way, what NOT(12Y_EN) means before the 1K resistor in the transistor base of your schematic?


Reply 6 months ago

Yes, emitter should be grounded to the Arduino GND. And 2N2222A should be fine. If you always get 12V at the RESET pin of the target MCU then your transistor circuit is not working. Yes perhaps the base does not get 5V so the transistor does not turn on. 2N2222 comes in a variety of packages, and the pinout depends on whether it is the metal can package like you show a picture of, or the plastic package, and there is a variant of the plastic package with different pinouts if the part number begins with P2, as in P2N2222A. So it is easy to get the transistor wiring wrong with transistors that come in different configurations like that. Or you could have a bad transistor, bad resistor or incorrect values, bad breadboard, Arduino is not sending the NOT(12V_EN) signal from the A0 pin, sketch problem, etc.

NOT(12V_EN) means 12V is "enabled" going to the reset pin if the base voltage is NOT high. Send 0V to the base and it turns off the transistor, and the transistor stops shorting the 12V signal to ground. Send 5V to the base and it turns on the transistor, and the transistor conducts, effectively shorting the 12V signal to ground.

Screen Shot 2019-03-25 at 10.06.45 AM.pngScreen Shot 2019-03-25 at 10.06.52 AM.png

Reply 6 months ago

Thank you for your quick response. As soon as I return to my home, I will give a try to the transistor connections.

I want also to note that I DO not grounded the +12V as you drafted in the schematic, cos I thought I will create a short circuit, am I correct to this or it is related with my situation ?


Reply 6 months ago

The concept is to use the transistor as a switch. At the sketch's command, it starts conducting and shorts the 12V signal to ground. The 12V signal goes through a 1K resistor, so that limits the amount of current you are sending to ground to a few milliamps.


Reply 6 months ago

Hi and thank you,

It finally worked. Now my ATMega328p is unlocked! The problem was that I didn't have a common GND. When I connected the 12V external power GND to the same line with Arduino GND, I got always constant values of the fuses. Then I re-programmed the MCU with the default values and I connected it with my USBAsp programmer to verify that it works.

Best Regards,


Question 11 months ago

Hi, can someone help me? I cant get it work it shows random numbers i checked the wirings :S

1 answer

Answer 11 months ago

My tx1 pin soldering was bad, and one of my atmega8 was bad too, but now i soldered the pin and it can change the fuse settings! thanks a lot!


1 year ago

Thank you, this recovered a 328p that I accidentally set to run at 128khz..

I attempted to change the default to use the internal RC 8Mhz Oscillator but fat fingered the fuse settings. Difference between E2 and E3 can really mess you up.

Everything was working on the chip, just very slow...


1 year ago


great project,

Do you know if this doctor fuse can be use to restore fuse factory from bricked fuse Mcu atmega8515 40dip pines? And shoukd i have any special consideration with that mcu?

Thank you