logo elektroda
logo elektroda
X
logo elektroda

Op-amp comparator circuit for detecting voltage outside 2V-3V band with 5V supply

174 13
ADVERTISEMENT
  • #1 21681595
    Graham Rounce
    Anonymous  
  • ADVERTISEMENT
  • #2 21681596
    Aubrey Kagan
    Anonymous  
  • ADVERTISEMENT
  • #3 21681597
    Graham Rounce
    Anonymous  
  • #4 21681598
    David Ashton
    Anonymous  
  • ADVERTISEMENT
  • #5 21681599
    Graham Rounce
    Anonymous  
  • #6 21681600
    Aubrey Kagan
    Anonymous  
  • ADVERTISEMENT
  • #7 21681601
    Graham Rounce
    Anonymous  
  • #8 21681602
    Aubrey Kagan
    Anonymous  
  • #9 21681603
    Graham Rounce
    Anonymous  
  • #10 21681604
    Graham Rounce
    Anonymous  
  • #11 21681605
    David Ashton
    Anonymous  
  • #12 21681606
    David Ashton
    Anonymous  
  • #13 21681607
    Aubrey Kagan
    Anonymous  
  • #14 21681608
    tongyun wang
    Anonymous  

Topic summary

✨ The discussion addresses designing a voltage detection circuit that outputs a high signal when an input voltage falls outside a specified band of 2V to 3V using a 5V single supply. The recommended approach is a window comparator circuit employing two independent comparators to detect voltages below 2V and above 3V separately, providing two distinct outputs. The LM393 dual comparator is suggested as an ideal IC due to its open-collector outputs, rail-to-rail input capability, and compatibility with single-supply voltages from 2V to 36V. Wiring the comparator outputs together can detect voltages within the band, but separating outputs and inverting inputs or outputs can achieve the desired outside-band detection. Using op-amps as comparators is possible but may cause oscillations near threshold voltages due to lack of hysteresis; adding hysteresis is recommended to stabilize switching. The LM393's open-collector output allows wire-OR configurations and can drive capacitive loads without additional current limiting resistors. Differences between op-amps and comparators include gain, speed, output stage design, and intended application, with comparators optimized for fast, clean switching and single-supply operation. Practical issues such as output jitter and oscillation when adjusting reference voltages can be mitigated by hysteresis and proper buffering of reference signals.
Generated by the language model.

FAQ

TL;DR: “An ideal IC to use for a window comparator is the LM393,” which runs on 2–36 V; add hysteresis to stop chatter. Build two thresholds at 2 V and 3 V, then invert for an outside-band alert. [Elektroda, Anonymous, post #21681598]

Quick Facts

What is a window comparator (aka window detector)?

A window comparator uses two comparators to signal when a voltage is inside a defined range. You can also keep the two outputs separate to indicate below‑window and above‑window states. Choose the polarity you want by swapping inputs or inverting outputs. [Elektroda, Anonymous, post #21681596]

How do I detect if my signal is outside 2–3 V with a 5 V supply?

Set two thresholds at 2 V and 3 V using a resistor ladder and two comparators. To flag outside‑band, swap each comparator’s +/− inputs or invert the combined in‑window output. This yields separate under‑ and over‑voltage indicators if needed. [Elektroda, Anonymous, post #21681598]

Can I get two separate outputs for <2 V and >3 V?

Yes. Treat them as two independent comparators with separate outputs. Decide whether each output should be active‑high or active‑low by selecting input polarity or adding an inverter stage. [Elektroda, Anonymous, post #21681596]

Which comparator IC is recommended for this job?

Use the LM393 dual comparator. It operates from about 2–36 V, supports open‑collector outputs for wire‑OR, and is well suited to single‑supply designs. “An ideal IC to use for a window comparator is the LM393.” [Elektroda, Anonymous, post #21681598]

Can I use an op‑amp like the MCP602 as a comparator?

You can, but op‑amps are slower and optimized for linear feedback, not threshold detection. Comparators are built for clean on/off decisions and often integrate open‑collector outputs for easy logic combining. Op‑amp outputs usually cannot be wire‑ORed without extra parts. [Elektroda, Anonymous, post #21681605]

Why do my LEDs flicker or chatter near the setpoint?

You are likely seeing oscillation and noise pickup at the threshold. Adjusting presets can inject mains hum, causing rapid toggling. Add hysteresis to introduce a small switching gap and stabilize the transition. “Hysteresis is the way to overcome this.” [Elektroda, Anonymous, post #21681605]

How do I add hysteresis to each comparator?

Add positive feedback from the output to the non‑reference input through a large resistor. This shifts the effective threshold slightly on each transition and eliminates chatter. If the pot network interacts, buffer the pot with a unity‑gain stage before the comparator. [Elektroda, Anonymous, post #21681602]

How should I set the divider for 2 V and 3 V thresholds?

Use a three‑resistor ladder from 5 V to ground to define reference points. For example, pick 2 kΩ, 1 kΩ, and 2 kΩ to create mid‑points matching a 2–3 V window. Feed these nodes to the comparator references and swap inputs to invert logic. [Elektroda, Anonymous, post #21681598]

Do I need input protection if my source might exceed 5 V?

Yes. Clamp the sensed input to ground with an approximately 5.2 V zener and add a series resistor. Comparator inputs draw nanoamp currents, so high‑value series resistors are acceptable and reduce stress during overvoltage. [Elektroda, Anonymous, post #21681598]

Can I wire the outputs together for a single “in‑window” signal?

Yes, with LM393 open‑collector outputs you can tie them together and use a single pull‑up for an in‑window indication. To get an outside‑window signal, invert that line or swap the comparators’ input polarities during design. [Elektroda, Anonymous, post #21681598]

Can LM393/LM339 drive capacitive loads or combine outputs safely?

Their open‑collector outputs are current‑limited, so they can directly charge a large capacitor without a series resistor. This helps with output filtering or simple timing without extra current‑limit parts. It also supports safe wire‑OR logic combining. [Elektroda, Anonymous, post #21681600]

Why did my op‑amp test rig oscillate even with decoupling?

Zero hysteresis invites oscillation near the switching point. Layout and decoupling help, but the fix is intentional hysteresis. Buffer the pot if the feedback perturbs your reference node, then re‑measure the switching levels. [Elektroda, Anonymous, post #21681602]

Can I wire‑OR with op‑amp outputs like with LM393?

Not directly. Op‑amp outputs are push‑pull and will fight each other. Use diodes or resistors to combine, or switch to an open‑collector comparator designed for wire‑OR behavior. [Elektroda, Anonymous, post #21681605]

Do I need rail‑to‑rail inputs for a 5 V window detector?

LM393 inputs handle near‑rail sensing in single‑supply use, which suits a 2–3 V window on a 5 V rail. This eases threshold placement without dual supplies or input shifting networks. [Elektroda, Anonymous, post #21681598]
Generated by the language model.
ADVERTISEMENT