So I basically designed a circuit to limit the current flowing through a 250 ohm resistor by shutting down the current path using a mosfet when current goes above 30 ma:

enter image description here

R1 is the 250 ohm resistor that needs to be protected from over-current.

R4 and R6 create a voltage of 7.5 voltage for the comparator

R5 and R3 limit the voltage falling on mosfet gate to 10 volts.

if more than 30 ma pass through R1, the generated voltage will go above 7.5 volt and the op-Amp output will become zero shutting down the mosfet.

I have a slight problem. When v1 (is equal to zero volts) the currents of negative and positive op-amp inputs are +/-2.5 ma.

If I increase v1 to 4 volts, aforementioned currents reduce to 1 ma.

At v1 = 10 volts, they reduce to 250ua.

These values are too high. According to the datasheet of the op-amp, the input bias and offset currents shouldn't have exceeded 1.5na.

What am I doing wrong? What is the problem here?

In fact the output of the op-amp never becomes zero and R4 and R6 never create the 7.5 volt reference for the comparator. The voltage is always lower even going down to about 3 volts when v1 =0.

P.S. Simulations are performed using LTSpice.


Modern op-amps aren't meant to be used as comparators. If you want a comparator, use a comparator, not an op-amp.

Observe the simplified schematic in the datasheet: enter image description here

The diodes I circled protect the device from extreme excursions in the differential input voltage. You might be able to get it to work by adding 10 or 100 kohms in series with the op-amp inputs, but it would be better to just buy a part designed to work as a comparator.

Also notice that this is not a rail-to-rail input op-amp. All bets are off if you use it with 0 V on the input and on V-.

  • \$\begingroup\$ I added 1Mohm resistors and Got much better results. I'm wondering if these will affect device stability or cause other problems? \$\endgroup\$ – hadez May 2 '16 at 22:49
  • \$\begingroup\$ Stability should not be an issue when using it as a comparator. The 1 Megohm will probably slow down the response, but it might not be a problem depending on what you need. \$\endgroup\$ – The Photon May 2 '16 at 22:52
  • \$\begingroup\$ Actually speed isn't much of a matter here. I'll do some more simulations and see how things go. Thanks. \$\endgroup\$ – hadez May 2 '16 at 22:54

Most op-amps aren't designed to be used as comparators. While the specs table doesn't explicitly say it I would assume that the specified values for input bias and offset currents are based on the assumption that the differential input voltage is small (that is that the op-amp is being used as an amplifier with negative feedback).

Reading other parts of the datasheet ("note2" below the electrical characteristics and the simplified schematic) reveals that there are back to back protection diodes between the two input pins, so significant voltage difference between the two input pins will cause significant current flow.

  • 3
    \$\begingroup\$ :sigh: Sometimes I feel I have learned nothing in college. Theory is a world apart from practice. \$\endgroup\$ – hadez May 2 '16 at 22:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.