Driving proportional valves from microcontroller
I am looking to drive a current regulated proportional (solenoid) valve that needs up to 85mA @ 24V from a microcontroller.
So far I found this circuit that looks pretty straightforward:
What are other low cost options? Is there such a thing as a programmable current source that I can drive through SPI or I2C? So far I wasn‘t able to find one.
I would drive the valve by PWM with a low side switch. All you need is the transistor and the flyback catch diode. The solenoid coil has significant inductance, so will smooth out the current on its own. I‘d stay above the audible range, but most likely the solenoid will "see" only the average well below that frequency. At 25 kHz PWM frequency, for example, you get 40 µS per pulse. That is quite a long time for a modern microcontroller, so you will have plenty of resolution and lots of cycles to compute how long the next pulse should be.
At your voltage and current, you can use something like the IRLML0030 as the low side switch and directly drive it from a digital PWM output of the microcontroller. Don‘t forget the reverse diode across the coil. A Shottky would be good. 30 V 1 A Shottkys in SMA packages are plentiful and cheap.
You say you want to control the current, but is that really just a internal parameter of a larger control system? For example, are you really trying to control pressure, flow rate, or something else? If the solenoid drive is inside a larger feedback loop, then you can just make the PWM duty cycle proportional to the signal. It won‘t be completely linear, but plenty close enough for the outer feedback loop to work with and eventually control the desired parameter correctly.
I actually did exactly that once in a real commercial product that controlled the pressure on the output of the valve. I did compensate the duty cycle based on the measured power voltage, since that could vary widely in my case. That means the outer control loop computes the desired solenoid drive level, and the low level code computed the PWM duty cycle from the desired drive level and the actual supply voltage.
I‘ve done a fair number of drivers for proportional valves and find that low PWM frequencies work better - the vibration from the PWM reduces "sticktion" in the valve. This is for both gas pressure valves (large industrial process ovens) and for hydraulic servo valves. Low frequency PWM works way better than either DC or high-frequency PWM. My stuff is usually in the several hundred Hz region. The lower sticktion reduces the hysteresis in the valve. That‘s been my experience - YMMV
Well, why not make it yourself? Implement this:
Connect PWM with LPF or DAC to voltage input, and You‘re good to go. To make it robust You can connect feedback to ADC and implement PID driver, so output will be exactly what You desire. It is easy as a pie, first simulate it with LTspice to check ranges and stuff. You don‘t need to use expensive IC as well, you can go for low frequency high voltage OPAMPS and single 2n7002 fet driven directly from OPAMP.
edit2: WOA? Why do you need such a great mosfet? Is it rated for 80A not mA. Go for small ones, they have way smaller gate capacitance.