Electrical – AND Gate Stays Open

breadboardlogic-gates

I have a very simple circuit on a breadboard with two push-button switches, an AND gate (74LS08), and an LED. I have the two switches hooked up to pins 1 and 2, while the LED goes from 3 to ground. Pin 14 is given 5 volts, while pin 7 goes to ground.

I'm just trying to test to see if the AND gate works and so far it seems as though it doesn't. As soon as I plug in 5 volts to pin 14, I get current through all the output pins, 3, 6, 10, and 13, regardless of what's going on with their respective input pins, even if pin 7 isn't grounded.

enter image description here

Obviously, the LED should only turn on when both switches are switched on, but once 5 volts is supplied to pin 14, it doesn't matter what I do to the buttons. I've tried a couple of the same AND gates from the pack, as well as some OR gates, and they all do it.

Best Answer

It would help if you had added a schematic, but from what I can see, you are missing one vital component. A pull-down resistor. What this does, is it makes sure that the inputs are at 0V when there is no voltage present at the input. Once the button is pressed, you will get your 5V and when both buttons are pressed, you get 5V at both inputs.

As it is right now, your inputs are 'floating' which means they are in a state that is unknown, which the IC could determine as a '1' state, which is why your LED is always on. This will also be why the same is true for all outputs. With these ICs, you should always tie unused inputs to GND via a pull-down resistor.

schematic

simulate this circuit – Schematic created using CircuitLab

Look at the above schematic. The top one is how I see your configuration at the moment (please correct me if I am wrong). When there is no voltage applied to the input, it is left with a floating voltage and may not be at 0V.

The bottom one is how it should be. Some pull-down resistors will ensure that when there is no voltage present at the input, they will stay at 0V.

Add these resistors and you should see your problem go away.

Related Topic