Using transistor output as a logic input

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.

• Can you give a truth table of how you want it to behave. Nov 4, 2017 at 11:04
• As a regular XOR gate but it's inputs are transistors instead of batteries or switches. Nov 4, 2017 at 11:07
• Where does the e-c current for the transistor come from?
– RoyC
Nov 4, 2017 at 11:07
• 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. Nov 4, 2017 at 11:29
• 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) Nov 4, 2017 at 11:45

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.

• 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 ? Nov 4, 2017 at 11:21
• See the update. Nov 4, 2017 at 11:30
• I forgot the pull-down resistor on the input. R4 added to Figure 2. Nov 4, 2017 at 12:08