I would like to use two op amps to drive a transistor when receiving two different voltage ranges from the same input signal for a project. For example, I would like to switch the transistor on when the input signal is below 2V or above 4V.

I wonder what is the best approach to solve this.

I am new to this, so please be patient.

  • 2
    \$\begingroup\$ I'd like to suggest a search on "window comparator" so you could familiarize yourself with this approach and edit the question to make it less broad. \$\endgroup\$
    – devnull
    Jul 30 at 15:32
  • 2
    \$\begingroup\$ Comparators are a bit like op-amps but don't suffer latch-up problems when the inputs are driven close to supply rails. Their open-collector or open-drain outputs make it easy to create an OR function on the two comparators of a window comparator. Plent of examples on the web. \$\endgroup\$
    – Transistor
    Jul 30 at 15:35

1 Answer 1


You are describing a window comparator application, which typically uses comparators instead of op amps. See one of my other answers to understand the difference between a comparator and op amp, and why to avoid using an op amp when a comparator is needed.

Since you need two comparators, a dual comparator IC chip will work well in this application. Some such ICs' datasheets will even show a window comparator application for you. For example, page 22 of the LM393LV dual comparator datasheet shows a window comparator design. You haven't specified a supply voltage or which transistor you are driving so you'll have to adapt the datasheet's design hints to your needs.


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