1
\$\begingroup\$

Preface: Def a beginner at EEing.

I'm building out a proof of concept where I'm using transistors to create a logical AND gate to control LEDs. I'm using reed switches to trigger the transistors and putting the transistors' collectors/emitters in series so that both transistors have to be triggered for the final LED to light up.

Here's the schematic that made to work out the logic:

schematic

And here's the wired up bread board:

wiring

And this works ... mostly.

When I trigger the first reed switch it lights up the first yellow LED only. Good.

first switch

When I trigger both reed switches the two yellow LEDs come on AND the red LED comes on. Good!

both switches

But here's where the bad comes in: if I activate only the second reed switch, the one that leads directly to the red LED there's enough current passing through to faintly light up the red LED. Bad :'(

second switch, current passing through

I'm not sure how to stop the current from the second transistor to the final LED. I'm assuming that it's the current from the gate pin on the second transistor passing through to the red LED, but I'm not sure how to stop it.

I tried adding a pull down resistor on the red LED's anode leg and that does help, but of course the red LED dims since the current has a different option to flow in.

Is there a way to keep the red LED off until both transistors are triggered?

I def want this to work, but I also want to understand why it's happening.

UPDATE

Here's the updated schematic and working circuit based on the replies I got here. Thanks again everyone for the help. It's very cool to see it working and to get it!

working circuit

Second led working!!

https://vimeo.com/394545735

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Try putting LED3 and R1 into the left vertical leg of the circuit so that both NPNs have to be on to make the cathode connection. I would also say your battery is drawn with the + & - ends swapped (longer bar = +, shorter bar = -). \$\endgroup\$
    – CrossRoads
    Commented Feb 28, 2020 at 18:02
  • \$\begingroup\$ In BJT the base-emitter junction behaves just like a diode. And this is why the current will flow when you activate a second reed switch. To fix this try to move dioda and the resitor into T1 collector. \$\endgroup\$
    – G36
    Commented Feb 28, 2020 at 18:06
  • \$\begingroup\$ what is first reed switch and first yellow LED? ... the components have labels, please use them in your description \$\endgroup\$
    – jsotola
    Commented Feb 28, 2020 at 18:14

3 Answers 3

2
\$\begingroup\$

Your analysis of the problem is correct. You have chosen a poor AND gate circuit - but one that is promoted in many tutorial sites.

A couple of comments on your schematic:

  • The battery is connected backwards.
  • The convention is to have the positive rail at the top, ground at the bottom.
  • Circuit should generally read from left to right with current flowing generally from top to bottom.

Your circuit would be close to correct if you rotate it 90° clockwise.

enter image description here

Figure 1. An AND gate made of a NAND gate followed by an inverter. Source: Circuits Today.

Why is this better?

  • Switching on X or Y on their own will not allow current to pass from R3 to ground. Q3 will be biased on and Z will be 0 V.
  • When both X and Y are on the collector of Q1 will be pulled low. This is a NAND operation.
  • When Q1's collector is pulled low Q3 will turn off and Z will be pulled high by R4. Q3 is forming a NOT gate (an inverter) and a NAND followed by a NOT is an AND.

You will see a similar arrangement in some logic series.

enter image description here

Figure 2. A CMOS AND gate. Source: All About Circuits.

Notice that the AND gate is more complex than a NAND gate and there will be some propagation delay due to the inverting stage. The linked article should be worth a read.


A few comments on your updated schematic:

You've got the top to bottom right now but your schematic is reading right to left. Here's a flipped version (but I didn't flip the text). Some of the points you had addressed already but I'll comment on them anyway.

enter image description here

Figure 3. Rough schematic edits.

As explained, convention is that current flows from top to bottom so positive rail on top. For reading left to right we generally put the inputs on the left and the outputs on the right.

  1. Battery right way up.
  2. +V on top.
  3. Since you've got grounds on R4 and R5 you need to indicate what these are connected to. Here we add the GND symbol to the negative rail. All the grounds are now connected.
  4. We'll draw the LED and resistor vertically. Now it's clear that current will flow through it from top to bottom. You don't have to be too strict about this but in this case the clarity gained is worth the little bit of extra height on the schematic. In this case LED3 is the output of the circuit so it makes sense to locate it on the far right of the circuit.
  5. Transistors right way up. For these NPN transistors the emitter arrow shows the current direction and so we have them pointing down towards GND.
  6. Same as 5.
  7. Input switch on the left.
  8. Vertical LED is good. Vertical LED would be nice too but would add to height. Current flow is quite obvious in this case.
  9. The GND symbol represents a cut section of the ground rail which is normally drawn horizontal. For this reason the symbol should be inserted as an upside-down T. The other 'earth' symbol (see Ground, earth and chassis explained written by me) represents parallel plates buried in the ground so there is a correct orientation for it too.
\$\endgroup\$
4
  • \$\begingroup\$ Awesome! That makes a lot of sense. Thanks for the explanation of the issue, general diagram construction, and the references for reading more. I appreciate you taking the time to explain! \$\endgroup\$ Commented Feb 28, 2020 at 19:05
  • \$\begingroup\$ Thank you for accepting my answer. I've added in a line, "Q3 is forming a NOT gate (an inverter) and a NAND followed by a NOT is an AND." This may further clarify the reasoning. \$\endgroup\$
    – Transistor
    Commented Feb 28, 2020 at 19:56
  • 1
    \$\begingroup\$ Since you enjoyed the comments on the schematic I've added some more ... \$\endgroup\$
    – Transistor
    Commented Feb 29, 2020 at 11:04
  • \$\begingroup\$ Nice! Thanks for the added details. I've never drawn schnucks for anyone but myself and I'm learning on my own so like details like this help a lot! \$\endgroup\$ Commented Feb 29, 2020 at 12:38
1
\$\begingroup\$

You are correct in your analysis of what's happening. Fortunately, the fix is easy. Change your output circuit to

schematic

simulate this circuit – Schematic created using CircuitLab

Now the lower transistor's base current will pass harmlessly to ground and not through the LED.

A couple of things to remember:

1) As Transistor says, you've got the battery polarity wrong in your schematic, although obviously not in your circuit. This is just one of those historical artifacts you need to learn.

2) Transistors are not labelled "T1" or anything like that. By the time transistors came along, the "T" prefix was already taken by transformers. Use "Q" instead.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks for the explanation and redrawing the diagram. Between your and everyone else's replies I feel like I am able to not only fix the circuit but also have a better understanding of how to draw and arrange future ones. I appreciate the help! \$\endgroup\$ Commented Feb 28, 2020 at 19:07
0
\$\begingroup\$

Add a resistor across the red LED. Maybe 1K depending on Vb.

But it would be better to move the red LED and series resistor to the collector of T1, ground the emitter of T1.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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