About my project:

I am working on a project that involves controlling several LEDs with two Intel Edison microcontrollers and a comparator circuit. There are five LEDs total controlled by four relays. Three LEDs are connected to the N.O. pin on each relay while the fault/ status LEDs are connected to the N.O. and N.C. pins on the same relay. Please see schematic below.

The first Edison chip is installed on a Mini-Breakout board which controls when the LEDs are turned on through relays triggered by GPIO pins. The second Edison is mounted on the Arduino breakout board which measures the voltage across the LEDs using analog inputs.

Using the LM2903 as a window comparator, and some voltage dividers as inputs, the circuit is designed to turn on a fault LED (relay 4 is N.C.) when the voltage across the three main LEDs falls outside of the recommended min and max values from the LED datasheet.

I am using the 7400LS series logic gates along with a bi-directional level shifter from Sparkfun (BOB-12009). The level shifter is used to step up the voltage from the Mini-Breakout board which uses 1.8V logic.

The problem:

The main idea is to indicate a fault in the system by disabling all three LEDs unless certain conditions are met, i.e., the 4th relay can only be turned on if both Edisons and the comparator circuit's output is high. However, when the comparator output (open collector) is triggered (pulled low) the relay is turned off which then turns off the relays to the three LEDS causing the output of the comparator to return to a high state, because, when the comparator chip is off its output state is high due to either a floating input to the AND gate or a 10k pull-up resistor. So, when the comparator returns high the relays are enabled again and the whole process repeats.

I am beginning to think that the only way this circuit can work is by allowing the fault LED to come on once and requiring the user to reset the circuit to re-enable the LEDs. I am able to turn the fault LED on by directly connecting the comparator output to the gate of the p-channel MOSFET (IRDF9210) at the N.C. pin of relay 4 but then both the status LED (indicating no problems) and the fault LED can be on at the same time.

My questions:

  1. If possible, how can I disable the LEDs when there is a fault and automatically restore functionality to them when the problem is fixed?
  2. Is it possible to incorporate a transistor that will serve as a switch between the input of the AND gate and the output of the comparator?
  3. Are there other more suitable comparator chips for this particular application?


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ Must be the largest circuit I've seen done in CircuitLab... \$\endgroup\$ Commented Oct 7, 2015 at 6:50
  • \$\begingroup\$ You may try adding some hysteresis to the comparator. When it initially trips, it will be a bit slow in all probability, so any disturbance can take the output back. There are some devices with built in hysteresis. Example: linear.com/product/LTC6752 \$\endgroup\$ Commented Oct 7, 2015 at 8:37
  • \$\begingroup\$ My first remark at this circuit is that there are 2 comparators (in the same package) that can have different status ("1" and "0" logic) that can burn your comparators. Try to put a OR gate in order to avoid this \$\endgroup\$ Commented Oct 7, 2015 at 9:32
  • \$\begingroup\$ @PeterSmith I'm not sure I understand how adding hysteresis could solve the problem. After reading the applications notes on the LTC6752 it seems like adding hysteresis would only prevent noise from the inputs of the comparator from tripping the output randomly but I am not having problems with noisy inputs. What do you mean by "any disturbance can take the output back"? \$\endgroup\$
    – kprince
    Commented Oct 7, 2015 at 15:13
  • \$\begingroup\$ The comparators have open drain outputs but I don't see any pull-up resistor. Start there. \$\endgroup\$
    – PaulB
    Commented Oct 11, 2015 at 7:36

2 Answers 2


You need a flip-flop and a reset button. You don't need anything fancy like a latch or master-slave flip-flop (called flip-flop in 7400 terms). Simply 2 NAND or NOR gates will do.

  1. The problem is that the stimulus for the fault is being turned off once a fault is detected. Once the LEDs are unpowered, there is no voltage to test and no way to automatically restart.
  2. A basic two transistor flip flop would work. For example. Alternatively, a single IC, such as a 74AHCT74, could be added after your final AND gate to provide a latching function. The fault output would be connected to PRESET, the reset switch connected to CLEAR. The input and clock would be "don't care" and would be connected to either supply or ground.
  3. The problem is the feedback loop created by the error output affecting the voltage input and not related to your comparators.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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