AND Gate not working correctly

Thread Starter

Octain

Joined Feb 12, 2019
20
I am new to electronics so I don´t have much knowledge yet. I tried to make an AND Gate with control LEDs behind the Input. When simulating, everything worked but in reality with my plug circuit board the green LED was lighting when only the second switch was turned on since the electricity also flows from base to emitter if i am right. (On the circuit board i used a 10k Ohm resistor instead of 1k)AND_name.jpg

How do I have to change this in order that it´s working?
 

pmd34

Joined Feb 22, 2014
527
Hi Octain, you are right in that some of the current going into the base will go directly to the emitter of the second transistor, though it should only be a tiny current if you use a 10K resistor as you say. You could check to see if the brightness of the LED is the same as when the LED is lit up through a 10k directly.
However... have you checked the transistors are the correct way around, I see the order of the pins is reversed compared to your diagram:
http://www.interfacebus.com/semiconductor-transistor-packages-TO-92.html
 

AnalogKid

Joined Aug 1, 2013
11,056
Please post the schematic you started with. Neither switch is wired correctly for what you are trying to do. The wiring of both switches should be identical, and they are not.

Do you want the red LEDs to come on when the inputs are high or low?

ak
 

Thread Starter

Octain

Joined Feb 12, 2019
20
Thank y for your Answers. This is just a model of the real life project. I am sure i am using the transistors right. The red LEDS should be lighting when the switch is "on" (left position). When both red LEDs are on the green one should be too. In practice i had the problem that the tiny current was enough to make the green LED light a bit when the second switch was off. My question is how to block any current going to that green LED (e.g. with more NPNs or maybe with a PNP transistor).
 

dl324

Joined Mar 30, 2015
16,943
Welcome to AAC!

It's best to post schematics instead of wiring cartoons when discussing circuits. Circuit intent will be easier to discern.

What transistor are you using? Your drawing program is using the pin order for BC* transistors; which is backwards from 2N. There's yet a third pinout for Japanese transistors...
 

djsfantasi

Joined Apr 11, 2010
9,163
AnalogKid has made an important point. The circuitry surrounding each switch should be identical. One switch uses all three contacts. The other has only two connections.

Part of the circuitry has the input to the transistor floating.

Part of the circuitry is missing a current limiting resistor to the base of the transistor.

I have no idea what the second switch is doing.

Just two examples. I assume your “real life project” isn’t working. Which explains the errors in your pictures.
 

LesJones

Joined Jan 8, 2017
4,191
dl324,
I agree with your conversion of the picture into a schematic.
I think the left hand end of R6 should connect to the junction of R4 and LED2. Even then I think it is possible that with just SW2 closed the base emitter current through Q2 may light the green LED dimly. I think it would have been better to have the green LED in series with R1.

Les.
 

Thread Starter

Octain

Joined Feb 12, 2019
20
AnalogKid has made an important point. The circuitry surrounding each switch should be identical. One switch uses all three contacts. The other has only two connections.

Part of the circuitry has the input to the transistor floating.

Part of the circuitry is missing a current limiting resistor to the base of the transistor.

I have no idea what the second switch is doing.

Just two examples. I assume your “real life project” isn’t working. Which explains the errors in your pictures.

Oh yeah i made an transcription mistake. The Green circuit should be just as the yellow one!
 

Thread Starter

Octain

Joined Feb 12, 2019
20
This is the corrected circuit. How do i have to change it that it works like an AND gate without having current going from the second transitor base to emitter, thus lighting the green LED when only the second switch is on.


4730D6CB-8C16-4F24-AB7A-3C661399C94B.jpeg
 

dl324

Joined Mar 30, 2015
16,943
How do i have to change it that it works like an AND gate without having current going from the second transitor base to emitter, thus lighting the green LED when only the second switch is on.
That would be an OR gate, not an AND. When you have multiple components of the same type, you should assign component designators. For example Q1 and Q2; though some use T instead of Q. I was taught to use Q.

By having the green LED on the emitter of the bottom transistor, you add a complication to logic levels.
 

Thread Starter

Octain

Joined Feb 12, 2019
20
Yes at the moment it is an OR with the exception that it obviously doesnt work when only the first switch is turned on. Can you change this whole circuit that it is an AND?
 

dl324

Joined Mar 30, 2015
16,943
Yes at the moment it is an OR with the exception that it obviously doesnt work when only the first switch is turned on. Can you change this whole circuit that it is an AND?
With the two transistors in series, it's an AND function.

Here's a NOR gate that will do what I think you want:
upload_2019-2-12_14-29-26.png
Either switch connecting 9V to R2 or R3 would turn on Q1 or Q2, respectively, and turn on LED3.
 

Thread Starter

Octain

Joined Feb 12, 2019
20
Thank you for that but i am trying to create an AND Gate with transistors and the red leds that show wether input is 1 or 0 and the green one shows the output. Output should be 1 when both inputs are 1.
 

LesJones

Joined Jan 8, 2017
4,191
In the right hand side of the schematic in post #8 remove the green LED from between the emitter of Q2 and ground. Connect the emitter of Q2 directly to ground. Break the connection between the top of R1 and +9 volts. Connect the anode of the green LED to +9 volts. Connect the cathode of the green LED to the top of R1. If you can't read schematics (Which I suspect you can't as you have refused to post schematics when requested,) then from the picture in post #13 Unsolder the red and green wires in the bottom right hand corner and solder them together.
In the top right hand corner unsolder the horizontal red wire from the top of the 240 ohm resistor. Solder the cathode (The wire next to the flat on the LED.) of the green LED to the top of the 240 ohm resistor. Solder the red wire to the anode of the green LED. It should now work correctly.

Les.
 

Thread Starter

Octain

Joined Feb 12, 2019
20
In the right hand side of the schematic in post #8 remove the green LED from between the emitter of Q2 and ground. Connect the emitter of Q2 directly to ground. Break the connection between the top of R1 and +9 volts. Connect the anode of the green LED to +9 volts. Connect the cathode of the green LED to the top of R1. If you can't read schematics (Which I suspect you can't as you have refused to post schematics when requested,) then from the picture in post #13 Unsolder the red and green wires in the bottom right hand corner and solder them together.
In the top right hand corner unsolder the horizontal red wire from the top of the 240 ohm resistor. Solder the cathode (The wire next to the flat on the LED.) of the green LED to the top of the 240 ohm resistor. Solder the red wire to the anode of the green LED. It should now work correctly.

Les.
Thank you very much, i cant read schematics yet but ill try to learn it. I will try it tomorrow i hope it is going to work.
 

dl324

Joined Mar 30, 2015
16,943
Thank you very much, i cant read schematics yet but ill try to learn it. I will try it tomorrow i hope it is going to work.
This will do what I think you want, but it's not the right way to do it. A HIGH level output taken the green LED anode isn't really a HIGH (which would be closer to 9V).

upload_2019-2-12_14-59-16.png

A better way to do the gate would be to take the output from the collector.
 
Top