Using Comparator As Logic OR Gate

About: Electrical Engineer, control systems, automation, small electronics, home automation, microcontrollers etc.

When you've got some comparators either already in your circuit or built into your MCU, there are some handy tricks you can use.  The following will show you how you can use a comparator to make a Logic Or Gate.

Resistors 3 and 4 are used to bias the non inverting input while resistors 1 and 2 are used to average the two inputs. 
Resistors 1 and 2 must be equal and resistor 3 must be selected to be two times the value of resistor 4. It is also recommended that resistors 3 and 4 are very large values as they will have a constant current draw through them and if a low resistance is chosen they can have a high power usage.

So now, if inputs 1 and 2 both go LOW(0 V), or lower than the input of the non-inverting pin, the output will go LOW.  If either of the inputs are HIGH the output will go HIGH.  You can also switch the pins of the comparator to create a NOR gate.

Both inputs will need to be Logic values (either High or Low) for this to work correctly.  If you are running analog ranging values through this circuit it will go LOW at 1/3 V+ rather than at 0 V (due to selecting resistor 3 to be 2 times the value of resistor 4).  You can obviously select resistors 3 and 4 to make this more accurate for analog signals, but it will never be perfect.



    • Tape Contest

      Tape Contest
    • Pie Contest

      Pie Contest
    • Paper Contest

      Paper Contest