# Trying to understand PWM current in a coil/inductor

I have asked this question elsewhere, but have not been able to understand the problem.

I have a re-purposed solenoid door lock. It is on for long periods, and I read I could drive it with PWM to reduce the overall current, once latched.

I have built a circuit and it works fine – but, when looking at the signals on an oscilloscope it raised issues, now the more I read the more confused I am getting.

I have created a simple LTspice simulation to try and replicate it.

The coil is 12 V, 35 mH, 25 Ω.

If I supply it with a 1 kHz signal at 50%, I originally assumed the current would be half the full load current, i.e. 480 mA 100% and 240 mA 50%.

Now I understand that this is only true if the on time is long enough to get the full current.

t-L/R = 0.035/25 = 0.0014 s = 1.4 ms. The on time for the 1 kHz 50% is 500 μs.

So, what I understand (I hope) is that when I apply a 100% drive, 12 V is put across the coil and current starts to build, the inductance is slowing the charge until it reaches it’s maximum at 5*t, then the coil resistance takes over and the full 480 mA is drawn (as in my 100% image).

When I apply PWM to the coil, if I have selected a frequency and/or duty cycle that does not allow the current to reach its maximum, it will charge to a point, switch off, then do it again. At switch off, energy stored in the inductor is lost via the diode.

The current reached will then depend on the frequency/duty cycle, i.e., rate of change.

So when driving at 50% duty, I may not be driving at 50% of the current, so the coil may actual be seeing an average of much lower and then fail. I mean it’s not a mathematical 50%.

I would have to drive at 100%, 50% of the time, but to do this I would have to have the coil energised for much longer anyway.

I looked at an IC datasheet – DRV101, this states it drive solenoids at 24 kHz, at 50%, but surely that depends on the coil being used.

If I look at my 50% image, I would say that the power supply will actually just be seeing 50% of this reduced signal.

Am I overthinking this, is it just that you can drive the coil while not reaching the full current? My concern is what current the actual coil is seeing – according to my simulation it has 12 V across it, but is only drawing around 250 mA.

I also wanted to add an CLC filter so it was less noisy and the power supply would see just the average of the peaks, which would then mean it could be smaller. In my case I thought I would end up with 480 mA pulses averaged by my filter to 240 mA.

Is it just about keeping enough current through the coil to keep enough magnetic field to mechanically operate the solenoid, or whatever is being used?

I am obviously missing something fundamental.

• "At switch off, energy stored in the inductor is lost via the diode." Not immediately. When the transistor is on, you're charging the coil with +12V. The coil current ramps up at a certain rate. When the transistor is off, you're discharging it with about -7V, which is the combination of the diode's Vf and the drop caused by the coil's own resistance. The current should ramp down at a slower rate. Your first graph is labeled I(R3), but there's no R3 in the circuit. I suspect this is the supply current, not the coil current. Can you please clarify what the graphs are actually showing? Commented Feb 18, 2023 at 15:58
• Where are you measuring the current in the PWM case? The annotation appears to say I(R3), but there isn't an R3 on your schematic. Commented Feb 18, 2023 at 15:58
• Apologies, wrong image - R3 is 0.1R placed between V1+ and L2, so the current into the inductor - although i measure the same when measuring directly across L2. Commented Feb 18, 2023 at 16:14
• I strongly suggest you put a monitor resistor in series with L2 within the D1 loop so you measure the inductor current at all times, not just when it's being powered by the supply. Rerun the spice simulation, and edit the results into your question. or if you want to be fancy, put a monitor resistor in series with V1 to measure power supply current into L2, and a resistor in series with D1 to measure the diode current into L2. You will be intrigued. Commented Feb 18, 2023 at 17:34
• @Gordon although i measure the same when measuring directly across L2.  You can't measure current across a component, you measure it through a component. The current through L2 is not the same as the current delivered by the V1 supply. Commented Feb 18, 2023 at 19:24

So, what I understand (I hope) is that when I apply a 100% drive, 12 V is put across the coil and current starts to build

yes

the inductance is slowing the charge until it reaches its maximum at 5*t, then the coil resistance takes over

It's not as sudden as that.

As the current builds, the IR voltage drop across the coil's internal 25 ohm resistance (not shown on your schematic!) builds, subtracting from the applied 12 V. Therefore as time goes on, there's less voltage across the inductance, and so the current ramps up slower. 5t is a very hand-wavy end point. The current builds for ever, but it's reached more than 99% of its final current by 5t.

and the full 480 mA is drawn (as in my 100% image).

Once all the voltage appears across the inductor's resistance.

When I apply PWM to the coil, if I have selected a frequency and/or duty cycle that does not allow the current to reach its maximum, it will charge to a point, switch off, then do it again.

Yes

At switch off, energy stored in the inductor is lost via the diode.

No. At switch off, current continues to flow through the diode, causing a voltage drop of around 0.7 V or 0.3 V depending on diode technology. This voltage ramps the current down, but quite slowly, so there is a slight energy loss from the inductor.

The average voltage across the inductor's resistance, neglecting the small voltage drop in D1, is the supply voltage times the duty cycle. In the case of 12 V and 50% duty cycle, that will be 6 V (less a bit counting the diode) to give an average current through the solenoid of around 240 mA.

This trick of reducing current to a door solenoid is based on the fact that when the ferrous keeper is in contact with the pole pieces, the magnetic reluctance drops radically, and a much smaller current is needed to keep it closed than is required to pull it closed from open with an air gap.

You appear to be monitoring current in the wrong place.

simulate this circuit – Schematic created using CircuitLab

There are three places you could put your R3. You appear to have yours at R3supply. This monitors the supply current, not the inductor current. If you want to know the inductor current, monitor across R3inductor. An an experiment, monitor across R3diode as well.

Don't forget to actually show the intrinsic Rinductor of 25 ohms. Without it, your inductor current would ramp, not to infinity as M1 has some residual on resistance, but to a very large value.

• Thank you Neil_UK, Commented Feb 18, 2023 at 16:30
• Just to clarify, With my 50% image - this this shows peaks of 250mA, so is the average 250mA through the coil - and would that then make the average the power supply would see 50% of the 250mA? Commented Feb 18, 2023 at 16:32
• You have R3 in the wrong place. It should be in series with L2, within the D1 loop. Then you will see the current drop from the peak 250 mA down to a minium of about 170/180 mA (difficult to interpolate the graph without grid lines). So the mean current drawn from the supply is indeed nominally 50% of your 250 mA. However the mean current delivered to the inductor is about 250 mA. You have discovered the buck converter! The mean output current is higher than the mean input current. The power input is the power output less the small losses in the FET and diode. Commented Feb 18, 2023 at 17:17
• Neil_UK, Thankyou, i can now see: schematic, I(R4) I have added my 25R to the inductor setup. The thing i am still confused about is:- "The average voltage across the inductor's resistance, neglecting the small voltage drop in D1, is the supply voltage times the duty cycle. In the case of 12 V and 50% duty cycle, that will be 6 V (less a bit counting the diode) to give an average current through the solenoid of around 240 mA." Commented Feb 19, 2023 at 15:51
• I have tried changing the frequency, which only has a small impact on the average current, but if the on time is shorter than the time constant of the inductor, i expected the impact to be greater. Is this due to the inductor not discharging on each pulse, and that is why the ripple is left? (This is my next step, trying to reduce this with a series inductor and capacitor or two). Thank you for taking the time to help my understand this. Commented Feb 19, 2023 at 15:51