Why does the right-hand button increase the LED brightness in this NAND gate?

Thread Starter

Nessus

Joined Feb 24, 2018
9
Hi All,

This isn't a homework question, I'm a software engineer starting to teach myself about circuits but I figured this would be the most suitable place to post given my serious lack of knowledge.

I created a NAND gate which I've pasted below. When I activate the right-hand button the led brightness increases. Activating both turns off the LED as expected and activating the left button doesn't alter the LED brightness. In case it's hard to make out the +5v goes to the collector of the top transistor and the emitter of this transistor feeds into the collector of the second transistor whose emitter is in turn connected to ground.

I understand that resistors in parallel reduces the effective resistance in a circuit but I don't see how the circuit is being activated in this case when the right button is being pressed. If the emitter of the top transistor were attached to ground it would make sense to me, however with the emitter going to the collector of an un-activated transistor I don't see how the circuit for the right button would create any potential difference to supply additional voltage to the LED as the trace would go +5v -> resistor -> button -> transistor base -> transistor emitter -> transistor collector -> stop. I've measured across the led and there's an additional .1v - .2v when the right button is pressed

IMG_20180224_172349801.jpg
 

ebp

Joined Feb 8, 2018
2,332
Please post a schematic. A photo of a sketch on paper is fine as long as it is right-way-up and we can read it.
 

MrChips

Joined Oct 2, 2009
21,853
You have a number of problems.

1) Where is the LED connected? Where is the anode and where is the cathode (the flat side of the LED)?
2) Are the buss rails connected all the way through or are there breaks in the middle of the board? It would appear that the black wires are not actually connected to the -VE supply.
3) You really need to post a circuit schematic to show what you think is the electrical diagram.
 

Thread Starter

Nessus

Joined Feb 24, 2018
9
I've made an attempt at a schematic using fritzing, the S1 button in the schematic is the one that causes the power spike I believe ( also I probably made a mistake in the schematic somewhere )
nand fritz.PNG

1) The led has the negative leg in the ground rail and the positive side in J28 so between resistor and collector on 5v rail
2) The ground rails are interconnected as is the power rail at the top of the picture
 

Thread Starter

Nessus

Joined Feb 24, 2018
9
Sorry my mistake they should both be NPN. Re-done schematic below ( I'm really mucking this post up, sorry about that and thanks for sticking with me this far )

nand fritz.PNG
 

dl324

Joined Mar 30, 2015
11,507
The schematic must still be wrong. With the LED anode connected to ground, a negative voltage would be required on the cathode to turn it on.
 

ebp

Joined Feb 8, 2018
2,332
The LED must be reversed.

When either transistor is off (base is open circuit, interpreted here as LOW), current flows through R3 and the LED to ground.
When both transistors have their bases connected HIGH (to +5 V) there will be a current path to pull the anode of the LED to near ground, turning it OFF.

The resistors to be bases could be higher (e.g. 4.7 k) but nothing will be damaged as-is.
 

Thread Starter

Nessus

Joined Feb 24, 2018
9
looking at the BB it seems like the LED is connected directly to the positive rail and the resistor is in parallel with the LED?
The LED is connected directly to ground, it's connected to positive rail through the resistor at B28 (next to 2 orange jumpers)

The schematic must still be wrong. With the LED anode connected to ground, a negative voltage would be required on the cathode to turn it on.
Sorry another goof, I've reversed the LED in the schematic below

The LED must be reversed.

When either transistor is off (base is open circuit, interpreted here as LOW), current flows through R3 and the LED to ground.
When both transistors have their bases connected HIGH (to +5 V) there will be a current path to pull the anode of the LED to near ground, turning it OFF.

The resistors to be bases could be higher (e.g. 4.7 k) but nothing will be damaged as-is.
Thanks, the circuit does work as I said but could you explain how more current flowing through the LED when only S1 ( right button in breadboard shot) is being pressed?
 

Attachments

ebp

Joined Feb 8, 2018
2,332
This is something of a peculiar way to make a NAND gate, but it isn't "wrong."

This is essentially "resistor-transistor logic" (RTL). The "natural" gate function with RTL is a NOR gate - the two transistors are connected in parallel and if either is on the output is low. NAND gates are made in a more elaborate way so there is only one transistor from output to ground. RTL has been obsolete as an integrated circuit logic family for some decades.

Don't forget DeMorgan's theorem (not because you need it here - just don't forget it)
 

ebp

Joined Feb 8, 2018
2,332
When only S1 is pressed, the base-emitter junction of Q1 acts as a diode (base is anode, collector cathode).
Current flows into the base via the switch and R2 and out the collector. This adds a current path in parallel with R3, increasing the current through the LED.
[edit - should have included this:] When Q2 is turned on, Q1 is allowed to act as a transistor because there is a path for emitter current and now current flows into the collector instead of out of it.

I'm referring here to "conventional current" which is considered to flow from positive to negative.
 

ElectricSpidey

Joined Dec 2, 2017
1,235
To prevent this problem run the LED at a higher current (brighter).

And increase the base resistance.

On second thought...just increase the base resistance.
 

eetech00

Joined Jun 8, 2013
1,989
The LED is connected directly to ground, it's connected to positive rail through the resistor at B28 (next to 2 orange jumpers)


Sorry another goof, I've reversed the LED in the schematic below



Thanks, the circuit does work as I said but could you explain how more current flowing through the LED when only S1 ( right button in breadboard shot) is being pressed?
Hi

You should add a resistor (22k ohm) from each transistor base to ground to ensure each transistor turns off completely when +V is removed from the base.
 

Thread Starter

Nessus

Joined Feb 24, 2018
9
(Edit, sorry eetech and electricspidey, didn't see your responses when I was writing this )

Ah ok it's clicked now, so since it's an NPN diode and the N at emitter is blocked it acts as a PN diode, base is p-doped and collector is N-doped.

So in order to prevent this behaviour I could ... have another diode on the collector line with opposite bias I suppose? Would there be a more elegant way of achieving this ( while sticking with my peculiar way of building the NAND, I'm trying to build up my intuition and this is what it decided to build :D )

(Edit - ok so I guess the pull-down resistors on the base lines are a better way to deal with this? )
 

eetech00

Joined Jun 8, 2013
1,989
(Edit, sorry eetech and electricspidey, didn't see your responses when I was writing this )

Ah ok it's clicked now, so since it's an NPN diode and the N at emitter is blocked it acts as a PN diode, base is p-doped and collector is N-doped.

So in order to prevent this behaviour I could ... have another diode on the collector line with opposite bias I suppose? Would there be a more elegant way of achieving this ( while sticking with my peculiar way of building the NAND, I'm trying to build up my intuition and this is what it decided to build :D )

(Edit - ok so I guess the pull-down resistors on the base lines are a better way to deal with this? )
If you don't pull down the base, the base will be "floating...(not high or low when +V is removed)", which is a bad thing for a logic circuit.:cool:
The transistor won't be in a "known" state.

eT
 
Top