forming a comparator from two transistors  question - Page 1
Forum section: electronics / projects

author: john23
author_rank: Frequent Contributor
timestamp: October 17, 2024, 08:57:24 am
content: Hello, I was told that i could build a comparator with hysteresys using two transystor.Is there some manual i could use and simulate in LTspice?Thanks.

author: SteveThackery
author_rank: Super Contributor
timestamp: October 17, 2024, 09:03:40 am
content: https://www.google.co.uk/search?q=two+transistor+comparator+circuit

author: john23
author_rank: Frequent Contributor
timestamp: October 17, 2024, 09:09:12 am
content: Hello I need the feedback hysterys property also.

author: 2N3055
author_rank: Super Contributor
timestamp: October 17, 2024, 09:36:44 am
content: Quote from: john23 on October 17, 2024, 09:09:12 amKey words are "Schmitt trigger"

author: SteveThackery
author_rank: Super Contributor
timestamp: October 17, 2024, 10:01:05 am
content: Of course, silly me.https://www.google.co.uk/search?q=two+transistor+schmitt+trigger+circuitAll of this is available via a Web search, of course. A Schmitt trigger with a variable threshold is what the OP seems to require.

author: 2N3055
author_rank: Super Contributor
timestamp: October 17, 2024, 10:08:52 am
content: Quote from: SteveThackery on October 17, 2024, 10:01:05 amHe did not say "variable". Just hysteresis and 2 transistors.

author: SteveThackery
author_rank: Super Contributor
timestamp: October 17, 2024, 10:22:09 am
content: Quote from: 2N3055 on October 17, 2024, 10:08:52 amYes, but I thought there was an inherent expectation that a comparator has a variable threshold so you can compare any two voltages; otherwise, as you say, it's just a Schmitt trigger.

author: john23
author_rank: Frequent Contributor
timestamp: October 17, 2024, 03:31:10 pm
content: Hello few questions:1. if i use opamp with positive feedbak, isnt it going to create stability issues?2.Why cant we use negative feedback?3.can i use comperator to do shmidt trigger?is it better.

author: TimFox
author_rank: Super Contributor
timestamp: October 17, 2024, 06:36:27 pm
content: If you want to Google "Schmitt trigger", it helps to spell it correctly.From Wikipedia: "In electronics, a Schmitt trigger is a comparator circuit with hysteresis implemented by applying positive feedback to the noninverting input of a comparator or differential amplifier."There are two-transistor Schmitt trigger circuits, but using the differential amplifier input of an op amp or comparator IC gives a more temperature-stable threshold.

author: schmitt trigger
author_rank: Super Contributor
timestamp: October 17, 2024, 08:13:22 pm
content: Quote from: john23 on October 17, 2024, 03:31:10 pm1- quite the contrary. The output will swing rail to rail, no intermediate voltage values. Plus, the hysteresis prevents the output “chattering” while the input is close to the threshold voltage.2- negative feedback decreases the overall gain. It would take a higher voltage delta to cause the output to change states.3- a proper comparator is uncompensated and therefore will slew faster than the equivalent opamp. Think the LM324 and LM339. Additionally most comparator outputs are open collector (drain) which means that the output voltage can swing to a different value from the supply voltage. This is useful for example, if you are monitoring a 12V battery and would like to interface to a 3V3 microcontroller.

author: Kurets
author_rank: Regular Contributor
timestamp: October 18, 2024, 05:01:36 am
content: I would not agree on stating that positive feedback does not cause instability. To me this causes a confusion of concepts, stability as a linear amplifier and stable logical state.Positive feedback degrades stability of an opamp as a linear amplifier. On the other hand, positive feedback as proposed in the circuit above improves transitions between outputs slamming into the rail on positive and negative sides.Overall, I would advise the OP to look at the two transistor Schmitt trigger, this can solve the question asked. If an IC is to be used, opamps should, in my opinion, be avoided as comparator substitutes except to save a chip or PN in a commercial design. Opamps commonly have issues making them bad comparators: max differential Vin, not all are R/R I/O, slower slew rate, etc.

author: john23
author_rank: Frequent Contributor
timestamp: October 18, 2024, 12:48:08 pm
content: Hello, I have built a shmidt trigger as shown below in the manual photos and LTspice.Few questions:1.why i didnt get the good accurate photos as in the phot from the manua?2.What kind of feedback we have between the Bjt's? current/voltage? positive or negative?https://www.johnhearfield.com/Eng/Schmitt.htm

author: Ian.M
author_rank: Super Contributor
timestamp: October 18, 2024, 01:17:51 pm
content: I think the site you linked has the answers. Work through their math, and unless there's an error in their analysis, the LTspice results should match.You may care to take a look at this two transistor Schmitt trigger circuit (LTspice sim attached). It avoids the problems the load current causes in the simple NPN emitter coupled version's emitter resistor. Instead it uses a PNP to compare the input signal with a voltage on its emitter set by a potential divider across the supply rails. Its collector then drives a common emitter NPN to switch the load. Hysteresis is provided by the feedback resistor R4. If you lower the supply voltage, you need to increase R7, the lower resistor in the potential divider to keep the switching thresholds symmetrical about Vcc/2.

author: john23
author_rank: Frequent Contributor
timestamp: October 20, 2024, 08:05:18 pm
content: Hello Ian, Why did you add diode D1?and a resitor R4 as 1Meg?Thanks.

author: Ian.M
author_rank: Super Contributor
timestamp: October 20, 2024, 10:05:59 pm
content: D1 limits the reverse Vbe of Q1, which does two things - it helps make the input impedance similar for high and low input voltages, and more importantly at higher supply and input voltages, prevents the reverse Vbe exceeding 5V, the 2N3906 datasheet maximum limit. Somewhere around 6V to 7V reverse Vbe, the junction will Zener, and reverse current through it can cumulatively and permanently degrade the transistor's gain. The gain degradation is usually not extreme, but any degradation that can shift a circuit's operating point is generally undesirable.R4 provides DC positive feedback and thus hysteresis. You have the sim so can see its effect for yourself - first change the first two parameters of V2 to 5.3 6.6 to reduce the input swing to barely enough for the circuit to switch, run it to confirm it still switches cleanly, then disconnect R4 and run again and you will see the output no longer 'snaps' between its high and low states, but instead transitions linearly over an input range of approx 100mV.