Introduction: Simple and Cheap Fuse Doctor for Attiny

Picture of Simple and Cheap Fuse Doctor for Attiny

When you are working with Attiny's like the Attiny 85 or the Attiny13, it is bound to happen sooner or later: you brick your Attiny.
I got faced with it while trying to burn a bootlaoder (i.e. setting the correct fuses), that I suddenly got the dreaded 'Yikes! Invalid device signature' error message. As I had just succesfully burned it on IDE1.06 and now was trying on IDE1.6.3, just to see if I installed everything OK, I knew the chip was OK and that my programmer was OK. Also, a new chip did well, so something ominous must have happened to my chip.

Could it be because my computer had some memory problems during the burning???
Well, not much choice but to try and reset my Attiny85.
For that you need a Serial High Voltage Programmer. Plenty of circuits to find, so no way I claim to be original here, but I am writing this ibble to take away any hesitation that people might have by showing how quick and easy it is.

All it takes are 6 resistors, a transistor, a DIL foot, a 9x20 piece of stripboard and a 7-pins male header and of course a 12 Volt supply. And yes, A UNO to stick it in.

As I didnt expect to use the programmer very often, I planned to use a battery, but as I couldnt find my 12 Volt battery, I ended up using a 0.75 USD (so 75 dollarcents) 5 to 12 Volt converter from aliexpress, that i had for another project.

I used the program below. The program starts when you send a random character to teh serial port. As it turns out, it was a fuse problem in my chip as the fuse bits were E4 DF which means it was set for 128 kHz oscillator. Not sure how that could happen as I removed that choice from my menu in the boards.txt file.
Anyway, it reset the fuses to factory setting and after that I could use my Attiny85 again.
Sadly, in order to build this unbricker, I had to use the 1k resistors I wanted to use for the very project I was programming the Attiny for :-) Oh well!!
All in all took me less than an hour to put it together So if you are having problems with your Attiny13/25/45/85 build one of these.
If you want to unbrick the 24/44/84 series, you need a bigger DIL Foot.
If you are trying to unbrick an Attiny15.. then remember that that has PB3 and PB4 switched compared to the 13/25/45/85 series, so you probably need a software or hardware change (Tar and feathers for the Atmel designer who did this)

// AVR High-voltage Serial Fuse Reprogrammer<br>    // Adapted from code and design by Paul Willoughby 03/20/2010
    //   <a href="" rel="nofollow"></a><br>    //
    // Fuse Calc:
    //   <a rel="nofollow"></a>
    #define  RST     13    // Output to level shifter for !RESET from transistor
    #define  SCI     12    // Target Clock Input
    #define  SDO     11    // Target Data Output
    #define  SII     10    // Target Instruction Input
    #define  SDI      9    // Target Data Input
    #define  VCC      8    // Target VCC
    #define  HFUSE  0x747C
    #define  LFUSE  0x646C
    #define  EFUSE  0x666E
    // Define ATTiny series signatures
    #define  ATTINY13   0x9007  // L: 0x6A, H: 0xFF             8 pin
    #define  ATTINY24   0x910B  // L: 0x62, H: 0xDF, E: 0xFF   14 pin
    #define  ATTINY25   0x9108  // L: 0x62, H: 0xDF, E: 0xFF    8 pin
    #define  ATTINY44   0x9207  // L: 0x62, H: 0xDF, E: 0xFFF  14 pin
    #define  ATTINY45   0x9206  // L: 0x62, H: 0xDF, E: 0xFF    8 pin
    #define  ATTINY84   0x930C  // L: 0x62, H: 0xDF, E: 0xFFF  14 pin
    #define  ATTINY85   0x930B  // L: 0x62, H: 0xDF, E: 0xFF    8 pin
    void setup() {
      pinMode(VCC, OUTPUT);
      pinMode(RST, OUTPUT);
      pinMode(SDI, OUTPUT);
      pinMode(SII, OUTPUT);
      pinMode(SCI, OUTPUT);
      pinMode(SDO, OUTPUT);     // Configured as input when in programming mode
      digitalWrite(RST, HIGH);  // Level shifter is inverting, this shuts off 12V
    void loop() {
       if (Serial.available() > 0) {;
        pinMode(SDO, OUTPUT);     // Set SDO to output
        digitalWrite(SDI, LOW);
        digitalWrite(SII, LOW);
        digitalWrite(SDO, LOW);
        digitalWrite(RST, HIGH);  // 12v Off
        digitalWrite(VCC, HIGH);  // Vcc On
        digitalWrite(RST, LOW);   // 12v On
        pinMode(SDO, INPUT);      // Set SDO to input
        Serial.println("Reading: ");
        unsigned int sig = readSignature();
        Serial.print("Signature is: ");
        Serial.println(sig, HEX);
        if (sig == ATTINY13) {
          writeFuse(LFUSE, 0x6A);
          writeFuse(HFUSE, 0xFF);
        } else if (sig == ATTINY24 || sig == ATTINY44 || sig == ATTINY84 ||
                   sig == ATTINY25 || sig == ATTINY45 || sig == ATTINY85) {
          writeFuse(LFUSE, 0x62);
          writeFuse(HFUSE, 0xDF);
          writeFuse(EFUSE, 0xFF);
        digitalWrite(SCI, LOW);
        digitalWrite(VCC, LOW);    // Vcc Off
        digitalWrite(RST, HIGH);   // 12v Off
    byte shiftOut (byte val1, byte val2) {
      int inBits = 0;
      //Wait until SDO goes high
      while (!digitalRead(SDO))
      unsigned int dout = (unsigned int) val1 << 2;
      unsigned int iout = (unsigned int) val2 << 2;
      for (int ii = 10; ii >= 0; ii--)  {
        digitalWrite(SDI, !!(dout & (1 << ii)));
        digitalWrite(SII, !!(iout & (1 << ii)));
        inBits <<= 1;
        inBits |= digitalRead(SDO);
        digitalWrite(SCI, HIGH);
        digitalWrite(SCI, LOW);
      return inBits >> 2;
    void writeFuse (unsigned int fuse, byte val) {
      shiftOut(0x40, 0x4C);
      shiftOut( val, 0x2C);
      shiftOut(0x00, (byte) (fuse >> 8));
      shiftOut(0x00, (byte) fuse);
    void readFuses () {
      byte val;
            shiftOut(0x04, 0x4C);  // LFuse
            shiftOut(0x00, 0x68);
      val = shiftOut(0x00, 0x6C);
      Serial.print("LFuse: ");
      Serial.print(val, HEX);
            shiftOut(0x04, 0x4C);  // HFuse
            shiftOut(0x00, 0x7A);
      val = shiftOut(0x00, 0x7E);
      Serial.print(", HFuse: ");
      Serial.print(val, HEX);
            shiftOut(0x04, 0x4C);  // EFuse
            shiftOut(0x00, 0x6A);
      val = shiftOut(0x00, 0x6E);
      Serial.print(", EFuse: ");
      Serial.println(val, HEX);
    unsigned int readSignature () {
      unsigned int sig = 0;
      byte val;
      for (int ii = 1; ii < 3; ii++) {
              shiftOut(0x08, 0x4C);
              shiftOut(  ii, 0x0C);
              shiftOut(0x00, 0x68);
        val = shiftOut(0x00, 0x6C);
        sig = (sig << 8) + val;
      return sig;


GeorgeProut (author)2018-01-15

Perfect, thank you. Nearly perfect anyway, - it correctly reads the fuses and signature for my smd tiny85 but doesn't actually change the fuses. At least I now know that reset is disabled (which is why ISP reports that the signature is 000000 using avrdude). I'll update here if I ever get to the bottom of this ;)

GeorgeProut (author)GeorgeProut2018-01-16

Solved. tl;dr I needed to do a chip erase, then the fuses reset as expected.

Using the code and hardware here I worked out with the help of the datasheet how HV programming works. From that I was able to add some code to read the lock bits back. I was expecting the ATtiny85 to be locked as that should prevent the fuses being changed, but it wasn't. So, with nothing to lose, I tried erasing the whole chip...

void chipErase () {
Serial.print ("Erasing chip....");
shiftOut(0x80, 0x4C);
shiftOut(0x00, 0x64);
shiftOut(0x00, 0x6C);
Serial.println ("done");

I added the above routine to the code and called it after it reads the signature and fuses, but before it writes/re-reads the fuses. It worked perfectly first time.

jeanroccoj (author)2017-12-08

Hello and thank you for this simple but very useful circuit, I added some cosmetic printings to your code, to help my failing memory :-) !

<a href="">cheap-fuse-doctor</a>

diy_bloke (author)jeanroccoj2017-12-12

thank you

jeanroccoj (author)2017-12-08

hem ! markdown not working here !

MaximilianD (author)2017-08-02

Thank you SO much! It took me hours to figure out why this damned attiny wouldn't flash. Now I can just reset it and everything works nicely.

diy_bloke (author)MaximilianD2017-08-07

Let me add that I built it also for an attiny that wouldnt flash without me having the foggiest why. Turned out to be a fuse i had no idea I had set

diy_bloke (author)MaximilianD2017-08-03

Happy I/my instructable could be of help :-)

AsepZ (author)2017-05-17

How to use it? Is it enough to burn it or upload it on arduino? I have not understood the use on arduino because there is no video tutorial that I can see. thank you for your answer

diy_bloke (author)AsepZ2017-05-19

put the attiny in the board an insert in the arduino.

upload the program to the arduino,

yoh-there made it! (author)2016-09-20

I made this variant. The top side of the ZIF socket acts as a normal programmer, the bottom sie being this HV programmer. The only thing to o is to reprogram the Nano and off you go. The little switch is to enable the "do not reset" capacitor, needed for normal programming.

diy_bloke (author)yoh-there2016-09-22

Looking mighty good. Thanks for sharing. With 'reprogram the nano' I presume you mean either load the ISP or the HV sketch

ErikA45 (author)diy_bloke2017-02-01

Hi diy_bloke, could you modify your program so that some status is visible on LED's? For example HV on, or programming done, or busy, ..?

diy_bloke (author)ErikA452017-02-02

The programming time is rather short so I am not really interested in having LED's indicate statusses, but you ofcourse could always add it yourself and share it here

ErikA45 (author)diy_bloke2017-02-02

ok I will as soon as I get to it.

yoh-there (author)diy_bloke2016-09-22

Exactly right. And that is also why I needed that blue switch.

"On", as in, capacitor to RST connected: use for sketch uploading to the ATtiny85.

"Off", use for uploading ISP or HV sketch to the Nano.

diy_bloke (author)yoh-there2016-09-22

I forgot: I have a few of those 5->12V converter modules very very handy.

ErikA45 (author)2016-12-30

I wonder why SCK, MISO and MOSI from the Arduino Uno are not used?


diy_bloke (author)ErikA452016-12-30

You mean pins 11, 12 and 13? They are used.
Happy Newyear

ErikA45 (author)diy_bloke2016-12-30

Hi, thks for your quick reply! I am confused: Arduino Uno SCK is on pin 13 (PB5), MISO is on pin 12 (PB4) and MOSI is on pin 11 (PB3).

In your drawing ATtiny pin 5 (PB0, MOSI) goes to Arduino D9 (pin 9?), ATtiny pin 6 (PB1, MISO) goes to Arduino D10, ATtiny pin 7 (SCK, PB2) goes to Arduino D11 (MOSI), ATtiny pin 2 (PB3) goes to Arduino D12 (MISO).

And in the sketch pin 5, 6, 7, 2 and 1 are respectively configured as SDI, SII, SDO, SCI and Reset.

So my question:

1. MISO, MOSI and SCK are not on the corresponding pins on the Arduino Uno: what do I miss?

2. In high voltage programming it seems as if rather SDI, SII, SDO , SCI and Reset are used as variables: what is the difference with MISO and MOSI?


have a great New Year!


diy_bloke (author)ErikA452016-12-30

OK, now I get your point. Well this is not SPI programming, it is High voltage serial programming, that you still can use if for instance SPI (ICSP) is disabled. One of the pins is SCI (serial clock input), one is SDI (data in to the chip), one is SII (instruction in to the chip), and one is SDO (data out from the chip).
So it is totally different from SPI programming

ErikA45 (author)diy_bloke2016-12-30

Ah ok!! Now next question.

I am in process of making a pcb to do both ISP and HV programming for all ATtiny MCU's, based on initial work by Kai Bader:

We agreed I could develop his unfinished project. But I am in need of someone to help me program this project.

Goal: use HV serial programming on one pcb for ATtiny85/45/25/15/13, ATtiny84/44/24, ATtiny26/261/461/861, ATtiny2313/4313 and ATmega328/168.

Question: is HV programming for all these MCU's possible, and what changes to my pcb would be needed to get this programmed (see attachment)



a1m918 (author)2016-09-06

Hello ! can you modify it (or the whole code) for Attiny2313 ?
I tried my self a bit gone this far :

#define t2313 0x1e910a // Signature of device (found while burning bootloader to a functional chip)

#define HFUSE 0xDF

#define LFUSE 0x64
#define EFUSE 0xFF

//calculated from :





else if (sig == t2313) {
writeFuse(LFUSE, 0x62); // i dont know what 0x62 is. some sort of memory location? because I have defined LFUSE above
writeFuse(HFUSE, 0xDF);// same goes for this.
writeFuse(EFUSE, 0xFF);// if that is memory location. than I may read its data sheet to search for it.I did read it but just for calculating the fuses. which I later found that these were already written in my board.txt.

and MY Serial Console is printing this :

Signature is: FFFF
LFuse: FF, HFuse: FF, EFuse: FF
LFuse: FF, HFuse: FF, EFuse: FF

Thanks Again :) !

diy_bloke (author)a1m9182016-09-06

0x62 is not 'some sort of memory location'
it is the Low Fuse that is in e.g. the attiny85 the standard Low Fuse
that the chip comes with from the manufacturer. For the attiny85 this is
LF=0x62 HF=0xDF and Efuse =0xFF
For the attiny2313 this is 0x64 0xDF 0xFF.

The memory locations are actually LFUSE, HFUSE and EFUSE.
So the command write(LFUSE,0x62) doesnt write the LFUSE value to 0x62, but it writes 0x62 to the LFYSE location.
your chip that is not the default, it should be 0x64. The difference
between 0x64 and 0x62 in your chip is the clock source selection (bit 2
instead of bit 1)

because you defined HFUSE, LFUSE and EFUSE
(that is the location of these fuses, not the value) you have started to
write values to random places in your chip.

You could have easily seen this in the program as the definition for all the chips is:
#define HFUSE 0x747C

#define LFUSE 0x646C

#define EFUSE 0x666E
(again, these are the memory locations, NOT the values of these fuses)
So why would this suddenly be completely different for the attiny2313.
as you can see in the program, that for e.g. the L,H and Efuse the
values are 62, DF and FF and those are completely different from the
numbers 646C, &4&C and 666E coz again, one is the location, the
other the value that is written in that location.

If you have a
look at the function "writeFuse()" you se it is writeFuse (unsigned int
fuse, byte val), so first the address of the fuse and then the value of
that fuse.

Anyway, now we come to the next problem. The Attiny2313 is a 20 pin chip that is programed differently from the 8 and 14 pin chips. The latter are progrmmed with HVSerialprogramming while the Attiny2313 as far as I know is programmed with HVparallelprogramming. Therefore you need more datapins connected to the programmer. You may have a look here for that.

Now purely for educational purposes
If you were to make the code suitable for the attiny2313 (but it wont work as it needs parallel programming, but OK for arguments sake):
Remove your definitions:

#define HFUSE 0xDF

#define LFUSE 0x64
#define EFUSE 0xFF

then you add a line under the chip definitions like this:
#define ATTINY2313 0x1E910A // L: 0x64, H: 0xDF, E: 0xFF 20 pin

and then you add your code:

writeFuse(LFUSE, 0x64);

writeFuse(HFUSE, 0xDF);

writeFuse(EFUSE, 0xFF);
one thing, the attiny2313 is a bit of an odd chip. apparently there
have been some problems with it and Atmel actively promotes using the

a1m918 (author)diy_bloke2016-09-08

Yes I have an ATtiny2313A-PU named chip.

okay I get it now :) ... and thanks for the link.
Thank you again !

Raphango (author)2015-08-16

Good to know, thanks! =D
Hope I never have to do this though haha

diy_bloke (author)Raphango2016-09-07

tnx Raphango

Bullitt4511 (author)2016-06-26

Thanks diy_bloke.

diy_bloke (author)Bullitt45112016-06-27

my pleasure

Bullitt4511 (author)2016-06-18

I am stuck! What is a DIL foot? Can't find the expression anywhere.

diy_bloke (author)Bullitt45112016-06-18

I apologize, it probably got lost in translation. In proper english it would probably be called DIP-8 IC socket

ThomasK19 (author)2015-08-16

Here is the picture of my board. It also inspired me to make an ATtiny programmer board (2nd pict) that has the capacitor for the reset to hook it up with a wire on it. The only thing to do was to modify the Arduino ISP to power up pin 9 (LED_HB in the sketch). Using an output pin for Vcc is really neat :-)

ThomasK19 (author)ThomasK192015-08-16

As I'm on it: here's the sketch for the layout of the modified board. The red and black wires are for the external power supply.

ThomasK19 (author)2015-08-16

Really great stuff. Worked like a charm and I can even use it to set my own fuses with little code change. BTW: If you turn the transistor and move it up 3 holes the board is even easier to build.

diy_bloke (author)ThomasK192015-08-16

I am happy it was of use to you. Thanks. good tip.... for others that is as I probably will need only one board :-)
But I will check into it and possibly change the design

a1m918 (author)2015-06-16

is it necessary to use 12volt supply?

Is it safe while working with Arduino?

Do I need to connect 12volt Supply with this programmer? and then try to unbrick it ?

Thank you. PLZ reply. I have done making this board with all resistors. just need to ask these questions. thanx

diy_bloke (author)a1m9182015-06-16

yes the 12 Volt is necessary for High Voltage programming. But please read the instructions very carefully.............................
Do not feed the chip directly with 12 Volt. The ONLY pin that gets 12 Volt is pin 1 on yr attiny and then only via a resistor.

None of the other pins should get 12 Volt
and None of the pins of your Arduino should get 12 volts
There is ONLY ONE 12 Volt connection on the entire board and that is on R5.

Your Arduino should just be fed like normal and receive 5 Volt
Do not, I repeat DO NOT attach the 12 Volt anywhere else than to the proper side of R5

a1m918 (author)diy_bloke2015-06-16

Can I unbrick other chips of ATtiny with is method ? I mean the chip which has more than 8 pins ?

diy_bloke (author)a1m9182015-06-16

yes you can, up to a point. I believe at a certain moment you need a parallel High Voltage Programmer, this is a serial High Voltage Programmer. I am not sure at what point you need the parallel programmer, but I believe the 2321,4321, and 24,44,84 series can be done with this method

a1m918 (author)diy_bloke2015-06-16

Done :)


Thank you again :)

diy_bloke (author)a1m9182015-06-16

good :-)

Ploopy (author)2015-05-25


diy_bloke (author)Ploopy2015-05-25

tnx :-)

About This Instructable




Bio: I am a physician by trade. After a career in the pharmeceutical world I decided to take it a bit slower and do things I ... More »
More by diy_bloke:Working With the Funduino W5100 Ethernet Module.Uploading Data to ThingSpeak With MQTTAdding an MCP23017 I/O Extender to Arduino or ESP8266
Add instructable to: