Digital Combination Lock


The objective of this experiment is to reinforce student's understanding of the concepts behind digital logic using a hands-on laboratory experience.

Materials Required

A materials list is given below using Radio Shack part numbers as reference only because of this store's wide accessibility. The frugal buyer will probably find the battery and breadboard available elsewhere at a noticable savings. It is also useful to have a set of common wire cutters and strippers, and maybe some needle-nosed pliers.

Item Part No. Price ($)
Hookup Wire (22 AWG) solid (not stranded) wire 278-1221 4.49
Breadboard socket 276-174 12.49
6 volt heavy-duty (lantern) dc battery 23-016A 3.99
Quad 2-input AND gate IC (74HCT08) 276-2805 0.89
Hex inverter (NOT) gate IC (74HCT04) 276-2804 0.89
Light emitting diode (LED) 276-026 0.99

The wire is cut into several short (few inches long) lengths. It is important that the wire be solid (not stranded) insulated wire (about # 20-22 gauge); otherwise, pushing the wires into the breadboard will be very difficult.

Circuit Design

We have chosen to purchase an IC (integrated circuit) chip that has three 2-input AND gates rather than a single 4-input AND gate due to the fact that the 2-input AND gates are more widely available. The AND IC (7408) is a QUAD gate which means there are actually four 2-input gates---we will only use three of the four gates. Likewise, the inverter (NOT) IC (7404) is a HEX gate, which means that there are six inverters inside each chip---once again, we will use at most four of the inverters in a single 4-input combination lock.

The basic logic diagram for the two locks we will construct are shown in the Fig. 1 below with the IC pin numbers given.

Digital Lock Schematic 1 1 1 1 Digital Lock Schematic 0 1 1 0
Combination: 1 1 1 1 Combination: 0 1 1 0
Fig. 1: Digital Combination Lock Schematics

How to Build It

Take a good look at the breadboard and refer to Fig. 2 below during the circuit construction. You will notice that the breadboard has a long horizontal alley of holes near the top and bottom edges, and then columns of holes in the central region of the breadboard. There is also a gutter in the center of the breadboard where no holes exist. On either side of the gutter, the vertically adjacent (columns of) holes are electrically connected, but the connection does not extend across the gutter. For the two (top and bottom) alleys, the horizontally adjacent (rows of) holes are also electrically connected.


Fig. 2: Digital Lock Breadboard Hookups (Combination: 1 1 1 1)

Now place the chips onto the breadboard. The center of each chip should be over the gutter of the board, with the pins of the chips fitting snuggly into the holes on both sides of the gutter. Make sure that the notch side of the chip is facing to the left. Be careful as you press the chip legs into the board, as they are fragile. For convenience the chips should be placed several columns apart from each other. A diagram of the chip can be found on the back of the package that the chip came from. Notice that pin number 1 is the pin to the bottom left of the chip (as long as the chip notch is to the left). All of the pins are numbered on the back of the package for reference.

The top alley of the breadboard will be the positive (+6 volts) connection; the bottom alley will be the negative or ground connection (0 volts).

On the chip diagram, the pin # 14 is labeled VCC, and pin # 7 is labeled GND. VCC means the pin where the positive voltage supply should be applied. GND represents ground, and is where the ground or negative voltage is connected. Connect the VCC by running a wire from the top alley to any one of the four holes directly above pin # 14 of the chip. Do this for both chips. Now connect the GND by running a wire from the bottom alley to one of the four holes immediately below pin # 7 of each chip.

For the next step you will need to cut off several 2 to 3 inch wires and strip both ends of the wires. Plug a wire from a hole corresponding to pin # 13 into the positive voltage (top) alley. Now do the same for pins 9, 10, and 12. Plug a wire from a hole adjacent to pin # 11 into a hole corresponding to pin # 1. Likewise, interconnect pin # 8 and pin # 2.

Before inserting the LED (light emitting diode) we must first determine its polarity, that is, which side should be connected to the positive voltage and which should be connected to the ground. To test the LED, extend the metal leads of the LED across the terminals of the battery in order to determine which side of the LED to which the positive voltage should be applied. Once the LED turns on, you have the correct direction, and may wish to label it for future reference.

Now plug the positive end of the LED into one of the holes corresponding to pin # 3 of the AND gate IC. The negative end of the LED is plugged into the bottom alley.

Now connect the positive voltage terminal of the battery to the top alley by stripping the plastic off each end of a wire, and then inserting one end into the alley and the other end on the positive battery terminal. Now connect the ground or negative battery terminal to the bottom alley of the breadboard. Make sure the connections to the battery terminals are secure. The chips are now turned on.

If all the connections above are properly completed, the LED should now be lit. This digital lock has a combination of 1 1 1 1.


To further the student's understanding, the inverter (NOT) gate IC (7404) will now be used to change the lock combination. Described below is a procedure for changing the combination from 1 1 1 1 to 0 1 1 0. Afterwards, the student may experiment on his/her own by creating a circuit with a new combination.

Select the wire that is connected to pin # 13 of the AND gate chip (7408), and unplug its connection to the positive voltage (top) alley. Reroute the unplugged end of the wire into pin # 12 of the inverter (NOT) chip (7404). Repeat this procedure for the wire connected to pin # 9 of the AND gate (7408), except connect its disattached end to pin # 10 of the inverter chip (7404).

Now connect a wire between pin # 13 of the inverter chip (7404) and the ground (bottom) alley. Repeat this process for pin # 11 of the inverter chip.

The LED should now be re-lit indicating a digital lock of combination 0 1 1 0 (see Fig. 3).


Fig. 3: Digital Lock Breadboard Hookups (Combination: 0 1 1 0)


Questions for Thought
  1. Why must the VCC of the chip be connected to the battery?
    ANSWER: The chip requires power to enable it to operate.
  2. Because of the choice of chips, the discerning student may realize that a 5-input digital combination lock can be constructed, and this may provide an interesting assignment for further exploration.

ASU Department of Electrical Engineering
Last Updated: June 21, 2002

Original Page Development by: Matt Dayley and Keith Holbert
Return to WISE Investments in Electrical Engineering Lab Page