Issue in basic transistor circuit - Page 1
Forum section: electronics / beginners

author: Vindhyachal.takniki
author_rank: Frequent Contributor
timestamp: April 01, 2021, 08:47:34 am
content: I have three input levels: 0V, 2.5V & 5V.Output I need is:A). 5V or 0V input, then output 0VB). 2.5V input, then output is 5VNeed to made this circuit by using low cost transistors only. I tried making below circuit, but seems like transistor as buffer is not working. Can someone suggest correct method with lowest transistor count

author: David Hess
author_rank: Super Contributor
timestamp: April 01, 2021, 03:28:42 pm
content: The circuit which commonly performs that function is called a "window comparator". It can be made with two comparators.

author: magic
author_rank: Super Contributor
timestamp: April 01, 2021, 04:17:00 pm
content: I don't quite get this circuit.Q2 is an inverter which goes low when Vin exceeds ~0.7V. Fine, that will take care of detecting the 0V case.Q1 is an emitter follower. Meh, not sure why.Q3, Q4 is kinda a NAND gate, but Q3 is also an emitter follower. The output will never go lower than Q3 emitter because of Q3 saturation. That's not good.And NAND doesn't even look like the right function here, it seems you need NOR. This is as simple as removing Q3 and making Q4 driven by either Q1 inverter going high (0V input) or the divider R1/R7 (whose values are quite wrong btw) going high.If you want a solution, I think this will work:Leave R5, Q2 as is.Replace R4 with a 4k7/1k or similar divider connected to the input.Connect Q4 base to the output of said divider.Remove everything else.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: April 01, 2021, 06:25:21 pm
content: Some suggestions:With 0V input, you want 0V at the output -> Use a pull down resistor for the output.With 2V5 at the input you want 5V at the output:Use a resistor divider (From 2V5 to 600mV) and an NPN transistor, then an PNP transistor to pull the output high.With 5V at the input, you want 0V at the output:Use a resistor divider (From 5V to 600mV) and an NPN transistor, and then short the base of the other NPN transistor to GND.This should work because the Collector-Emitter voltage of a saturated transistor is lower than the base voltage needed to open the other NPN transistor.

author: magic
author_rank: Super Contributor
timestamp: April 01, 2021, 06:56:22 pm
content: Yeah, it will. And another suggestion: turn that circuit upside down and ditch the inverter transistorBTW, whatever you choose to build, mind that Vbe of a transistor decreases 2mV/°C. This has particularly bad consequences when the transistor is fed from a divider.

author: fcb
author_rank: Super Contributor
timestamp: April 01, 2021, 07:00:00 pm
content: You haven't specified how tight around the 2.5V you want the action, so I've assumed 2.5V +/-0.5V.Here's a simpler (3 transistor) design. Assuming this is an academic exercise as 1K seems quite low - if it's for an actual design then probably increase the resistor values x10.

author: magic
author_rank: Super Contributor
timestamp: April 01, 2021, 07:20:18 pm
content: See what happens to your carefully crafted thresholds over temperatureFor a sufficiently wide range it's barely possible to make it work within any tolerance at all.

author: mikerj
author_rank: Super Contributor
timestamp: April 01, 2021, 10:58:38 pm
content: Quote from: Vindhyachal.takniki on April 01, 2021, 08:47:34 amBuy LM393 dual comparator for little more than the cost of transistors and end up with something that actually works.

author: Vindhyachal.takniki
author_rank: Frequent Contributor
timestamp: April 02, 2021, 07:38:03 am
content: I tried simulating in multisim and its working.Next is to add one more input and get output like this:I tried simulating by : Inverter+NOR+AND gate (5 transistors) and its working. Is there any way we can reduce number of transistors or use some digital gate IC/comparator for ease of operation and keeping low component count also.

author: magic
author_rank: Super Contributor
timestamp: April 02, 2021, 09:03:59 am
content: This is what perfection looks like(Okay, not sure if it will work equally well in the real world. But I did simulate sensitivity to resistor mismatch at least - it seems to tolerate 5% pretty well.)Quote from: Vindhyachal.takniki on April 02, 2021, 07:38:03 amIf a reliable 5V supply is available, then all you need is LM393 and five resistors.If not, the Doctorandus_P circuit can be made to work at reasonable temperature ranges. And the thing that I posted here is an improved version for unreasonable temperatures, replacing the NPNs with compensated bandgap references. Something similar could likely be whacked together with a pair of TLV431 or similar ICs plus a PNP.

author: Zero999
author_rank: Super Contributor
timestamp: April 02, 2021, 09:21:20 am
content: Quote from: Vindhyachal.takniki on April 02, 2021, 07:38:03 amWhy not use a window comparator circuit, as mentioned above?Here are some links. Just use the LM393, rather than the more expensive, surface mount only, TLV1702.https://www.ti.com/lit/ug/tidub01/tidub01.pdfhttps://www.electronics-tutorials.ws/opamp/op-amp-comparator.html

author: Ian.M
author_rank: Super Contributor
timestamp: April 02, 2021, 11:51:37 am
content: It is *possible* to build the O.P's gated window comparator purely with jellybean NPN BJTs and resistors, without compromising on the window thresholds, with enough hysteresis to prevent indeterminate behavior and with reasonable temperature stability, but it certainly wont be cheap (or low power).Here is a LTspice sim of one possible solution, utilizing long-tailed pair discrete comparators with current mirror tails and hysteresis, and multi-transistor RTL logic to combine the comparator outputs, with a push-pull output stage. As the O.P. didn't specify the acceptable range for the window, I am assuming that thresholds near 1.25V and 3.75V would be acceptable.I've included a .plt file (rename it without the .txt) to show the output with respect to the two input voltages as they are swept over the range 0V to 5V, to show the hysteresis ranges.However you'd be crazy to build this instead of the various IC comparator versions that have been proposed.

author: nali
author_rank: Frequent Contributor
timestamp: April 02, 2021, 12:27:35 pm
content: I'm wondering if this is a homework assignment, and the objective is to think more about properly defining the problem before coming up with a solution. E.g. what are the parameters for the 2.5V 5V 0V states.If for example you could say that anything that is within a PN junction's worth of 5V & 0V represents "true" for their respective states, and rather than say "2.5V" say that anything between the above values represents "true" for a 3rd state then you can simplify things with minimal use of BJTs and a bit of diode logic.

author: Terry Bites
author_rank: Super Contributor
timestamp: April 02, 2021, 03:28:08 pm
content: seehttps://www.pcbway.com/blog/Engineering_Technical/Battery_Monitor_Circuits.html

author: nali
author_rank: Frequent Contributor
timestamp: April 02, 2021, 06:43:06 pm
content: Quote from: Terry Bites on April 02, 2021, 03:28:08 pmI can't see how that circuit would work. The cold end of R3 will sit at the Vf of the red LED, and as green & yellow LEDs typically require a higher Vf than red (plus the Vce of T1/T2) they would never light.

author: Vindhyachal.takniki
author_rank: Frequent Contributor
timestamp: April 03, 2021, 10:14:49 am
content: @sghioto suggested this circuit and in simulation in mutisim its working. But issue is Vcmr of LM393 is 0V to (Vupply-2.0V). How to accommodate that?Edit: Max Vcc in system is +5V only.

author: ledtester
author_rank: Super Contributor
timestamp: April 03, 2021, 10:30:34 am
content: QuoteUse voltage dividers to bring the inputs into the common mode range. You'll also, of course, have to adjust your reference voltages.

author: camila
author_rank: Contributor
timestamp: April 03, 2021, 11:19:01 am
content: Must have tried with the diode combinations