This is a working circuit that uses a 0-5 V signal from the PWM output of an Arduino to control current in an inductive load
In this circuit, the Op-Amps and the Arduino(Nano) are supplied 5Vdc from the Source-V1. The FET U3 controls the current through a Solenoid having a resistance of 14 Ohm and an inductance of 10mH. The current in the solenoid is varied by means of the voltage source V3 that is ramped up from 0V to 5V as this comes from a PWM output of the Nano. The first amplifier U1 is used to provide a gain of 6.6 for the current sensed by the 1 Ohm resistance. This gain is arranged such that the voltage drop across R4(1 Ohm) across its 0-Max range co-relates with the 0-5V range from the Arduino. The second stage amplifier is a differential amplifier that checks the controlling voltage V3 with the sensed voltage Vsense caused by the FET's current. Thus the output of the 2nd stage amplifier drives the gate of the FET in a precise way by comparing the Arduino's voltage with the sensed voltage fed back to it.
This circuit can easily be adapted to any current range, by changing the value of the sensed resistor. In the above case, a 0-3.5V change in V3 produces a stable 0-450mA current in the solenoid. There are Free-wheeling diodes across the solenoid as well as the FET to prevent damage to the FET/Op-Amps/Arduino due to back EMFs generated in the coil.
In this circuit, the Op-Amps and the Arduino(Nano) are supplied 5Vdc from the Source-V1. The FET U3 controls the current through a Solenoid having a resistance of 14 Ohm and an inductance of 10mH. The current in the solenoid is varied by means of the voltage source V3 that is ramped up from 0V to 5V as this comes from a PWM output of the Nano. The first amplifier U1 is used to provide a gain of 6.6 for the current sensed by the 1 Ohm resistance. This gain is arranged such that the voltage drop across R4(1 Ohm) across its 0-Max range co-relates with the 0-5V range from the Arduino. The second stage amplifier is a differential amplifier that checks the controlling voltage V3 with the sensed voltage Vsense caused by the FET's current. Thus the output of the 2nd stage amplifier drives the gate of the FET in a precise way by comparing the Arduino's voltage with the sensed voltage fed back to it.
This circuit can easily be adapted to any current range, by changing the value of the sensed resistor. In the above case, a 0-3.5V change in V3 produces a stable 0-450mA current in the solenoid. There are Free-wheeling diodes across the solenoid as well as the FET to prevent damage to the FET/Op-Amps/Arduino due to back EMFs generated in the coil.