How to "reverse" the operation of the comparator - Page 1
Forum section: electronics / beginners

author: FcMirror
author_rank: Newbie
timestamp: November 19, 2022, 11:23:01 pm
content: HiI found some comparator calculations online. This comparator is giving 0V output the Vin is above 2.7V and it give 5V output when Vin is below 2.3V.How want to "reverse" its operation. I want it to give 5V output when the Vin is above 2.7V and I want to get 0V output when Vin is below 2.3V. How can I do it? Thank you in advance.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 19, 2022, 11:30:23 pm
content: Put a logic inverter at the output?Can Vin tolerate some current draw (from divider resistors)? If so, put a fixed voltage divider on -IN, delete Ry, and instead of Rx wired to +5V, wire it to Vin.Sometimes the resistor load isn't acceptable (e.g. a timer capacitor driven from a current source, the resistor would screw up the timing) and the logic inverter is actually the best solution. That or an analog buffer (voltage follower), but adding a whole op-amp seems over the top. (But sometimes you have a spare one handy, so it's not that ridiculous.)Tim

author: themadhippy
author_rank: Super Contributor
timestamp: November 19, 2022, 11:34:04 pm
content: try swaping the op amp + and - around

author: FcMirror
author_rank: Newbie
timestamp: November 19, 2022, 11:50:56 pm
content: When I am swaping the comparator + and - around it partially works but I am getting some error during simulations when I am changing voltage between 2.3V and 2.7V. Did I do something wrong in Multisim?

author: wasedadoc
author_rank: Super Contributor
timestamp: November 20, 2022, 12:04:40 am
content: That configuration of a comparator with feedback to the +ve input gives it hysteresis. Means the switchover voltage point is higher for rising inputs and lower for falling inputs. Often called "Schmitt trigger".https://www.electronicshub.org/schmitt-trigger-basics/See the tutorial for how to reconfigure to get the opposite polarity output. As mentioned above by T3sl4co1l that configuration has higher loading on the input source.

author: Benta
author_rank: Super Contributor
timestamp: November 20, 2022, 12:10:04 am
content: Easy.Connect the "-" input to 2.5 V.Remove the Rx/Ry resistors with a 50k series resistor and apply the input voltage to that.

author: FcMirror
author_rank: Newbie
timestamp: November 20, 2022, 12:11:20 am
content: So how can I do it? It there any chance that anyone could send any diagram/ quick sketch with the changes I need to make?

author: wasedadoc
author_rank: Super Contributor
timestamp: November 20, 2022, 12:12:46 am
content: Quote from: FcMirror on November 20, 2022, 12:11:20 amRead the link I gave you.

author: radiolistener
author_rank: Super Contributor
timestamp: November 20, 2022, 02:18:01 am
content: Quote from: FcMirror on November 19, 2022, 11:23:01 pmSuch operation is named "inverse", not "reverse"You can put logic NOT element, or just use transistor in a key mode. When comparator has 5 V output it opens transistor which will connect the transistor output to the ground as result you will get 0V. When comparator has 0 V the transistor is closed and transistor output is connected to +5V through resistor as result you will get 5V.Another way is to use two complementary mosfets with P and N channel types, one connects output to +5V and second connects output to groung:

author: FcMirror
author_rank: Newbie
timestamp: November 20, 2022, 12:02:56 pm
content: I used transistor in a key mode. It seems to work very well. Is there reason that you used 1MΩ resistor? Can it be calculated? That's probably stupid question but I don't know :/

author: Zero999
author_rank: Super Contributor
timestamp: November 20, 2022, 07:16:08 pm
content: Quote from: FcMirror on November 20, 2022, 12:11:20 amHere's how to rearrange the circuit so it's non-inverting and will still have the same hysteresis. The input will look like 626k connected to +V or 0V, depending on whether the output of the comparator is high or low.

author: Benta
author_rank: Super Contributor
timestamp: November 20, 2022, 08:18:33 pm
content: Quote from: Zero999 on November 20, 2022, 07:16:08 pmThat's exactly what I meant. OP, Thank Zero for the effort, please.