I'm trying to use the output of the following transistor circuit as an input for XOR gate. It doesn't seem to work, I'm out of ideas. Any help would be appreciated.

enter image description here

  • \$\begingroup\$ Can you give a truth table of how you want it to behave. \$\endgroup\$
    – winny
    Nov 4, 2017 at 11:04
  • \$\begingroup\$ As a regular XOR gate but it's inputs are transistors instead of batteries or switches. \$\endgroup\$ Nov 4, 2017 at 11:07
  • \$\begingroup\$ Where does the e-c current for the transistor come from? \$\endgroup\$
    – RoyC
    Nov 4, 2017 at 11:07
  • \$\begingroup\$ What I'm trying to do is making water level indicator by using logic gates and transistors (XOR gates). Using transistor to sense the level of water by having its base terminal submerged in water alone with the positive terminal of Vcc and when water reaches the desired level the transistor becomes on and make the gate's input high and using gate's output to light an LED. I plan using 3 levels and using XOR gates to do the math and light the correct LED. \$\endgroup\$ Nov 4, 2017 at 11:29
  • \$\begingroup\$ The question fails to define the analog input spec for detection ( dielectric or leakage of water? ) leakage is a poor method for water and the proposed use of Q is a poor solution for water detection. Further the use of an XOR gate has properties with no given expectations or requirements. It can be an invertor or not. You need to define the truth table to define your design. This is mainly an anlog to digital conversion with comparators with suitable sensing. ( like capacitance or attenuation at some f) \$\endgroup\$ Nov 4, 2017 at 11:45

2 Answers 2


It would be interesting if you set up a pull-up resistor in the transistor collector, that would make your circuit work properly.

What happens in your circuit is that the transistor collector is floating, so you´ll have problems to work the XOR gate.

  • You have the lower input of your XOR gate tied to ground so it will never switch. (You probably are aware of this.)


simulate this circuit – Schematic created using CircuitLab

Figure 1. Correct application of the pull-up resistor.

  • Your notion of how to wire a pull-up resistor is incorrect. Figure 1 shows the correct method. When Q1 is off R1 pulls the input high. When Q1 is on it pulls the input low.
  • R1's value is unnecessarily low. 50 mA will flow when Q1 is on. 10k would be fine.
  • R3 is low too. Most logic chips won't supply more than a few mA.

Response to comment:

I want the circuit to work the other way, when transistor is on logic gate's input becomes high.


simulate this circuit

Figure 2. To eliminate the inversion caused by Q1 just eliminate it. R4 is required to pull the input low when the switch opens.

  • \$\begingroup\$ Thanks for the clarification. I want the circuit to work the other way, when transistor is on logic gate's input becomes high. Should i use inverter before the wire connecting the collector to the logic input to achieve that ? \$\endgroup\$ Nov 4, 2017 at 11:21
  • \$\begingroup\$ See the update. \$\endgroup\$
    – Transistor
    Nov 4, 2017 at 11:30
  • \$\begingroup\$ I forgot the pull-down resistor on the input. R4 added to Figure 2. \$\endgroup\$
    – Transistor
    Nov 4, 2017 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.