1
\$\begingroup\$

I am new to electrical engineering still so forgive me if I am making a stupid mistake. So I have wired up my 74LS08 AND gate according to this datasheet. enter image description here

My wiring: enter image description here

As you can see the LED is on by default despite neither button being pressed. Pressing the buttons does nothing. It is currently powered by a 5v 1.25amp phone charger plugged into the wall. I have tried switching to a 9v battery and nothing changes. And after a google search I havnt come up with anything, usually the videos are terrible quality or they are using a different AND gate

\$\endgroup\$
  • \$\begingroup\$ connect the switch to GND instead of +5V and press the button again .... the switch will introduce a logic LOW to the input, so the LED should go out \$\endgroup\$ – jsotola May 23 '18 at 2:50
  • \$\begingroup\$ Its a good start now, the LED is only lit when both buttons are not pressed, i dont remember that gate name though \$\endgroup\$ – dka13 May 23 '18 at 3:23
  • 1
    \$\begingroup\$ it is working .... unconnected inputs go HIGH because of the IC design .... that is why the led was always on ..... if the button was not pressed, the input was HIGH .... when the button was pressed it was connected to HIGH (+5V) .... it was never connected to LOW ....... gate name you posted it in your question .... AND gate \$\endgroup\$ – jsotola May 23 '18 at 3:44
2
\$\begingroup\$

You could try adding a pull down resistor (100k, 500K, ohm, doesn't much matter) your inputs may be floating high. The inputs with both switches unpressed allow the pins to float around, depending on the way the IC is set-up internally.

\$\endgroup\$
  • \$\begingroup\$ Looking at the image I agree. Many pins left floating. It might be oscillating as well. \$\endgroup\$ – Sparky256 May 23 '18 at 2:42
  • 1
    \$\begingroup\$ The inputs of the 74LS family (and other TTL versions) source significant current and will appear as a logic High unless firmly pulled to Ground - your 100k resistors won't help. Traditionally, we would use a 5K1 (or so) pull-up resistor from the input pin to +5V, and connect the switch between the input pin and Ground - this would ensure a valid logic Low level when the switch was pressed. \$\endgroup\$ – Peter Bennett May 23 '18 at 2:55
  • 1
    \$\begingroup\$ If you do use a pull down resistor, make it low like @PeterBennett recommended. With the LS you need to sink 1.6mA. \$\endgroup\$ – AlmostDone May 23 '18 at 2:58
  • 1
    \$\begingroup\$ @ Peter Bennett "Traditionally, we would use a 5K1 (or so) pull-up resistor from the input pin to +5V" If you do that on this circuit you guarantee a constant high on an and gate, no? \$\endgroup\$ – Sara Heart May 23 '18 at 3:00
  • 1
    \$\begingroup\$ The 5K1 pull-up resistor ensures that the pin is seen as High when the switch is not pressed. The switch between the input pin and Ground will provide a Zero Ohm connection to Ground when the switch is pressed, ensuring that the gate sees the input as a Low. As @AlmostDone said, you need to draw about 1.6 mA from the input pin to ensure that it is seen as a low. This only applies to the TTL families (plain 74xx, 74LS,74ALS). The inputs on CMOS parts (anything with a "C" in the middle) source or sink very little current, so 100K pull-up or -down will work with them. \$\endgroup\$ – Peter Bennett May 23 '18 at 3:53
1
\$\begingroup\$

You might be using push buttons that are connected in such a way that the legs are shorted (connected together). They are notorious for that particular mishap. There are four legs connected together in pair of two. If you choose the wrong pair, you end up with an always on switch.

If you want to absolutely avoid learning the pin out of these push buttons, always connect them in diagonal. In that case, the left button should have a red wire on the lower left pin. Something similar should be done to the right button.

Pull down resistors (as suggested in another answer), might also a good idea.

\$\endgroup\$
  • \$\begingroup\$ not the issue, just tried it and nothing changed \$\endgroup\$ – dka13 May 23 '18 at 3:03
  • \$\begingroup\$ Then if your IC is good your switches are mis-wired, I have done it myself with that type of switch. Try a meter on your input pins \$\endgroup\$ – Sara Heart May 23 '18 at 3:24
  • \$\begingroup\$ I think that you were dead on in the first place with your answer @SaraHeart . the IC is good (see comments on the original question) and the switches are good (as per his previous comment and a quick lookup on google). \$\endgroup\$ – Simon Marcoux May 23 '18 at 10:39

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.