Hardware Debounced Switch Using a 74LS04

by dbnewman1 in Circuits > Electronics

511 Views, 0 Favorites, 0 Comments

Hardware Debounced Switch Using a 74LS04

7404.jpg
IMG_20221015_195952082_HDR.jpg

This is how to debounce a switch for engineering students with a bad memory, and the self-taught hobbyist who is experiencing unexpected behavior in their projects. Debouncing is important due to the switches’ physical construction. When you press the switch, it can act as though it was pressed multiple times, this can result in unexpected behavior. This particular method of debouncing was mostly popular before the advent of the IC as you could use a single BJT transistor for an inverter but today we will use a 74ls04. This method is inferior to the NAND gate method but is good in instances when cost must be as low as possible and/or when this method is asked for.

Supplies

  • Breadboard
  • Wires
  • Spdt switch
  • Some 330Ω resistors
  • A 74LS04 six inverter gate IC
  • Some assorted wires
  • 1x LED (any color)
  • DC power supply

Creating the Latch

IMG_20221015_163837656.jpg

First place the 74ls04 on the breadboard with the notch facing up.

Wire pin 7 to Ground and Pin 14 to Vcc, which needs to be 5Vdc

Attach a 330Ω resistor to the board attaching one leg to pin 2 and the other to pin 3

Attach another 330Ω resistor to the board attaching one leg to pin 1 and the other leg to pin 4 use wire if necessary

Attaching the Switch and the Rest of the Circuit

IMG_20221015_164046164.jpg

Place your switch on the breadboard

Wire the C or common pin to ground

Wire the pin labeled NO to pin 4 of the 74ls04 IC

Wire the pin labeled NC to pin 2 of the 74ls04 IC


You do not need this last bit for just a debounced switch, this is just an example circuit.


Place another 330Ω resistor on the breadboard with one leg attached to pin 2 of the IC and the other anywhere on the board not already connected to anything.


Place the LED on the board with the flat cathode side attached to ground and the anode side attached to the second leg of the previously placed resistor



Powering the Board

At the top most parts of the breadboard, place wires for power and ground.

Set your DC power supply to 5V and attach the power supply to the breadboard

You will need to insure all of the different sections of your breadboard have power

Finally you should have a working toggleable LED with a debounced switch

This variety of debounce is better for things like advancing a shift register as the LED will only stay on while the switch is depressed, but it serves to illustrate the purpose