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. 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. 😀

  2. 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

  3. 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?

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

  5. 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.

  6. 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?

  7. 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

  8. 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.

  9. 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

  10. 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.

  11. 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"

  12. 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

  13. 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!

  14. 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.

  15. 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.

  16. 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!

  17. 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 👍

  18. 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.

  19. 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?

  20. 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 .

  21. 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!

  22. 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..

  23. So….I have this friend…Ok maybe it anyway i have a really big Inverter and its the same as the on in this video ( ) 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 youe vids ive learned more from them than most of my schooling

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

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

  26. 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.

  27. 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!!

  28. 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.

  29. 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.

  30. 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.

  31. 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

  32. 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

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

  34. 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.

  35. 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.

  36. 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.

  37. 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?

  38. 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 ->

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

  40. 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.

Leave a Reply

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