# Issue in basic transistor circuit

#### Vindhyachal Takniki

Joined Nov 3, 2014
579
I have three input levels: 0V, 2.5V & 5V.
Output I need is:
A). 5V or 0V input, then output 0V
B). 2.5V input, then output is 5V

Need 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

#### BobTPH

Joined Jun 5, 2013
2,989
Think of it as a nand gate with an inverter on one input. 3 transistors.

Bob

#### sghioto

Joined Dec 31, 2017
2,264
Can someone suggest correct method with lowest transistor count
I don't think you can reduce the count, here's my circuit suggestion:

Last edited:

#### BobTPH

Joined Jun 5, 2013
2,989

#### BobTPH

Joined Jun 5, 2013
2,989
It is actually a nor gate + inverter. I get confused with too many nots.

Bob

#### Vindhyachal Takniki

Joined Nov 3, 2014
579
@BobTPH thanks 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.

 Input1 Input2 Output 0V 0V 0V 2.5V 0V 0V 5V 0V 0V 0V 5V 0V 2.5V 5V 5V 5V 5V 0V

#### BobTPH

Joined Jun 5, 2013
2,989
If you can use digital logic, it is trivial. Just make sure you use inputs that are well defined at 2.5V. Not sure what logic family will do that.

Bob

#### sghioto

Joined Dec 31, 2017
2,264
IC/comparator for ease of operation and keeping low component count also.
OK forget the transistors. I'll try this again with this proposal.

#### peterdeco

Joined Oct 8, 2019
327

#### sghioto

Joined Dec 31, 2017
2,264
Hey that's cheating.

#### Vindhyachal Takniki

Joined Nov 3, 2014
579
@sghioto thanks for circuit. But issue with LM393 is that it has Vcmr = 0V to (Vsupply - 2.0V)
So I dont think we can apply these voltages at inout pins of comparator?

Edit: Max Vcc in system is +5V only.

Last edited:

#### sghioto

Joined Dec 31, 2017
2,264
Read note 4 associated with those specs.

#### Vindhyachal Takniki

Joined Nov 3, 2014
579

yes, point (4) says each input can go above supply, but for linear operation we need to keep in CMR range no?

#### sghioto

Joined Dec 31, 2017
2,264
Not really. The outputs are either on or off assuming the input voltages you specified are correct.
I didn't just post the circuit I tested it as well.

#### BobaMosfet

Joined Jul 1, 2009
1,501
I have three input levels: 0V, 2.5V & 5V.
Output I need is:
A). 5V or 0V input, then output 0V
B). 2.5V input, then output is 5V

Need 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

View attachment 234179
Is this homework?

#### BobTPH

Joined Jun 5, 2013
2,989
The way you described the circuit, of couse it cannot work in the real world. The input voltages will never be exactly 0, 2.5, or 5V. You have not defined what happens if they are not those exact voltages.

A specification that can work would have to supply ranges for each of the voltages, and would have to include regions where the output is undefined.

Bob

#### peterdeco

Joined Oct 8, 2019
327
Agreed Bob. In the case of the PIC, a byte variable of 256 steps for the ADC reading comes out to about .02V/step. So to check for 2.5V very closely, it would yield an ADC reading of about 128. I would code it to look for a reading between about 100 and 140 to compensate for changes in supply voltage and component tolerances.

#### sghioto

Joined Dec 31, 2017
2,264
@@sghioto yes when i simulated in multisim its working.
I didn't simulated it was tested on my breadboard and it works fine.
If it bothers you go back to transistors.