Driving a solenoid via PWM with a MOSFET from a µC

Thread Starter

jdk1.0

Joined Mar 1, 2010
2
I've been working on making a flipper for a custom built pinball machine and have a few questions regarding driving the flipper coil.

Typically, pinball manufacturers have two coils in one: one with low resistance for the initial "kick" of the solenoid, and another that is mechanically switched in series with the first with much higher resistance. This ensures the flipper stays up, but that the solenoid doesn't burn out. (I think the current is lowered by an order of 10 or so when the switch is hit.)

My plan is to use an ATmega328 to send a PWM signal to a logic level MOSFET to regulate the current instead of using a mechanical switch. I would prefer to have the uC drive the FET directly, rather than use a dedicated driver, in order to simplify the circuit. Eventually, I'd like to have many solenoids on the playfield and want to keep the number of components down.

My solenoid has 3.5 Ohms of resistance, and I want to drive it at 24V (I'd rather not mess with the 50V that pinball machines sometimes use.), so I'm looking for a FET that can handle maybe 16A at 50V.

The uC will send 100% PWM for a fraction of a second, and then reduce to about 10% or so when the flipper is fully actuated. I want to use a 150 Ohm resistor between the out pin and the FET gate, which gives me a tested 30mA current out of the I/O pin. The PWM frequency will be 20-30 kHz to keep it out of the audible range.
This MOSFET I'm considering is an IRLU3105 (http://www.irf.com/product-info/datasheets/data/irlr3105pbf.pdf). My concern is about how much heat will dissipate with only 30mA to charge the gate capacitance. I estimate a couple of Watts using calculations and simulating with LTSpice, but I wanted to get some educated opinions before I fry my uC (again :). My uC informed me it doesn't like providing shoot through, nor acting as protection against back emf). The formula I used for switching Power is P = 1/2(ton + toff)*Vds*I*f = 1.4µs*24V*7A*20kHz = 4.7Watts. Although, I assume 2 or 3Watts since 24V probably won't be dropping across the FET during the entire rise/fall time. But, I don't like to assume anymore.

I calculate that the worst case static Power (correct usage?) would be 43mA*1.75 (derated at 125C) * 24V ~= 2W, which might be close to the Power dissipated from switching.

I'm attaching my shematic as a reference. The area plotted shows how the Drain voltage drops from 24V to 0V in about 600-700ns. This seems to check out when I calculate the Gate charge from the datasheet divided by the current: 20nC / 30mA ~= 700 ns. And, also 5V * 710pF / 30mA * 2*pi ~= 700 ns.
Are my calculations accurate? And, am I interpreting the datasheet correctly?

On a side note, would placing a resistor from the uC ground pin to the 24V ground add any appreciable protection for the uC?

Thanks for your time in reading this.
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
I'd plan on using gate drivers, even if you're building them from discrete components.

Otherwise, if you're going to be driving lots of these solenoids, you may exceed the package source/sink current limitations of your uC.

You might consider using a MOSFET with a lower Vdss rating; there are lots of 'em out there for the 30v range. Your gate charge will be considerably lower. I picked up some IRLR7807's that are rated for Vdss=30,Id=30, Rds(on)=13.8m,Qg=7nC - that's roughly 1/3 the gate charge you have now.

If you want to stick with around 50v rating, there's the IRLU024;Vdss=55,Rds(0n)=80m when Vgs=5v,Qg=15nC - 3/4 of what you have now.

Those are just a couple of references I had handy, a random pick of the hat so to speak.

Anyway, 24v/3.5 Ohms is 6.86A - so if you're going for maximum overkill on the Vdss and Id rating, it's going to cost you in terms of gate charge; which means slower turn on/off times.

You mention a resistor from the 24v ground to the uC ground - you already have them connected by wire in the schematic. Are your grounds between the uC supply and the 24v supply currently isolated? If so, you're going to have to use optocouplers to drive the gates; and that'll be another fun challenge - find one that's fast enough for your purpose. Also, they typically have rather anemic output current.

If the traces from the uC to the MOSFET gate(s) are very long, you'll wind up with a fair bit of inductance; roughly 15nH per 10mm. It adds up quickly.
 

Bernard

Joined Aug 7, 2008
5,784
Have you considerd using a current limiting resistor between coil & + supply, low enough to hold flipper on, paralled with large capacitor to supply inrush current. Gate capacity moot, one charge per flip.
 

Thread Starter

jdk1.0

Joined Mar 1, 2010
2
I'd plan on using gate drivers, even if you're building them from discrete components.

Otherwise, if you're going to be driving lots of these solenoids, you may exceed the package source/sink current limitations of your uC.
Maybe I should stick with gate drivers then. It does make sense to not bring the uC to its limit considering a bunch of pins will be used.

You might consider using a MOSFET with a lower Vdss rating; there are lots of 'em out there for the 30v range. Your gate charge will be considerably lower. I picked up some IRLR7807's that are rated for Vdss=30,Id=30, Rds(on)=13.8m,Qg=7nC - that's roughly 1/3 the gate charge you have now.

If you want to stick with around 50v rating, there's the IRLU024;Vdss=55,Rds(0n)=80m when Vgs=5v,Qg=15nC - 3/4 of what you have now.
The IRLR7807's look pretty nice, the only reason I chose one with higher Vdss was because I normally see recommendations for specing at 2x Voltage and 2x Current ratings. The lower gate charge looks great.

Anyway, 24v/3.5 Ohms is 6.86A - so if you're going for maximum overkill on the Vdss and Id rating, it's going to cost you in terms of gate charge; which means slower turn on/off times.
My project isn't what might be considered a "critical" application. I'll stick with moderate assumptions on the max punishment my flippers will get, and buy parts with higher ratings later if they keep blowing up.

You mention a resistor from the 24v ground to the uC ground - you already have them connected by wire in the schematic. Are your grounds between the uC supply and the 24v supply currently isolated? If so, you're going to have to use optocouplers to drive the gates; and that'll be another fun challenge - find one that's fast enough for your purpose. Also, they typically have rather anemic output current.
I'd rather not mess around with optocouplers. When I was testing out my circuit earlier with a power transistor I was using a DC wall transformer for my uC, and a 12V rail from a PC PSU for the transistor. I recall having to connect the grounds of each supply for it to work, but I didn't do much testing before I busted the uC by accidentally shorting the transistor.
My new plan is to run the uC off a secondary 12V rail from the PSU as I don't understand all the nuances of isolation/coupling/different grounds and all that.

If the traces from the uC to the MOSFET gate(s) are very long, you'll wind up with a fair bit of inductance; roughly 15nH per 10mm. It adds up quickly.
Thanks, I'll keep that in mind. It hadn't occurred to me until you mentioned it.



Have you considerd using a current limiting resistor between coil & + supply, low enough to hold flipper on, paralled with large capacitor to supply inrush current. Gate capacity moot, one charge per flip.
Thanks for that option, it seems pretty interesting. I'm running a couple simulations to find a good sized cap. One thing to note is that a flipper might be held on for a few seconds, and a quick "tap" of the button (perhaps a 50ms delay from release to press) to jostle the ball around. I need to find out if there is enough charge time on the cap if the player taps as fast as possible.

I attached a schematic of what I think you're talking about. Does it look right? One problem is that I can't get the cap to charge up to 24V if the charge time is under 100ms from quick tapping, or it doesn't offer high current for enough time if I lower the cap to get it to charge faster.
 

Bernard

Joined Aug 7, 2008
5,784
Hard wire simulation. The capacitor idea does not seem practical here,took 10,000uF to pull in, 2 sec. to reset. Using a linear solenoid, 4.3 ohms, pull-in 2.4A, hold 240mA, used 47 ohm in series with 12 V supply. Replaced cap with P ch MOSFET, paralleling resistor. N chanel FET simulated with SPDT switch. Negative V level when SW grounds coil is coupled to peak detecting rectifier, applying - drive to gate of P ch FET. Time FET is on depends on gate capacity, Cx & Rx. Representative values: 1M & .03; 2.2M & .01; 3.3M & .o1; 4.7M & .0068;6.8M & .oo47; gate about 1nF.Recycle rate about 5 to7 per second. Advantage is basically DC control lines, no concern for gate capacity, no 50K hz signals. Just a thought!!
 

Attachments

Last edited:
Top