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.

  • 12
    It's amazing how robust semiconductors have become, withstanding the total absence of current limitation without any apparent trouble. – Dmitry Grigoryev Nov 12 at 12:49
up vote 19 down vote accepted

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.


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.

  • 1
    Yes, you are correct with your first diagram. I added 100k resistors between ground and pins 1 and 2. This works but a new problem has presented itself. There is some confusing behavior from the switches. I press switch 1 and the light turns on and stays on, but it should not turn on until switch two is also on. Then I turn switch one off and back on again, but this time it just flickers on and then off again. Switch 2 presents the same strange behavior. – user2303321 Nov 12 at 11:31
  • 6
    I see you also don't have a current limiting resistor on the output of your gate. You should have something like a 270 or 330 ohm resistor in series with the LED, to limit the current. Try that, then edit your question with an update photo and draw a schematic too, that may help – MCG Nov 12 at 11:37
  • 1
    You might consider using a smaller pull-down resistance as well, perhaps 10k, though I don't see why 100k shouldn't work. – DerStrom8 Nov 12 at 12:08
  • 14
    @DerStrom8: since he's using a 74LS08, he will need a pull-down of 2K or less to guarantee the input is seen as Low. 10K would be fine with a CMOS part (74AC, etc.) – Peter Bennett Nov 12 at 21:28
  • Cheers @PeterBennett, I didn't bother looking at the datasheet. – DerStrom8 Nov 13 at 2:10

The inputs on bipolar TTL families (74xx, 74LSxx, and others without a "C" in the middle) will source current - when left unconnected they will act as a logic High. For the 74LS family, you have to draw about 0.4 mA from an input for it to be recognized as a logic Low.

Traditionally, we would put switches between the input pin and Ground to ensure that the input could be pulled low enough to be seen as a Low, and add a pull-up resistor from the pin to +5V to ensure that the input would be High when the switch was open.

If you want the switch between the input pin and +5V, you would need a pull-down resistor under 2000 Ohms to ensure the input was Low when the switch is open.

  • This answer needs more upvotes! While the answers using pull-down resistors aren't wrong per se, the pull-down resistors aren't necessary since the chip already has pull-ups integrated. This is much more valuable considering the used chip! – Dakkaron Nov 13 at 13:46


simulate this circuit – Schematic created using CircuitLab

This is because your circuit never put entries to 0v (entries of the gate). you have to use pull-up/pull-down to manage signal on entries of the gate.

So when you do not use the button, the 5 volt is supplied ... if you use it it connects entry to gnd

the output of the gate changes.

  • 2
    I don't understand what that means. Could you please elaborate? I'm a complete beginner. – user2303321 Nov 12 at 10:43
  • How to I put entries to 0v? – user2303321 Nov 12 at 10:51
  • I think you have drawn your schematic completely differently to the breadboard circuit shown. For one, your schematic shows resistors, the breadboard does not. You also have the buttons connecting the inputs to GND when you can see that they are actually pulling the inputs up to VCC – MCG Nov 12 at 10:52
  • 1
    Yes, that is fine, but this configuration will work differently to how OP explained in his last paragraph. His configuration can work with the addition of resistors, as in my answer. OP's last paragraph shows how he expects his circuit to work, and this one does the opposite. – MCG Nov 12 at 11:09
  • 2
    The LS TTL family is also not very symmetric for input/output currents, 100K may not pull the input sufficiently low. 10K should be better (and get rid of flicker). Also the nominal current drive capability for a high output is much worse than low output so your circuit will be stressing the output stage. That's fine if this is just a learning toy, but it won't be reliable. See Texas Instruments sn74ls08.pdf datasheet for details. Note they have 3 different TTL families on the DS, they all behave slightly differently. – isdi Nov 12 at 14:16

TL;DR: Separated from 5V by a simple switch EQUALS "pin not connected" DOESN'T EQUAL "no voltage applied" DOESN'T EQUAL "logical 0".

An unconnected input of a true TTL chip (74xx, 74Sxx, 74LSxx) behaves as if it is connected to 5V DC, whereas on a CMOS chip (74HCxx, 74ACTxx, CD40xx), it behaves as if it is connected to 5V AC.

In any case, unless your LED has a (rare) built in current limiting resistor, YOU NEED ONE.

  • 1
    These points aren't completely wrong or without value, but they are rather poorly stated, and have already been explained much more clearly and accurately by others. – Chris Stratton Nov 12 at 21:10
  • My intent was to add an answer with colour and brevity to a colourful and brief problem :) – rackandboneman Nov 12 at 21:19
  • 3
    @rackandboneman How does an unconnected input on a CMOS chip behave like it was connected to a 5V AC line? – Nayuki Nov 13 at 2:08

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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