# Sensing solenoid current

I want to sense the current through a solenoid when it is ON. Ideally I would want this for testing purposes and overcurrent protection. As I have a free ADC pin in my microcontroller, I came up with the approach below. I don't expect a current greater than 500 mA, and the coil will be given a single pulse, no PWM. Is this a good idea? I'm looking for a simple solution, i.e., not extra ICs or amplifiers.

• What voltage is Vcc, what part number is the FET, what is the resistance of the solenoid, and what voltage is the Gate pulse? What part number is the MCU and what voltage is it powered with? Why do you need over-current protection? Apr 26, 2020 at 4:53

What you draw is right, you are almost there. Here is what you have to consider: what voltage drop do you expect on R16?

V = IR, right? So if V is relatively high, for example 2V, the VGS of the gate pulse will be affected. Not to mention the power on the resistor, which you also have to consider.

So what people usually do is selecting a low resistance for current sense resistor. Maybe 0.1R or 0.01R, depending on your current. And then you need to amplify the IR before putting it into your ADC.

Dont panic because of the additional OPAMP. A simple one would cost 10-20 cents, and a few resistors around.

If the current is high, another good idea would be to use a differential amplifier, as the GND point near the resistor might not be at exact same potential as the amplifier's GND, due to imperfections of the circuit (non-zero resistance).

• OK. I don't want to worry about the opamp, but let's say I want to sense between 100 mA and 500 mA, a 0.01 ohms resistor will yield 1 mV to 5 mV, which a 12 bit ADC would perhaps find well?
– user115094
Apr 25, 2020 at 23:10
• some 12 bit ADCs only have 10 usable bits, so you might not get a useful result from that setup, burn as much voltage in the sense resistor as you can afford keeping in mind that you will need to drive the MOSFET gate that much more too. Apr 26, 2020 at 0:31
• In any application you will always want to use the most of your dynamic range. For many reasons. For example, today it's 100mA and 500mA, tomorrow you will decide you also need 50mA, but they there would be not enough resolution. Or the other possible scenario is that noise and board (or IC) imperfections will cause you offsets and errors. Either way, use a buffer. As a bonus you can have a potentiometer to adjust gain.
– user76844
Apr 26, 2020 at 22:36

not really, voltage drop over R16 would be kinda low for ADC sense, it would be on edges of noise. Personally I would go with an additional transistor , it will open by Vdrop on R16, and give you a logical signal '0' if curr over. '1' - if OK; so npn, B-> R16,Q1 ; E-> ground, C- resistor and Vsuppl, another resistor as divider in parallel C and E of transistor, to make logical "1" Voltage. When transistor "ON" it shorted that resistor making logical "0"

• How could that small voltage across R16 be enough to turn on an npn transistor? Apr 26, 2020 at 4:22
• need approx 0.67V to fully open it, so it depend on current Apr 26, 2020 at 20:25