# How to modulate solenoid current driver with PWM?

I'm trying to pilot solenoid valves in a hydraulic circuit. I have two types of solenoids, one which support 2.4 A and another 1.8 A.

I pilot the valves opening using 120 Hz pwm and this driver. It's on 8 V because of the 2.4 A solenoid that draw that much amp at 100% PWM.

In order to limit the current of the 1.8 A solenoid, I limit the PWM ratio. It just works.

That said, does it exist a better circuit to drive solenoids?

I'd like to be able to limit current for each type of solenoid and drive them with PWM 0-100% from zero to max current.

I was thinking of current mirror circuit like this but using mosfet:

Screenshot of one solenoid datasheet:

And the opening vs current: I use 145psi delta

Are there any standard circuits for what I'm trying to achieve?

Solenoids have to be driven from source, not on the return to ground.

• what are the voltage ratings of the two solenoids? .... it is unclear why you have to current limit the second solenoid Jun 17, 2018 at 5:48
• Voltage rating is 12V but do not rely on voltage, they are current driven like LEDs. If I plug a solenoid on 12V without any current limiter, it will burn. I need to limit the current of both solenoids to avoid some fumes or fire ! For one the current is limited by the source voltage because of the solenoid resistance for the other, I limit by PWM. But because I limit the current by limiting the PWM ratio and I'm on 8 bits, I also limit the number of steps I can achieve or the resolution. I added a screenshot of one solenoid datasheet. Jun 18, 2018 at 1:55
• something is not as it seems .... what is the make and model of the solenoid? .... do you have a link to the datasheet? .... at least include the 1) and 2) from the datasheet Jun 18, 2018 at 2:35
• Do you know the hydraulic load vs position profile? And load vs velocity if different than static position? Also desired control rate can be made smooth or abrupt depend on desired response. The holding force(current) vs load is another design choice as is the step load and slew rate pressure upon closing affecting spectrum of hydraulic system which may be stiff or soft(compliant) and thus noise . The possibility for stuttering closing may exist if you try to go too slow with inadequate force (current) so characterizing these helps optimize the design. Temp rise determines R rise rated Jun 18, 2018 at 2:38
• @TonyStewartolderthandirt The solenoids are rexroth L8. I can not really answer about hydraulics as this is not my domain. I have position/oil flow vs current curves in the docs and I based my design on this. I verified the data on the hydraulic system and it’s working as expected. I don’t get the holding force vs load and step load, slew rate pressure. If this helps: valves won’t open if I do not have oil pressure or trying the valves on a bench without hydraulic pump won’t move the spools. Jun 18, 2018 at 4:15

The best way to control the solenoid is with a MOSFET Half bridge with deadtime and avalanche clamp diodes.

These are many common imported boards used for motor control or discrete IC's that are low cost that can be suitable.

I normally choose max rated current >=5x operating current so that a minimal heatsink is needed from I^2R losses.

You can use 12V and PWM as a BUCK regulator on the solenoid to reduce the average voltage and thus holding current and position against the spring and oil pressure. You could also monitor current.

Is there a control profile you would like to improve?

If so, define which parameter , the response you want , and tolerances.

• The 120Hz PWM will be a loud buzz on the valve which can be eliminated by design according to requirements for loudness. ( can be improved )
• the 12V rating is intended to accelerate the value to a partial position then reduce to holding current, so the valve performance will be slow this way.
• Performance is not as good without flow feedback and if flow affects source pressure.
• NRVA4007 (1A diode) will return 2.1A thru the ground return for a duration of L/R with R~1 Ohm for that diode which means it pulses hot when shutoff.

# Your design may work but poor in some unspecified way.

• because you have not thought of all the environmental specfications
• you may have to meet some customer requirements included in your design question. -(Thermal drift in flow, acoustic noise etc. EMI on release, Conducted ground noise etc)
• diode temp rise with interference causes intermittent gate drive which causes diode failure then Vdrain rises to hundreds of volts if diode is open otherwise short.
• I thought about half-bridge too when I first designed the circuit but I then thought that the diode could do the job as I do not really need faster response. The goal of my question was to check if there's a better way to limit the current in the coil while still being a kind of simple circuit. All I need is to have the valve opened at 50% when I send a PWM of 50%. I do not want to interfere (as for now) with slew rate, but may be on the linearization of the opening vs current. I finally got more of the datasheet, see my edited question for the characteristics. Jun 20, 2018 at 21:46
• OK have you considered adding a pressure sensor after the solenoid. Jun 20, 2018 at 22:20
• I agree I need to revise the design, that's why I asked for advice here. I have no customer for this design and I can't put a pressure sensor after each A/B output on 8 valves, but I have a pressure sensor on the load sense port of the valve block. The load sense port pilots the variable pump. I thought about "accelerate the value to a partial position then reduce to holding current". The valve is not slow at all, the current is helped by oil pressure to move the spool. The valve is fast and I even have to slow it down for manoeuvrability. Jun 21, 2018 at 2:57
• Ok then what spec do you need to improve in results on the initial Falstad design? Jun 21, 2018 at 4:44
• I'd like to limit current but not by the mean of pwm as using 8bits pwm limits my usable steps. This is my first need. Jun 21, 2018 at 12:57