I would like to implement a PWM controlled current source to drive 24V proportional solenoid valve using Arduino. What I need are the following:
- Input will be 5V PWM with 5000Hz frequency, duty cycle will increase the load current.
- The solenoids I need to use have internal resistances varying between 10-25 ohms.
- My circuit should give the same load current for ALL solenoids at an exact duty cycle.
- My maximum load current should be 2.5A, which means at %100 duty cycle (5V) the load current should be 2.5A for any solenoid I am driving (if it can draw it), so no matter the load resistance.
- My switch has to be at high-side, thus the load should be at low-side.
What I have tried so far are the following:
Even though I need my load at the low-side, I tried implementing this circuit by inputting my PWM from Vin to see if it gives a specific current for any solenoid I use at a certain duty cycle, as I thought the shunt resistor and OPAMP would create the current no matter the load, but it did not work for me, the load resistance is still effective, so for example at 50% duty cycle Solenoid 1 is drawing 500mA and Solenoid 2 can still draw 1A, thus the current is not the same for ALL solenoids at a certain duty cycle as I desired. Link: https://circuitdigest.com/electronic-circuits/voltage-controlled-current-source-circuit-using-op-amp
Also tried the following circuit, which is similar to the previous one, but the load resistance is still effective. Again, this switch is low side too but I thought I could translate it to high-side if it worked.
- Also tried the circuit below, but here, what to do with OPAMP's output is not clear for me. Do I read it from another pin and compare my PWM output and the reading and change my PWM accordingly at software?
- And lastly, I tried the circuit below, which is similar to the third circuit, but the solenoid's and shunt resistor's places are different. The result is similar as third, I am not certain about what to do with OPAMP's output. I think this one is the closest one out of all to what I desired, because the switch is high-side, and the shunt resistor is between load and ground.
For all the circuit above, I choosed resistor values to create such gain that 100% duty cycle 5V pwm input would translate to 2.5A load current. But for every one of them, load resistance was effective, the load current was not the same for a certain duty cycle.
Any help would be appreciated. Thank you already.
EDIT#1: Instead of getting the same current on all loads at a certain duty cycle, I guess the duty cycle should be changed accordingly to get the same current on all loads, by sensing the current on shunt resistor and feeding it back. But still maximum should be 5V input for 2.5A I load
EDIT#2: Guess what I need is current limitting PID loop, any help?