# Logic gate on negative signals

I need a logic gate to check if A or B or C is negative voltage (referenced to the ground). It does not matter if the output is positive or negative logic (as long as it is in positive voltages)

Does this circuit work?

Do you see other solutions or improvements?

One problem I see is that out goes negative if "True". simulate this circuit – Schematic created using CircuitLab

EDIT

I thought about this one too:

easier to compensate the voltage drop of the diodes by tuning the resistances. and I can invert the logic easily. simulate this circuit

EDIT

What I finally did, it works well:

The comparator has built-in reference, just tune the voltage divider to match it. I didn't use hysteresis, the comparator has a built-in hysteresis too, but only few mV. simulate this circuit

• How many volts of negative voltage are we talking about? – MartinF May 17 at 9:06
• around +/- 20 V – Rémi Baudoux May 17 at 9:52
• Regarding your second circuit, add a diode in series with the resistor which is now connected to the positive terminal of the opamp and ground, to compensate for the diode drop. – Huisman May 17 at 10:59
• And you need some hysteresis as MartinF also suggest. Maybe use a Schmitt trigger instead of an opamp? – Huisman May 17 at 11:01
• Not sure why you put a JFET in your first circuit. An NPN would work just fine there. – Dave Tweed May 17 at 11:25

## 1 Answer

This would be easier if the schematic had reference designators.

Both circuits have issues. In the upper schematic, (as above) an NPN bipolar such as a 2N4401 or 2N3904 as a common-base amplifier will work more "crisply". Base to GND, emitter to the diodes, collector to the output. To prevent the output from going below GND, add another diode in series with the collector and take the output from the diode/1K node.

In the lower schematic, two things. First, you cannot pull an opamp input 20 V below its negative rail. Add a diode from the inverting input to GND, anode to GND. This will clip the input at approx. -0.6 V. Also, is there a reason why the resistor values are so low? Power dissipation in the 1K going to the diodes node is 0.4 W, requiring a 1 W part. Consider raising the values of all resistors to 10K.

This applies to the first schematic also. You would be pulling approx. 20 mA through the base-emitter junction; that is unnecessarily high and affects long-term reliability.

Second, not all opamps can tolerate even -0.6 V below the negative rail on an input. Also, not all opamps can drive TTL logic levels when powered from +5 V. Read all of the datasheets and choose carefully.

• thanks, I will update the answer with the prototype I did, it works well – Rémi Baudoux May 21 at 9:15