3
\$\begingroup\$

I am trying to build a simple AND gate using 2 2N2222 transistors and the +5V source from an Arduino board. At first I tried the circuit without the R1 and R2 resistors but the output was 1 when B was 1 (second input) and 0 otherwise, regardless of A. After adding R1 and R2, if only B is 1 and A is 0 then the LED is dimly lit and if both inputs are 1 then the LED is brightly lit. Can I make it such that only when both inputs are true the LED is lit and off otherwise?

AND gate circuit with two 1k resistors added

I also measured the current between R2 and Q2 and I'm not quite sure how to interpret the readings or what they mean. With the ampmeter on the scale 2m, with A = 1 the display reads .406 (which I presume means 0.4 mA?) and with the scale 20m, with A = 0, the display reads 2.23 (2.23 mA?) and with A = 1 the display reads 0.43 (which means 0.43 mA?). Am I reading the values correctly off the ampmeter and why does the current through B change if A is connected orn ot?

\$\endgroup\$
  • 1
    \$\begingroup\$ which input is A and which is B on your diagram? \$\endgroup\$ – Icy Dec 11 '15 at 9:54
  • \$\begingroup\$ The one connected to R1 is A, and the one connected to R2 is B \$\endgroup\$ – andreas.vitikan Dec 11 '15 at 9:58
  • 1
    \$\begingroup\$ Put the LED and resitor to 5V to colector, emitor goes to ground. Add resitor from base to ground or when level is LO ground the input, don't let it floating. \$\endgroup\$ – Marko Buršič Dec 11 '15 at 10:00
  • \$\begingroup\$ Marko has it. Note that if B=1 you have a direct path for Q2 base current through the LED. An alternative answer is to reduce both base currents (R1,R2=10kilohms). \$\endgroup\$ – Brian Drummond Dec 11 '15 at 11:17
3
\$\begingroup\$

Your basic circuit is a shot in the right direction BUT it would only work properly if you would use NMOS transistors insteat of bipolar ones.

The problem with NPNs here is that if Q1 is off but you're switching Q2 on, Q2 will behave as a diode pulling the voltage across R3 and D1 up. So D1 starts to light up (a bit). When you also switch on Q1 then more current can flow and Q2 will operate in saturation, the LED will light up more.

If you can, try using NMOSFETs, two 2n7000 would to the trick I guess.

It can also be done with NPNs but then you would need to build a NAND first and then invert it's output OR (even simpler) connect the LED in series with R2 in the schematic from this tutorial.

enter image description here

Place LED in series with R2: Done :-)

\$\endgroup\$
  • \$\begingroup\$ How would I go about wiring the scheme you provided on a breadboard? I am having difficulty figuring out how to wire the junction between R2, OUT and T1. Are T1 and OUT branches coming out of the node? And since OUT in my case is a LED, I should wire the negative pole of the LED to the same ground that T2 goes into? \$\endgroup\$ – andreas.vitikan Dec 12 '15 at 13:41
  • \$\begingroup\$ The LED must be placed in series with the transistors, i.e, from OUT to GND. \$\endgroup\$ – Martin Zabel Dec 12 '15 at 16:38
  • \$\begingroup\$ Note how this schematic is very similar to your original one ! From your schematic, remove R3 (180 ohms) and the LED. And replace that with a wire so the emitter of Q2 (T2 in my schematic) is ground. Now instead of R2 in my schematic connect the 180 ohm resistor and the LED in series. Just ignore that it says "OUT". Also ignore Martin's comment btw. \$\endgroup\$ – Bimpelrekkie Dec 12 '15 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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