AND-gate - Page 1
Forum section: electronics / beginners

author: Fuldup
author_rank: Contributor
timestamp: March 05, 2024, 08:52:21 pm
content: Hi, i'was trying to simulate an AND-gate using transistors and online i found circuits like the one atteched, but when i recreate the circuit on circuitlab i get an output 7.5V (with a supply of 9V) when the right switch is closed and left switch is open. That doesn't make sense to me because the output of an AND-gate should be 1 only when the two switches are closed.If you want to take a look at my circuit here is the link to my circuitlab project or you can find a screenshot attached.https://www.circuitlab.com/circuit/vf93wu8xf5tb/gates/

author: Benta
author_rank: Super Contributor
timestamp: March 05, 2024, 09:08:27 pm
content: Where are the:base resistors?LED current limiting resistor?Simulators (and real circuits) are picky about that.

author: selcuk
author_rank: Frequent Contributor
timestamp: March 05, 2024, 09:24:05 pm
content: I suggest you to simulate CMOS NOT, NOR and NAND gates. They are simpler to understand. You may think them as digital switches. BJT transistors require proper biasing for a reliable simulation.

author: Fuldup
author_rank: Contributor
timestamp: March 05, 2024, 09:55:07 pm
content: I added the base resistor and the LED resistor but the output voltage is still to high

author: Bud
author_rank: Super Contributor
timestamp: March 05, 2024, 10:10:49 pm
content: You do Not leave the Base of a bipolar junction transistor floating. Try connecting another 10K resistors from the Base of each transistor to ground. The original schematic assumes the driving circuit pulls the Bases of the transistors Low when inactive. In your circuit nothing pulls the Bases to ground when the switches are open.

author: Fuldup
author_rank: Contributor
timestamp: March 06, 2024, 05:38:03 am
content: do you mean something like this?

author: selcuk
author_rank: Frequent Contributor
timestamp: March 06, 2024, 05:55:47 am
content: You may assume that the arrow on the transistor is a diode having a 0.7V forward voltage. So when the base is directly connected to 5V, the emitter on the right is in a high state. You can compare your circuit with the ones in here:https://breadboardcircuits.com/bjt-logic-gates/

author: Fuldup
author_rank: Contributor
timestamp: March 06, 2024, 05:44:51 pm
content: selcuk I understand what you mean but how can i solve this problem, what should i do to make the and-gate work like it should

author: cosmicray
author_rank: Frequent Contributor
timestamp: March 06, 2024, 06:47:13 pm
content: Quote from: selcuk on March 05, 2024, 09:24:05 pmDigital transistors are available now. They are a BJT with built in bias resistors, and available in a variety of configurations.ONSemi app notehttps://www.onsemi.com/pub/Collateral/AND9129-D.PDFRohm Semi app notehttps://www.rohm.com/products/faq-search/faqId/234LCSC categoryhttps://www.lcsc.com/products/Digital-Transistors_562.html(many are between 1-3 cents each)

author: Zero999
author_rank: Super Contributor
timestamp: March 06, 2024, 07:02:22 pm
content: Quote from: Benta on March 05, 2024, 09:08:27 pmNote that in this instance, base resistors are not required to protect the transistor. It's to reduce the voltage on the emitter resistor from the input voltage, when the upper transistor is off.Quote from: Fuldup on March 05, 2024, 08:52:21 pmIt's not a very good circuit. The output voltage is always a couple of diode drops below the input. Add another PNP transistor to the output to get a proper AND gate.The circuit has been discussed in great detail in the following thread:https://www.eevblog.com/forum/projects/why-does-this-two-transistor-and-gate-not-work-as-expected/

author: Fuldup
author_rank: Contributor
timestamp: March 06, 2024, 07:21:24 pm
content: hi, thank you very much the circuit you sent me works very good. i'm going to take a look at the link you sent and i will try to minimize the voltage drop

author: Zero999
author_rank: Super Contributor
timestamp: March 06, 2024, 07:55:48 pm
content: I strongly recommend the CD4007 or better the HEF4007 for learning about logic gates. It contains four MOSFETs, plus two connected as an inverter, NOT gate. It can be used to make a variety of logic gates: NAND, NOR, OR and other circuits: astable, monostable, bistable, analogue switch, voltage controlled oscillator. . .https://wiki.analog.com/university/courses/electronics/electronics-lab-28https://www.ti.com/lit/ds/symlink/cd4007ub.pdfhttps://assets.nexperia.com/documents/data-sheet/HEF4007UB.pdf

author: tooki
author_rank: Super Contributor
timestamp: March 08, 2024, 03:23:06 pm
content: Quote from: cosmicray on March 06, 2024, 06:47:13 pmThey’ve been available for decades. I know I’ve seen them in 1980s Japanese hi-fi gear.

author: kevin.gibbs
author_rank: Regular Contributor
timestamp: April 08, 2024, 01:45:18 pm
content: R2 and R5 do not need to be grounded. It is sufficient to connect them to the emitters of the corresponding transistors. R3 is not required. And resistors in the bases (in series with the switches) never appeared.Also, in your case, it is better to move D1 and R1 to the top of the circuit, to the + power supply.