Smart battery discharger/tester

Hi, I saw your smart arduino battery discharger today from randomly surfing and is very interested. I have a few question hopefully you can help me out with it .

The question I have is about the NPN variable resistor.

From what I understand the op-amp used as a comparator is used to limit the current draw from the battery? That if I set the Vref to 2V and initially Vp is greater than Vn in the opamp so comparator output goes to high 5V and the NPN is turned on and current flows through the shunt resistor. And if current is too high then the feedback voltage Vn is now greater than Vp and comparator output goes Low and the BJT is turned off.

I am just wondering if my observation is correct if not please shed some light on me

Hi aznweirdo

That's what it is :slight_smile:

according to Wikipedia:

When the non-inverting input (V+) is at a higher voltage than the inverting input (V-), the high gain of the op-amp causes it to output the most positive voltage it can. When the non-inverting input (V+) drops below the inverting input (V-), the op-amp outputs the most negative voltage it can. The OpAmp will output 0 or Vs (maxi) according to Vn-Vp sign.