IRF540 Mosfet driven with PWM signal does not respond to high inductive loads - Page 1
Forum section: electronics / projects

author: Houseman
author_rank: Regular Contributor
timestamp: September 11, 2023, 01:03:12 pm
content: Hi forum.Here again asking for help once more.I have bought a PWM driven solenoid Valve controller via an IRF540.Due to strange behavior I have reverse engineered the rather simple board: schematic is attached. Note that +24Vdc that is fed to the MOSFET DRAIN is directly taken from the bridge rectifier output so unfiltered (power supply is provided via a 24V AC trafo). The secondary side of the octocoupler is indeed powered from a filtered rail via L1 and C1.The IRF is driven via a 13V DC PWM 50Hz signal who's duty cycle I can vary: ranging from 0% to 100% the solenoid valve (L in schematic) opens accordingly from 0% (FULLY CLOSED) to 100% (FULLY OPEN) in a quasi-linear manner.Various size of VALVE exists: 20VA , 50VA up to 120VA. (all 24VDC)Now in principle, and in practice with low power valves all works (20VA ok).From 50VA to 120VA this weird fenomena occurs: Valve can be controlled only in one way:I can slowly INCREASE the duty cycle let's say from 0 to 100% without problems - valve opens. once from 100% I want to REDUCE to 40% the valve stays at 100%. After a couple of minutes it then slowly closes reaching the 40% value. If I briefly turn the valve off (0% DC PWM) and then 40% the valve works. Same thing happe if I want to reduce it from 80% to 20%.I have noticed such a strange behaviour is enhanced if I increase the lenght in meters of the cable that connects the controller to the valve. So I "suppose" it must be related to the global inductive value that increases with valve size and cable lenght.I think the MOSFET stays ON even if I am driving the Gate with lower PWM.I think frequency must not be an issue.. 50Hz is very low...Please help with suggestion.. any help is appreciated. Thank You.StevePlease help with suggestion.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: September 11, 2023, 01:22:15 pm
content: The gate of (Power) MOSfets has a very high DC resistance, but they are a heavy capacitive load. If you want to switch such a FET quickly, you need a high current (1A or more is no exception). and your gate resistor limits this to just a few mA, which is not enough.Another big problem in your circuit is the gate voltage. Gate Source voltage has a maximum of 20V (For most fet's, sometimes it's even less). and 24V on the gate may destroy your FET. Usually some safety margin is used, and gate voltage is limited between about 12V and 15V (max). Higher voltages do have an advantage, as they lower the channel resistance, but you need a safety margin for ground bounce, wire inductance and other parasitic effects. Sometimes a TVS diode directly between Gate and source is used.

author: magic
author_rank: Super Contributor
timestamp: September 11, 2023, 02:17:23 pm
content: 1N4148 is way too small for any serious current.

author: pqass
author_rank: Super Contributor
timestamp: September 11, 2023, 02:27:26 pm
content: As pointed out, the gate resistor is too high, the gate voltage is too high, and you're switching the gate via phototransistor base (not the usual emitter).I think the attached circuit is more appropriate for your application. It uses a series 12V zener to limit the gate voltage to 12V (20V is the absolute max for theIRF540). Simulator linkhere.However, today I learned something...I'm not sure if it was an accident to use the phototransistor base vs the emitter but you can use optocouplers in this way. SeeConverting to Photo-Transistor or Photo-Diode. It makes the rise-time much faster at the expense of 0.2% CTR (very low current capability, ie. needs an amp) but at 50Hz PWM is irrelevant for your application.

author: Houseman
author_rank: Regular Contributor
timestamp: September 11, 2023, 02:28:11 pm
content: Quote from: magic on September 11, 2023, 02:17:23 pmthat diode was used just for simulation. in reality it is a BYV29 that could not find in LTSpice model library

author: Houseman
author_rank: Regular Contributor
timestamp: September 11, 2023, 02:35:51 pm
content: Quote from: pqass on September 11, 2023, 02:27:26 pmMany many thank for the circuit.Nope You are right.There is a typo (my fault) in hasty LTSPICE drag and dropping to shrink the size of the circuit and take the screenshot for the forum. Sorry. Actually it is, as usually, CE connected.I will try and let You know.

author: Houseman
author_rank: Regular Contributor
timestamp: September 11, 2023, 03:04:38 pm
content: May I ask something unmentionable by the way?Is it better to drive the MOSFET in such a manner (PWM) in OFF and SATURATION mode or using OHMIC REGION?I mean.What voltage does the MOSFET actually see at its gate with such low frequency?Please correct me if I am wrong.Imagine 60% DC ( 12V for safety reason) at 50Hz PWM. That should be approx. 7,2Vavg.The Vgss is approx. 1,2nF. so at every 40% of each cycle (8ms) it has plenty time to discharge via 2,2k to ground to turn it off right? (t_discharge = 5 * τ so approx. 15us).So should I consider the MOSFET as a switch OFF and when ON in SATURATION?Is there a way to prove it via instruments during run? shoud I measure the 2,2k load drop with an oscilloscope?Does a lower PWM frequency exists (in such a case approx 65kHz) from which it uses ohmic region to steer the load?Hope this request won't hurt Your ears....Have bit of confusion in my head...Thanks folks, really appreciate Your time and effort to help me.

author: DavidAlfa
author_rank: Super Contributor
timestamp: September 11, 2023, 03:52:16 pm
content: You don't want to make linear regulator there, it will waste a lot of heat. That's what Ohmic region will do.Driving inductive loads with PWM is very effective, as it turns them into constant current buck regulators, the magnetic field in the coil is not turning ON/OFF, but kept at an average level.With 6K8 Rgate, switching time won't be marvelous, but not an issue if only toggling at 50HZ.Definitely 24 Vgate is a no-no.The real issue is 50Hz PWM, might be too slow for the inductive load, might saturate and ruin the PWM intention.If this is a relay or a valve, this would cause it to switch on/off at 50Hz. Try at least 100 or 200Hz!You might need a faster optocoupler, or drive a secondary BJT with it to switch faster.Quote from: Houseman on September 11, 2023, 03:04:38 pm65KHz lower than 50Hz? Please explain.If this was 50KHz from the beginning, this circuit is totally unapropiate, too slow!Also you don't need such high frequency to drive a coil, 10Khz would be fine.Maybe 25KHz to avoid human audible spectrum.

author: langwadt
author_rank: Super Contributor
timestamp: September 11, 2023, 04:13:36 pm
content: are you sure you can use the solenoid like that? usually it'll take one voltage to open and a substantially lower voltage will keep it open

author: Houseman
author_rank: Regular Contributor
timestamp: September 11, 2023, 05:06:43 pm
content: Quote from: DavidAlfa on September 11, 2023, 03:52:16 pmThanks first of all.Correct statement would be " Since the IRF540 mosfet has a discharging time of 15us, using a PWM above 65kHz Gate Capacitance it has no time to discharge fully and turn the MOSFET off right? So would actually the mosfet see the Vavg on its gate? and instead of using the OFF and SATURATE REGION, would it be at that frequency enter OHMIC REGION with varying the duty cycle?"50Hz frequency is actually the used one. You are right on the statement of using 100Hz instead.

author: DavidAlfa
author_rank: Super Contributor
timestamp: September 11, 2023, 05:15:07 pm
content: Yes, you would basically make a RC filter averaging the pwm duty, turning the fet into a variable resistor.Not good!

author: John B
author_rank: Frequent Contributor
timestamp: September 12, 2023, 12:04:06 am
content: Falstad linkHow about adding a pair of NPN + PNP darlington transistors to make a push pull output? The capacitor in the diagram is just to exaggerate the current. I put it into LTSpice to model more realistic transistor turn on/off effects and the circuit seems to give good linearity up to a few kHz. Obviously more parts are needed to clamp the gate voltage.

author: Houseman
author_rank: Regular Contributor
timestamp: September 13, 2023, 06:54:43 am
content: First of all thank You all.I have snooped around following all of your advices and have an important update.It all started with the suggestion of the working frequency of DavidAlfa: You are right the circuit should initially work at 100Hz, but it actually works with halved frequency.Schematic uses the mains frequency to generate the steering wave for the MOSFET. Simulation in LTSpice follows using an LM324.At the output of Q3 a 100Hz semi sawtooth can be seen due to the charging period of C6.Please correct me here if I am wrong:LM324 is used in open-loop configuration: it attempts to drive its output to either the positive or negative supply voltage rail, depending on the polarity of the input: so Vcc 18V or ground.Since I have a +3V/-3V sinusoidal waveform applied to the non-inverting input, the output waveform will exhibit rail-to-rail switching behavior. This means that as the input signal swings positive, the op-amp output will try to go as close to the positive supply rail as possible (typically limited by the op-amp's specifications). When the input swings negative, the output will try to go as close to the negative supply rail as possible. So I theoretically should have a 50Hz waveform.Instead LTspice simulation shows the blue Vout of U4/4 with a 100Hz freq.Falstad simulation shows 50Hz in attachmentWhat is going on here?Can You please explain this and help me understand?the LM324 has ground that is the 0Vac of the 24Vac input.Thank You

author: Houseman
author_rank: Regular Contributor
timestamp: September 13, 2023, 09:03:13 am
content: Added some measurements.24Vac is the supply input from a 230V/24Vac transformer.24Vac is rectified and converted with an LM317 into 18V to supply stable Vcc of the OPAMP.0Vac of the transformer is the actual ground of the board.There is NO connection to PE ground on the board, trafo is isolating so board should be floating right?. Even if the oscilloscope is earth grounded via PE mains cable so ground (black lead of the probe) is earth ground but since the board is floating it shouldn't affect measurement right?First image is measurement using LM324.#Waveform in blue is taken from Vin+ voltage divider of 24Vac1.Question: why does negative input waveform part (shown in blue) is smashed to -1.12V when also -Vcc of the opamp is attached to 0Vac? shouldn't it follow the LTSPICE simulation? (full range +3-3V)#Waveform in yellow is the output of the opamp. Frequency is around 100Hz (actually 96Hz 1 period).It actually follows the LTSpice simulation.Second image is probe using LM324B.#Waveform in blue is taken from Vin+ voltage divider of 24Vac. Same waveform as before.#Waveform in yellow is the output of the opamp. Frequency is now a perfect 50Hz.This case actually follows my thought of OPAMP in OPEN LOOP manner.The board mounts a LM324B so the final chopping frequency of the MOSFET is 50Hz andmaybecause of all the aforementioned problems...Datasheet of LM324 is attachedDatasheet of LM324B is found in thishttps://www.ti.com/lit/ds/symlink/lm224.pdflink (too heavy)Please help with suggestion.Very appreciatedBest regards.

author: Zero999
author_rank: Super Contributor
timestamp: September 13, 2023, 11:37:12 am
content: Quote from: Houseman on September 11, 2023, 01:03:12 pmYou have bought a defective product. The only correct and right thing to do is to return it as demand a refund. Don't try to repair it. It isn't your job and will mean the seller will continue to get away with selling junk.After you've done that, you can then consider what to do buy or build which will fulfil your requirements.

author: iMo
author_rank: Super Contributor
timestamp: September 13, 2023, 11:59:53 am
content: You may drive the IRF540 with 10MHz, no problem, provided your Gate driver can produce enough current needed for charging/discharging the Gate capacitance of the IRF..The gate resistor (6k8) in your first schematics above creates an RC low pass with the gate capacitance, therefore it does not work properly, imho.Remove the 6k8 and try it again, the optocoupler's output transistor shoud be able to produce 20-30mA to feed the gate hard. You may limit the gate voltage at the collector side (with the zener for example).PS: the gate capacitance is say 1.7nF (worst case, datasheet) thus you may calculate the current needed off the optotransistor for required 65kHz with sharp edges easily, you also need to decrease the gate-ground resistor accordingly such it could discharge the gate 1n7 cap fast enough tooPPS: see below - you would need around 100mA emitter current to feed the gate (low impedance driver) such you get "good edges" there. So the optocoupler needs to drive an additional transistor, it seems..Also the diode across the inductor has to be higher voltage one, like the 1N4007 or something like that.

author: Zero999
author_rank: Super Contributor
timestamp: September 13, 2023, 06:38:22 pm
content: That's a lot of current though and the negative of the drive signal is connected to the gate, not 0V, which might not be practical.

author: Houseman
author_rank: Regular Contributor
timestamp: September 13, 2023, 10:40:07 pm
content: Made a huge step troubleshooting ahead this evening. It all started from DavidAlfa's suggestion.The behaviour of the valve is caused by the fact that actually the mosfet is driven at 50Hz while the output is at 100Hz.The 24VDC is fed to the valve through an unfiltered bridge rectifier so 100Hz.First picture shows the correct waveform chopped while mosfet driven correctly at 100Hz using the LM324Second one when the mosfet is driven at 50Hz using the LM324B. In this case every 20ms the output is composed by a fully unchopped wave plus the correct chopped one.Since the Vheld to keep the valve in position is < Vopen this problem is seen clearly if I want to decrease the duty cycle. There is always the first fully complete wave that feeds the magnetic field (that is what I suppose at least).Now I would like to know how to resolve the issue of the 50Hz by first stage of U4/4 in the schematic and to know if really a revision of an OPAMP can change so huge the scenario..Attached the simulation of the LM324 and the correct sawtooth waveMany thanks to all, as always

author: tridac
author_rank: Regular Contributor
timestamp: September 13, 2023, 11:14:30 pm
content: Assume the gate drive signal is synchronised to the rectified AC ?. One point is that the pull in voltage for the solenoid is typically much greater than the holding voltage and that the parallel back emf diode may keep enough current flowing though the coil in the off state, to prevent it from releasing, introducing a delay. Switcher free wheeling diode effect. You may need to adjust the snubber diode circuit, and perhaps fit a pull back spring on the solenoid, to tighten up the loop and improve response...

author: Vovk_Z
author_rank: Super Contributor
timestamp: September 14, 2023, 11:53:35 am
content: Quote from: langwadt on September 11, 2023, 04:13:36 pmI wanted to ask the same.