# Inductive spiking, and how to fix it!

So in a few of my videos you might have
noticed that I put a diode in parallel with inductive loads like relays or motors. This video explains why that’s important. First, make sure you’ve already seen my
tutorials about inductors and transistors so you know what’s going on. So let’s start out with a simple circuit
where I have a low side N channel MOSFET switching a purely resistive load of 20 ohms. We can pretend it’s a small heater or something. And let’s arbitrarily use a 6 volt power supply. We’re going to be looking very
carefully at this particular node in the circuit, the transistor’s “drain”. If we use an external 7 volt source
we can switch the MOSFET on. When the MOSFET is on, there’s almost
zero resistance across it, which means we have a direct connection to ground. So the voltage here is almost zero volts. This gives us a complete circuit. So current flows from the 6 volt supply,
through the resistor, through the transistor, and into the return current path. Now let’s apply 0 volts to the “gate”
of the MOSFET to turn it off. When the MOSFET is off, there’s nearly
infinite resistance across it, so it’s like it’s not even in the circuit at all. Since no current can flow, there won’t be
any voltage drop across the resistor. And since there’s no voltage drop, 6 volts
minus zero means that we’ve got 6 volts right
here on the transistor’s drain. And here’s what that looks like on the oscilloscope. On the top I’m switching a MOSFET with a
7 volt square wave applied to the MOSFET’s gate. And on the bottom you can see the
voltage at the transistor’s drain. It’s a 6 volt square wave. Very simple. Now let’s get rid of that resistor
and make things a little more interesting. Here’s the exact same circuit switching
an electric motor. uh… what the hell is happening here!? If we zoom out a bit we can see these
gigantic voltage spikes reaching 40V. So why is this happening? Well, the motor is an inductive load, so
let’s model it as an inductor. When the MOSFET is on, current flows
through the motor and everything is fine. Since the motor is running, now it has
some stored inductive energy. and let’s represent that with this energy bar. Now when we switch the transistor off
look at what happens here. Remember the golden rule of inductors: The current in an inductor cannot
instantly change! So instantly after we turn off the transistor, there is still
current flowing through this inductor. In fact it’s going to take a while for the
current to stop flowing. But there’s nowhere for this current to flow! So what happens is that the voltage will
build up and up and up… until all of the stored inductive energy has been turned back into electrical energy. So we get this gigantic voltage spike on
the transistor’s drain. Remember, the electron flow is actually
backwards compared to conventional current. So when current is flowing downwards here, all
the electrons are actually moving away. And with all the negative electrons leaving here we end up with a very positive voltage spike. And if the voltage spike is high enough
it runs the risk of destroying the transistor and other things attached to
this part of a circuit. I’m using an IRFZ44 which is
rated for up to 60V so I am lucky the inductive spiking wasn’t enough to
kill it. But with a bigger motor driving a heavier load that could easily
have happened. Okay now how do we solve this problem? Well… put a diode in parallel with the
inductive load, but backwards. Now when the transistor switches off
there’s actually a good path for current to flow. The inductive energy will get dumped out
of the motor through the diode and get returned to the power source. And it will also recirculate back into the
motor until it dissipates. It’s a simple addition to the circuit
and look at the difference it makes. The inductive spike is completely gone. Sometimes this diode is called a “reverse
bias diode”, “antiparallel diode”, “freewheeling diode”, “catch diode”,
or “flyback diode”. And no matter what you call it, it’s just
a diode that lets inductive energy take a return path somewhere safe. In this case, some of the energy is being
diverted back to the power supply’s capacitors, recharging them just a little bit. If the inductive load was much bigger, the returned energy might be too much
for the power supply to handle, in which case you’d need to be powering your
circuit from a battery that can be recharged. By the way, when you’re doing this make
sure the diode is pointing in the right direction. If you have the diode this way around
current will continuously be flowing whenever the transistor is on and the
diode will blow up. Hooray! Another smelly failure! Now as for the type of diode, I used a
1N4007 and that will work in most situations under 1kHz. If you’re switching things at higher
frequencies you should find a fast schottky diode like the classic
1N5819. Anyways that was just an example with
a motor but the exact same problem occurs with
any inductive load. This includes solenoids, the primary coil of a relay,
transformers in a flyback configuration, and a whole lot more. Alright thanks for watching. Now you
know how to save your circuits from inductive spiking.

## 100 thoughts on “Inductive spiking, and how to fix it!”

1. 001 002 says:

yay for magic smoke 😀

2. 001 002 says:

im very new to circuits… found this little passion late. but thanks for making some of this easier to grasp and some tricks. ill be using this. 😀

3. KINDanon says:

the motor will sound quieter when the diode is connected properly

4. M R says:

I really enjoy your videos super clear concise and formative please keep up the good work

5. bob along says:

i'm troubled by the step of the fet switching off with i in the load coil. and the mag fld collapse makes the Vd get real high. w/o the current actually flowing how does this voltage arise ?

isnt there some capacitance (between the coil windings ) that the collapsing mag field interacts with ?
and the decaying sine waveform is showing these 2 phenom' oscillating until that field
energy is dissipated .

further … that the presence of this 'capacitor' is what allows the inductor current to
change directions . otherwise it appears to be slamming into the drain … and then what ?

it does change directions with a 'capacitor' there to flow into and charge up …. less V
with each cycle of energy exchange

6. Hao Jie Chan says:

How to implement this on a BLDC motor?

7. Leo Freeman says:

Thank you for this great simple explanation! I wonder, though, why inductors (even just air-cored coils) take so long to build and collapse their magnetic fields? I would have imagined that this electromagnetic process would be practically instantaneous compared to the frequencies from a signal generator. What causes such large delays?

8. Migueldeservantes says:

l think that the cat is really happy!!

9. Ancel B says:

What would be a solution for about 16W worth of bidrectional inductive clamping to not exceed 60V.

10. insylem says:

I call them kickback diodes.

11. Joey Mac says:

Could you also put a resistor in series with the diode to help dissapate the energy as the field collapses ?

12. SHERMAN W. BRAITHWAITE says:

I tried it, and all it did was increase current in the device. In fact, that position with the "fix", had the most current of all components in the device, and it increased current in the device batteries from 1 amp to 30 amps p-p. I want to know if you people are sure that the current is not what's important, as the current in the device is low, that problem can be ignored, even if the device voltage is high. Current low; Voltage high; Wattage high. Not a good configuration or what? I have been trying to accept this kind of output for years now, as I finally was able to lower the device current. I used to get as crazy a current as I explained above, you "fix" seems to do the opposite for my technology. I thought as much, and just had to try it. As this kind of device (the "fix") is added to my tech, it simply creates a short circuit. That makes a lot of sense, how else do you get rid of a bad ripple than to isolate it as a shorting current elsewhere? It's reversing everything on my devices as it short circuits the entire device, putting it back to basics, where it was doing just that. Not tech for me. I had tried this another time in the past. I can't remember what it did. I think it had actually worked.

13. Balan Bogdan says:

Thanks,You save my 2n3055 flyback driver!

14. Diogo Miguel says:

Transient right?

15. ShuShu Bana says:

What if i want to reverse the "security" system built inside a flyback transformer?, i mean, what do i have to do to get the voltage spikes with a flyback that has a diode to prevent the high voltages?
Would it be a good idea to put another diode coming from the power supply to prevent the current from flowing backwards when it disconnects?

16. Betul Kaplan says:

thank you so much budy!

17. Der Knistermann says:

You are so underrated. There are not many youtubers who deserve to hear this ( there is so much crap online nowadays) but you are my favorite

18. Savita Desai says:

What if we connected a diode in series before the motor ??? Will the current flow in backward direction? ??

19. chimeranzl says:

Brilliant explanation thanks

20. Edoardo Pastore says:

does the inductive spiking occur in a three phase synchronous motor also, and if it does how to prevent it?
Thanks!

21. mrsemifixit says:

What’s the difference between this freewheeling diode and the internal diode of the transistor?

22. William J. says:

@2:49 Put that magic smoke back in and then I’ll REALLY be impressed! 😀

23. Tiwari Ankit says:

How do we avoid such spikes for a motor connected to an H-Bridge…?

24. Khalid AlHashemi says:

good job

25. Matthew Ferrie says:

What if you replaced the diode with an LED and resistor? Would it flash whenever the transistor turns off?

26. Frank Dorrin says:

If I’d had YouTube back in college, my life would have been easier! Nice job!

27. The Rider says:

Can it be used on a motorcycle ignition coil to protect the cdi?

28. TCircuitry says:

Afrotechmods, So i built your 555 timer PWM circuit, and put it on my variable tension friction drive bike project i built. I had the backwards diode in the circuit, it ran fine, I had 24 volts on this 280 watt motor with a powerful fet, and i hit a bump in the road and my solder connection on my diode broke off and i basically had no protection for that fet so the fet exploded in the housing, i went back home, and realized it was over 100 volts of spiking on the drain. Inductive spiking is very real.

29. Eddie Amaya says:

without the diode i get a 128V spike with the diode i get about 38V spike on tiny dc motor being switch @1Khz , my mosfet can handle it but how can i reduce that spike more? 38 seems a bit too much still

30. Toddo Roi says:

I've always wondered if it is possible to use a bridge rectifier to allow the inductive spiking to still occur over the inductor and still protect the rest of the circuit from it.

31. Afrotechmods says:

Interested in learning about wireless power? Subscribers can get up to 80% off my course Wireless Power to the People – Wireless Charging 101 on udemy using the coupon code "YOUTUBE"

32. Sander van Otterdijk says:

would a LED work?

33. B Guzman says:

you are a genius

34. Dale Firmin says:

"Hooray! Another smelly failure." I love it.

35. Andrius Kamarauskas says:

TVS diodes next?

36. Daniel Smith says:

I wish people would quit using conventional flow grrr, its just bloody confusing.

37. jmaguilarr says:

Hi , very good teory , how i can fix this spikes in a push pull inverter with transformer?

38. Sinan says:

Very interesting. I just watched a video about waterhammer, a phenomenon in fluid dynamics, where a huge spike in pressure occurs when a valve is closed too quickly. The resemblance of the diagramms are uncanny

39. tamyboy1 says:

great example, thank you!

40. Hervinson Samson says:

Could I use a zener to ground on the drain instead of a diode in series of the drain and source? Anybody?

42. metallitech says:

Venomfangx does electronics now?

43. Andreas Stevens says:

you could also use the energy in the coils of the motor against itself for some inductive braking?

44. HermannPaschulke says:

This is very much like a water Hammer

45. T1000LTU says:

Just as a note, when the diode is across inductor it is shorting out inductor when it is doing self-induction on power-off moment. Which is a waste of energy. You can easilly drive inductor in full bridge mode and add voltage regulator circuit to recover the BEMF energy back to power source. And when inductor is running close or on resonance the COP will be approachong close to 1 minus energy wasted to resistance.

Good luck!

What can i do if total current through my circuit is 40A. Connecting diode will easily blow up.

47. nkr says:

Awesome and interesting.. 😄

48. movax20h says:

Excellent. I like the short form. But It would be nice to give a guide what parameters the diode should have (calculate). And maybe mention about AC inductive loads, and RC snubbers, or something. For a next video.

49. Duffy Polk says:

2:52 Now I must Subscribe!!!

50. Click says:

Hi, does it matter where to connect the diode? For example I have a solenoid lock with 2 meter wire. Should I connect the diode near the solenoid/coil or is it ok to put diode near the pcb board where the 2 meter wire ends.

51. Donald Sleightholme says:

😮

52. xonex28praise Sid says:

I don't know who you are but have been around electronics all my life and this is one of the most informative videos I have ever had the pleasure to watch!  I cannot thank you enough. It's application at work is far reaching! Thank you!

53. TheCodename9 says:

What an incredibly lucid, humourous explanation. Thank you.

54. sawajiri100 says:

Wow very nice explanation 😀👍👍👍
I have a problem on my walkman.. the speed of motor for tape is not stable.. and i try make test tape at 1khz of sound and measure the speed of cassette is not stable.. i changes motor and pwm control nothing changes still same when i analyzed the circuit there are small mosfet and pwm and the motor act like inductor coil.. i measure the drain of mosfet yes! There are voltages spikes when the 2 coil of motor is ON and turn again into another coil has voltages spikes.. i see i have
diode open. And i changes new the problem is sold 👍

55. Jim Viau says:

4:53 Thanks for all those clarifications. However pls allow an important clarification. When you mention that some of the current return to the source, presented as your circuit shows, this fact is untrue. When the MOSFET turn Off, the Drain node consist strictly of de diode anode and one only inductor terminal. In this case it is the entirety of the stored energy that is feed back into the diode. The other inductor cathode node is connected to the power source only with one wire, which render easy to see that no current could go back to source. Instead the whole current circulate in series through the diode and inductor. All the stored energy will end up in heat in those two components only. We often see in similar circuit configuration a diode cathode connected not on the inductor but rather onto another circuit capacitive configuration where the energy will be utilized for other things, like detection or running another active device. Such capacitor would then store the inductor energy. Often we also find these circuit configuration in PWM power transformation devices.

56. Robert Leitch says:

What about a circuit where the motor can run in reverse? Do you have to switch the diode connection to match motor direction, or is there a more universal way to do it?

57. deepak karna says:

like

58. Lal Chandra says:

i don't know why 44 alien dislike it?

59. Jay says:

Not a good depiction of the cemf flow, totally confusing , and inaccurately shown.

60. Chetan Anam says:

How do we calculate the back emf? You may say the classic eqn. L.di./dt.. Here, we know i flowing thru the MOSFET. But we don't the time & the rate of change of current I.e. in what time will the current fall down to zero (di/dt) because the input waveform which controls the output is changing very fast ( nearly zero seconds) as seen on the cro. In real life zero seconds would mean an infinite back emf would be generated. This emf would kill the transistor connected. But fortunately, we get only 40 volt spike or so. What I mean to ask is that there is a finite switching speed which limited the spike to 40v. How do we predict the spike amplitude without using CRO or actually building up the circt & measuring it with some instrument? Hope you will respond to this simple querry. Thanks in advance .

61. Chetan Anam says:

Genuinely appreciate your efforts to simplify the concepts & educate the viewers.

62. Surendra Choudhary says:

so we need flyback diode to overcome voltage spike. thanks buddy

63. Dimitris Xarir says:

Where can i find the equations for all this??

64. G. Com says:

65. Electron Play says:

66. Alec Traub says:

Hi Afrotechmods, i have exactly the same configuration as your schematic above, with an n-channel mosfet FQP30N06L. and my load is 12v 50w incandecent light bulb. My PSU is a 12v 70w SWPS. I have a 1N4007 diode across the lightbulb and switching the mosfet on and off at 100Hz. i am still seeing 78v spikes at the drain. could you have a clue as to why this is happening? your help would be greatly appreciated!

67. Rik DeBacco says:

So I have crisp clean V but have L spikes of -.3–1.0 amp; will this help smooth those out aswell? I keep hearing so many different things I dunno what to believe.I do know I've hooked up electrolytic and ceramic and still bad amp spikes but nice voltages..

68. sortofsmarter says:

So….I have this friend…Ok maybe it me..lol. anyway i have a really big Inverter and its the same as the on in this video (https://www.youtube.com/watch?v=8pIZrrPLSP0 ) and I realize what happened after I watched his video. I also emailed him and sent him a link of you videos to help him out I hope. But what I need to Know is there some sort of mod I can do on the main mosfet's. I dont know a super lot about inverters but I believe it is the high voltage 380v side after the high frequency transformers are all done with the input and he had a inductive spike from his chop saw possibly kill one and then it just cascaded. Im not afraid to do some serious circuit mods or some kind of filtering capacitor bank, I just dont know where to start. Its a 8000w beast and I use it for a whole house backup…any help would be greatly appreciated..PS..love youe vids ive learned more from them than most of my schooling

69. Manlish Potato says:

Everyone learning about transistors NEEDS to watch this, took me forever to find a video that explained this in a way that make sense!

70. chu Harry says:

But why is there a sound from circuit or occiliscope

71. Bingo Sun Noon says:

A lot of YT videos take 30 minutes to present sixty seconds worth of content. You did it in under five minutes. Good job.

72. Iowarail says:

You sound like the guy that does the Myths and Legends podcasts.

73. akshay dpal says:

Can you please make a video on bypass capacitor selection

74. DJ Toddles says:

4:19 Thanks for showing the "smoke monster" that shows up when you do it wrong so we'll know what to watch out for.

75. Vahid Behravan says:

this is the best explanation about the Snubber, Flyback and voltage spiking on you tube because it shows all in practical way. Thanx a lot!!

76. Vahid Behravan says:

I wish to see one tutorial from you about bypass capacitors and how to use them…

77. Andrew Neal says:

Oh, so that's why/how boost converters work.

78. Eetu Jääskeläinen says:

Love how that gratuitous cat scene looks exactly like mine cat does right now!

79. Dan says:

The energy in the inductor does not return to the power source. The inductor current flows through the inductor windings and produces I^2*R losses, and it also flows through the diode and produces V*I losses. The energy in the inductor is dissipated by these two mechanisms.

80. TheSonichedgehog8 says:

81. Chase Daly says:

This video REALLY helps! I think I get the gist of how inductors work now. Though the analogy isn't perfect, I think an inductor is kind of like a drug addict and the electrons are drugs: It takes some work to get them to take the drugs, but then when they're hooked they get hungry for electrons. Then when they are cut off, they suck up all of the electrons causing that positive voltage spike.

82. VerticalWit says:

"A diode by any other name would quench just as sweet" that's some Buddha words

83. Chocolate Rocket says:

Uhhh I'm pretty sure there is no current flowing back to the PSU bypass caps. The inductor will have Vd across it, but the node attached to the PSU doesnt have any reason to change. A small leakage current goes through the FET and some parasitic resistance, but the rest would only go through the diode.

Of course I've never tested this, so I think is would be a cool video to hook a current sense amp up to this test cct and see who is right.

84. jim halcom says:

I was informed that the flyback diode may protect the mosfet device, it causes the relay to react very slowly because the current is still flowing through it as back emf. Therefore the relay is delayed and not very responsive

85. Mike Gleason jr Couturier says:

Why at 3:35 the signal became like a staircase after putting in the diode? Thanks!

I have one doubt when the relay switched On and Off the voltages spikes comes on the other channels when we monitor on the 32 channel recorder why these spikes coming? Could you please explain me

87. delta .fire says:

Very good video but one question, you are using DC on your video, how can i do the same with AC ? thanks for reading 🙂

88. Chandrachur Maitra says:

But what will we do in case of an Inverter?

89. MatchstalkMan says:

Gratuitous Cat Scene. Nailed it.

Liked and subbed!

90. elderiot elderiot says:

Great!

91. tim taylor says:

Hey I'm kind of new to this kind of stuff but it looks like this would work on amplifiers also that Pop or thumb when powered off, Is that correct? If so, how or ware should a diode be put in a 110 volt circuit of a solid state guitar amp? Thanks.

92. Narayan Dhakal says:

Sir is it fruitful to connectba MOV in parallel to freewheeling diode?

93. TCircuitry says:

Had this diode installed in my PWM Controller for my Ebike Project, hit a bump on the road while riding and the diode solder connection broke off, and the inductive energy blew up the FET. make sure this is soldered down good lol.

94. Electronics the deep says:

At 3:34 there is a spike at end of gate signal
What it means?

95. Modeller Design says:

The reversed voltage dc motor connection of flyback diods will be very interesting too.

96. Kiran Tujare says:

This is very useful. Thank you for this explanation. Could you explain the same for a high side? How would the diode protect the MOSFET on a high side driving an inductive load. Please let me know. I would appreciate it.

97. Martink9191 says:

when I was kid, I remember, that little rc cars had ceramic capasitors soldered on motors. What was reason of that? I think it may be help stabilisening the voltage, but in reallity?

98. Teodorescu Sorin says:

Very nice video ! Congratulation for your work ! Respect sir. I have a question …. is better to select a TVS diode instead a conventional one ( 1n4007) ? I saw this -> https://i.stack.imgur.com/Gwm1y.png

99. Νίκος Δελιανίδης says:

No, energy is NOT being diverted back to the power supply (in the case of the freewheeling diode).

100. Edin Fifić says:

2 things:
1. The diode simply shorts out the reverse voltage/current spike across the motor coil, doesn't flow back into the circuit.
2. If the coil belongs to a relay, it would extend a relay's life if a zener diode were used in addition to the catch diode, and the zener voltage should be below the transistor's maximum voltage rating.