Hi guys
I've been playing around with some discrete transistor logic gate circuits. However the AND gate circuit (this is a very common design found all over the internet) does not work as expected and I can't figure out why so I am hoping someone can help restore my sanity because I am pretty sure I do understand bipolar transistors, but I don't understand what is happening here
The circuit is in the attachment - see Fig A (Q1 and Q2 are BC337)
So supposedly this is an AND circuit, the LED should light, and I should get a logic 1 output at Y when both A and B are high (5V)
What actually happens is this. When A and B are low (just not connected to anything) then the LED is out and voltage at Y is 0V
For the other logic states (all measured with DMM) and using patch wires to connect A and/or B to 5V
A=5V B=0V LED Y=0V (LED is off)
A=0V B=5V Y= 2.5V (LED lights half brightness)
A=5V B=5V Y= approx 4.6V (LED is on bright)
In the condition A=0V, B=0V I can measure the voltages
Q1 Collector is 5.1V, Base is 0V, Emitter is 2.5V
Q2 Collector is 2.5V, Base is 0V, Emitter is 0V
In the conditions A=0V B=5V
Q1 Collector is 5.1V, Base is 0V, Emitter is 2.5V
Q2 Collector is 2.5V, Base is 0.75V, Emitter is 2.3V LED is on
So somehow Q1 turns on even when the base is 0V
Ahhh so I know what may say, the base connections are floating, even though my meter says they are 0V but let's make sure they are not floating - see Fig 2 (ignore the dashed line ad 390R resistor for now)
And guess what? Adding the 10K from base to ground makes no difference
So I remove Q1 and test it in my DCA55 - it is fine. But I replace it with a new one anyway - no difference
Then I think it may be something stupid with the veroboard (tracks not cut properly) but I can't find any problem there
But not to be deterred, I then built the same circuit again on another patch of the veroboard using new components and this time I used S8050 transistors. Guess what? No difference.
So I then tried adding a resistor (the one in dotted lines on Fig 2) and the brightness of the LEd reduces when A is low and B is high. Once I get down to 390R, the LED no longer lights apart from when both A and B are High (5V) when the logical AND is true and it lights brightly.
But really the logic gate still isn't actually working.
When A is 0V and B is 5V the output at Y should be below a logic 0 threshold (<0.8V seems acceptable for 5V logic) but it isn't
What I have is
A=0V B=0V Y=0V
A=0V B=5V Y=1.2V (indeterminate logic level)
A=5V B=0V Y=0V
A=5V B=5V Y=4.6V (acceptable logic 1)
Using ohms law this actually tells me that the current 'leaking' through Q1 when base = 0V and it is supposed to be turned off is 1.2/390 = 3mA and this ties in perfectly with the half lit LED
I'm gonna try the same thing tomorrow using a couple of N channel Mosfets so I can see what that does, out of interest
In the mean time can someone please explain 1 - why the circuit does not work as expected and 2 - how to actually make an AND gate out of two transistors that actually works?
Thanks
Rich