Solenoid driver design - Page 1
Forum section: electronics / projects

author: mbless
author_rank: Regular Contributor
timestamp: November 23, 2019, 10:38:03 pm
content: I have an old peak-and-hold PWM driver for injector solenoids that died on me. For those that don’t know, the peak-and-hold method uses an initially greater current (100% duty cycle) to actuate the solenoid faster and then a smaller current (lower duty cycle) to hold the solenoid open and reduce power and heat generation.I opened it up to see if anything let out the magic smoke. I expected to see a low-side N-channel mosfet to switch the solenoid on and off, but instead it uses a high- and low-side N-channel. The attached "high and low-side driver.png" schematic shows the driver design. Note the high-side mosfet requires a bootstrap driver to function properly.I’ve never seen this design before, so doing a search on it I found little information. The only article I found with info ishttps://www.edn.com/. In it isFigure 5showing a high- and low-side N-channel mosfet. The article didn’t address the design, but user Howman said there are three states:1. Drive mode: both FETs on2. Coast mode: one FET on and one FET off. Coil current freewheels through the other FET and diode.3. Brake mode: both FETs off. Clamps coil voltage to bus and is higher, thus current decays more rapidly yielding faster turn off.So my questions for EEVBlog are:1. Is there merit to this design and what Howman explained for the three states?2. Is this quantifiably better (faster turn off) than a single low-side mosfet? I tried simulating this in LTspice. The attached current trace image shows the solenoid current using single low-side mosfet (green curve) and the high- and low-side mosfet (blue curve) are right on top of each other. I see a difference in the low-side mosfet drain voltage, where the single FET design (green) has significantly more ringing. I do have my doubts that this can be simulated accurately given LTspice doesn’t capture armature movement effects on the solenoid current.3. Is there an even better solenoid driver design than either one of these?

author: langwadt
author_rank: Super Contributor
timestamp: November 23, 2019, 11:11:25 pm
content: with a single lowside mosfet you have the choice between using a flyback diode resulting in a slow turn off,or not using flyback diode and then every pwm cycle dumps energy into the mosfet

author: chuckb
author_rank: Frequent Contributor
timestamp: November 24, 2019, 02:19:37 pm
content: I don't know what it will do to the simulation but, D1 and D3 are 150 ma diodes used to pass or clamp 2 amps of circulating current.How quickly current changes in the inductor is based on the voltage across it. With just a MOSFET or D3 clamping the inductive energy there will be 1-2 V across the inductor so the current decays slowly. With the clamp MOSFET turned off (and diode isolated) the Transorb at 30 V will allow the current to decay 10-20 times quicker. A speedup of 10-20 time is about the limit I have seen. Winding capacitance may play a part in limiting this also.Another way to look at it is, the 0.11 Joules of energy in the inductor is dissipated quicker in the transorb (60W peak) verses the diode and the MOSFET (4 watts peak).In 28 V 1 amp solenoid power relays I have seen core movement generate back EMF that causes a 10% change in the current rise waveform.

author: mbless
author_rank: Regular Contributor
timestamp: November 24, 2019, 09:53:27 pm
content: Quote from: chuckb on November 24, 2019, 02:19:37 pmGood catch. I forgot to change it back to 1N5624 (3A) that's used in the driver. It doesn't affect the voltage or current traces, unfortunately.Quote from: chuckb on November 24, 2019, 02:19:37 pmThat makes sense, thanks for the info. I wonder how M1 is driven that would makes D3 useful then.

author: chuckb
author_rank: Frequent Contributor
timestamp: November 24, 2019, 10:38:49 pm
content: When M1 is turned on it connects R2 to D3 allowing the inductor current to flow through D3. Otherwise the M1 internal diode would block the current flow.What is the rise and fall time of the pulse source in the simulation? If it's to fast it may excite parasitic oscillations.

author: mbless
author_rank: Regular Contributor
timestamp: November 24, 2019, 11:56:27 pm
content: Quote from: chuckb on November 24, 2019, 10:38:49 pmI have it set to 1us step change from 0-10V and vice versa.

author: chuckb
author_rank: Frequent Contributor
timestamp: November 25, 2019, 05:11:56 am
content: Give it a try at 10us or 100us edge rates.

author: mbless
author_rank: Regular Contributor
timestamp: November 26, 2019, 12:16:25 am
content: I don't see a difference with 10 us. I can't do 100 us since the PWM is at 5 kHz. At this point I'm just going to whip up a board and experiment with it to see what gives the fastest turn off. Thanks for the suggestions.

author: langwadt
author_rank: Super Contributor
timestamp: November 26, 2019, 12:58:48 am
content: this is similar,http://www.theguestroom.net/manuals/Injectors%20and%20Fuel%20Supply.htm

author: chuckb
author_rank: Frequent Contributor
timestamp: November 26, 2019, 01:32:59 am
content: With 14V? injectors you will need 19V on the gate. Luckily these MOSFETs have a very rare and good 30V Gate-Source rating. So the components look like they will work in the actual circuit.When laying out the circuit, the Transorb, M1, D1 and D3 should be the first things the solenoid wires see when they get to your circuitry. Minimize this wiring length. This will keep voltage spikes under control. Then M1 can connect to the solenoid wiring. The control/Drive electronics and power return needs to be referenced to the source of M1. When the electronics transitions from 100% on to PWM the sudden reduction in input current will cause a positive voltage spike on your input power line. This is from the power wiring inductance. This can also be very different between your bench with a power supply and the final installation. I would make sure you have several hundred uF of cap and maybe a 30V Transorb on the power line supplying the control electronics to keep this voltage surge under control.Good Luck!

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 26, 2019, 02:18:55 am
content: Yeah, that circuit is roughly the right idea.A current mode hysteretic control is a good and cheap way to implement this; consider for example the classic L297/L298 stepper driver system. These sense ground-return current and PWM the load (which is basically a solenoid) to control current. When turning on or off, the load gets a large voltage (i.e., full supply), for high  slew rates. When idling in a state, the load's average voltage is chopped down.Those two chips are... terribly dated, but there are newer options, or you can make your own.I think there are solenoid controller ICs out there that can do everything in a few parts, but a discrete version could be done in, hmm, a dozen or so parts, if carefully optimized and you don't mind a few missing features (like wide supply range, super high efficiency, and various kinds of protections).The power stage isn't very interesting; the one- or two-switch version (e.g., compare the EDN example to the injector example above) can be used, with the downside that the one-switch version has to dump the excess coil energy (which, it can be dumped into an auxiliary power rail and converted back into the supply to avoid burning it), while the other circulates the energy by itself (a pretty clear winner, unless some kind of economy-of-scale should apply).The two-switch does have the downside that you can't use a common-ground (or +V) load.The EDN circuit I think uses a design intent from a handy philosophy: keep everything consistent if possible. Namely, all you really need is a current mode converter for the power stage, and then you can vary the current setpoint to get the leading step. It's always in control, making your circuit immune to destruction due to a shorted load. You don't need a bunch of arbitrary junk -- state machine and timers -- to run it. (Granted, in this case, the state machine approach may well be simpler.)Other gotchas include switching waveforms on a wiring harness, and general automotive concerns (e.g., reversed battery, load dump, smoking high temps in the engine bay). You would at least want those cables to be shielded up to the injector/solenoid, or to put the circuit right on top of the device. The former adds expense, the latter adds complexity (high operating temp).Tim

author: max_torque
author_rank: Super Contributor
timestamp: November 26, 2019, 03:35:54 pm
content: As a bit of an asside to this particular circuit, i found it interesting to note that most automotive direct injection drivers, that use a peak and hold architecture, actually also use the injectors themselves as the boost inductance! DI injectors need around 100V to actuate, so the vehicle 12v (nominal) system must be boosted, and to avoid having to have expensive and large inductors in the driver, they cleverly pulse the injectors with very short pulses, too short to actually open them (~250uS) during the "off time" for each injector. That allows the system to use the non firing injectors as the boost inductors, generating the higher voltage that is then switched to the firing injector! (and unlike port injection, DI injectors are necessarily limited to a maximum of around 25% duty,meaning there is always plenty of time and hence boosting current avaliable!

author: mbless
author_rank: Regular Contributor
timestamp: November 26, 2019, 09:16:27 pm
content: Quote from: chuckb on November 26, 2019, 01:32:59 amI was able to get more information on it. This particular injector is 24V, and the high-side mosfet's gate is driven with 40V to have a Vgs of 16V. I'm planning on using p-channel for the upper mosfet to avoid using a bootstrap driver. The high-side gate also gets the peak-and-hold PWM where as the low-side mosfet is full on for the injection duration.Quote from: chuckb on November 26, 2019, 01:32:59 amThanks for the tips. I'll give more thought to the input protection.

author: mbless
author_rank: Regular Contributor
timestamp: November 26, 2019, 09:28:06 pm
content: Quote from: T3sl4co1l on November 26, 2019, 02:18:55 amThank you for the input. Fortunately this is all for lab work, so I won't have high temperatures or alternator noise to deal with. I will have long leads, so I'll try a shielded cable.Speaking of noise, do you have any suggestions for a noise-free low-side current sense circuit? The driver discussed above uses a chassis mount resistor. The green curve in the attached image is the voltage drop across the resistor and is extremely noisy.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 26, 2019, 09:45:29 pm
content: Put an RC lowpass after the resistor, such that R*C of the filter = L/R of the shunt.Mind ground loop voltages and currents. Keep loops local. You may also be observing noise that's simply between ground and oscilloscope, and not actually between nodes in the circuit.Tim

author: MagicSmoker
author_rank: Super Contributor
timestamp: November 27, 2019, 11:00:12 am
content: Quote from: mbless on November 26, 2019, 09:28:06 pmAs Tim mentioned, you can compensate the L/R time constant of the shunt with an RC filter, but at risk of pointing out the obvious, note that this slows down the response speed/reduces the bandwidth. Wirewound resistors - even the non-inductive kind - are a poor choice here, as a result.The attached LTSpice circuit is one I whipped up for another post here awhile ago showing how to do RC compensation of a shunt's inductance (and get a bit of voltage gain to boot) with a standard differential amplifier circuit.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 27, 2019, 08:38:31 pm
content: Well that's the point, the shunt has excess bandwidth, in fact rising steadily above Fc = R / (2*pi*L). The RC, as given, exactly compensates this to give flat bandwidth.You can also make a bit of a transformer to null the EMF, which is kinda sorta practical for metal-link style shunts. Hard to know exactly how much to couple, though.Edit: your circuit left off the other leg -- the output is still peaked; this should be compensated like so. Ideally, R5*C2 is the same time constant, but it's actually less (and there's some other funny business, hence R7) due to the particular characteristics of the amp used. So, in general it would be 100pF and no ESR, but you can tweak for a given amp.Tim

author: MagicSmoker
author_rank: Super Contributor
timestamp: November 28, 2019, 01:19:52 pm
content: Quote from: T3sl4co1l on November 27, 2019, 08:38:31 pmQuote from: T3sl4co1l on November 27, 2019, 08:38:31 pmYou added a pole, basically, to complement the RC integrator. Blindingly obvious in retrospect, but not something I had thought of before so yet another thanks to you. Don't spend them all in one place!EDIT - wrong terminology.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 29, 2019, 02:24:28 am
content: You're welcome. Yeah, the key to a differential amp is to do everything on both sides, which again, seems obvious in retrospect. Also check the CMRR of the two arrangements.The transformer thing looks like this -- notice the shunt is more or less a single turn, so the field/EMF that it drops (its ESL) appears in the same space. Say we tapped some of that EMF with a turn or two, and put it in series with the sense line (blue)...The flux linkage is imperfect, so a single turn cannot be enough. The key is knowing how much of a second turn is needed. Would be doable with a planar transformer -- assuming you could get nichrome foil on your PCB.Not very manufacturable otherwise, but neat for testing and one-offs. (Adjustment is simple: apply a square wave and bend the loop until the peaking/rounding goes away.)Tim

author: mbless
author_rank: Regular Contributor
timestamp: December 26, 2019, 03:29:01 am
content: As an update, I made three driver versions: low-side, high-side, and combination low- and high-side driver previously shown. Here's a brief schematic of them.Upon testing them, I found that all three drivers are capable of producing the same solenoid current decay. This image shows the current vs. time after falling edge of the on signal.The reference is the broken equipment I spoke of earlier in the thread. The reference and three driver versions lie on top of each other when I soldered in the bi-directional TVS diode (D3). Without the TVS diode, the current decay is much longer, i.e. takes longer for the solenoid to close. (D1 appears to do nothing despite being in the reference equipment.)Given they are all the same, I will continue with the low-side driver since the n-channel mosfet is easier to drive and has lower resistance. I will post an update when I get around to testing the suggested current shunt filters.

author: viperidae
author_rank: Frequent Contributor
timestamp: December 26, 2019, 10:13:17 am
content: Weird, wouldn't D1 bypass the tvs and other diode in the high-side configuration?

author: MagicSmoker
author_rank: Super Contributor
timestamp: December 26, 2019, 03:23:31 pm
content: Quote from: mbless on December 26, 2019, 03:29:01 amD1 and D2 should be removed from the first two circuits if you want current to decay quickly. The same could be applied to the 3rd circuit, or just remove D2 and add another flyback connected from lower drain to +BATT to automatically recycle energy stored in the solenoid inductance back to the supply (this would be the traditional two-switch configuration).

author: langwadt
author_rank: Super Contributor
timestamp: December 27, 2019, 12:00:20 pm
content: Quote from: MagicSmoker on December 26, 2019, 03:23:31 pmsure? afaikt the first circuit has fast decay via D2/D3, D1 doesn't do anything, second circuit has slow decay via D1, D2/D3 doesn't do anything. Third circuit has fast decay when switching lowside, slow decay when switching highside

author: MagicSmoker
author_rank: Super Contributor
timestamp: December 27, 2019, 12:25:10 pm
content: Quote from: langwadt on December 27, 2019, 12:00:20 pmSure, I'm sure: your explanation on circuits 1 and 2 is correct, but that doesn't make what I wroteincorrect. As you noted, D1 does nothing in the first circuit, but also note that D2 is redundant, so it doesn't do anything, either, as long as the TVS breakdown voltage is higher than the supply voltage (which it should be), and it is, indeed, a bidirectional type as shown.In the second circuit, D1 renders D2 and D3 redundant and once removed the same applies to D2 as above, so it can also be removed.The 3rd circuit is halfway to being a proper two-switch driver but needs the corollary flyback diode to D1 to work properly, and note that both switches must be driven simultaneously for current to flow through the solenoid, so there is no option of just doing high side or low side switching. Finally, D2 is redundant as per usual and should be removed.

author: mbless
author_rank: Regular Contributor
timestamp: December 27, 2019, 07:15:23 pm
content: Quote from: MagicSmoker on December 27, 2019, 12:25:10 pmYes, the TVS is bi-directional and rated for 27V, and the supply voltage is 24V. I tested your suggestion see here.Removing D1 and D2 decreased the current turn-off by ~5%. Incidentally, I did a test without any of the diodes installed, and the turn-off time was reduced from 1.75ms to 0.3ms! I'm surprised the solenoid current can decay so fast without any diodes. Any thoughts on why that would happen, and is then better to leave it without diodes or keep them for protection? (I do have a 470uF electrolytic on the supply rail.)

author: langwadt
author_rank: Super Contributor
timestamp: December 27, 2019, 09:27:23 pm
content: Quote from: mbless on December 27, 2019, 07:15:23 pmwithout the diodes the diodes the "turnoff voltage" will be clamped to the Vbr of the mosfet, look at it's avalanche(and power) rating to see if it is happy about that

author: T3sl4co1l
author_rank: Super Contributor
timestamp: December 28, 2019, 12:00:22 am
content: Even if it's rated for avalanche (they usually are these days), I don't recommend using it on a repetitive basis. Solenoids are probably alright anyway, but you can just as well use a TVS with a voltage rating somewhat lower (say by 20-30%) than Vds, and get nearly the same slew rate.Again, the nice thing about two-switch with rectifier diodes, is efficiency; you won't get the highest possible slew rate, of course.At some point, it may be worth checking how much slew you actually need. Take measurements of the mechanicals, figure out how much it actually moves in the hundreds of microseconds, or milliseconds, the solenoid discharges in. Tiny stuff like injectors and print heads (do they still use those anymore?), probable. Big stuff like solenoid actuators/valves, probably not so much. If the actuator itself is slow, there isn't any point in a maximum-speed electrical solution, and then you can consider other goals like efficiency. If electrical speed is still required, a less efficient or more complicated solution is then an option.Tim

author: langwadt
author_rank: Super Contributor
timestamp: December 28, 2019, 12:49:57 am
content: Quote from: T3sl4co1l on December 28, 2019, 12:00:22 amwhy not use avalanche? (or some of the protected fet with active clamping)afaikt the two switch is the best of both worlds, slow decay without dumping energy into FET/TVS for the pwm current control and fast decay for turn off, dumping the energy in FET/TVS

author: mbless
author_rank: Regular Contributor
timestamp: December 28, 2019, 04:55:48 am
content: Quote from: langwadt on December 28, 2019, 12:49:57 amI will attempt to modify the 3rd version to make it like a true two-switch driver, though, I will probably have to spin a new board. Is the TVS usually omitted in such configuration, so it's a fast recovery from low-side drain to supply and another fast recovery from ground to high-side drain?Quote from: T3sl4co1l on December 28, 2019, 12:00:22 amThis is for an injector, so I was going to check the end of injection with my high-speed camera at work (won't be back to work for a few weeks). I have already matched the current profile of the OEM equipment, so it will be interesting to see if the faster decay actually results in a shorter end-of-injection delay. In reality I don't need to be faster than OEM (and shouldn't for repeatability purposes), so if the two-switch is the best way to go, then I can proceed with that.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: December 28, 2019, 05:16:54 am
content: Correct, you don't need the TVS if there are diodes doing the clamping. (Note the supply itself should have a bypass cap somewhere nearby. How near, depends on how fast the transistors are switching, and how much current. You can probably afford quite some distance, and quite some series gate resistance to slow it down and also save on EMI output from the switching edges being slower.) Indeed it's better that way, as you aren't risking pulling the full supply across the TVS if/when voltage swells -- not common events, but typical features of automotive tests: battery jumping, reversal, load dump.For example, on a 24V system, 100-200V diodes and MOSFETs will pass probably any test used in the industry.Aftermarket stuff may not need to handle this (or be expected to) -- but YMMV, caveat emptor and all that...High speed camera, nice.Tim