Build Your Own Digital Lock: A 4017 Circuit Project

Circuit

Digital Electronic Lock

Description

The digital lock demonstrated below employs four prevalent logic ICs to facilitate relay control through the entry of a four-digit number on a keypad. The initial four outputs from the CD4017 decade counter (pins 3, 2, 4, 7) are combined with four digits originating from a keypad, ensuring that as the keys are depressed in the correct sequence, the counter will increment. With each accurate key pressed, a low-level signal appears at the output of the dual NAND gate, resulting in a high-level signal at the output of the 8-input NAND at pin 13. This momentary high level from pin 13 activates a one-shot circuit, which applies an approximate 80-millisecond positive-going pulse to the clock line (pin 14) of the decade counter, causing it to advance by one count on the rising edge. A second monostable one-shot circuit is utilized to generate an approximate 40-millisecond positive-going pulse, which is applied to the common point of the keypad, enabling the appropriate NAND gate to recognize two logic high levels when the correct key is pressed (one from the counter and the other from the keypad). The inverted clock pulse (negative-going) at pin 12 of the 74C14 and the positive-going keypad pulse at pin 6 are combined using two diodes as an AND gate (shown in the lower right corner). The output at the junction of the diodes will be positive in the event a mistaken key is pressed and will reset the counter. When a correct key is pressed, signals will be present from both the monostable circuits (clock and keypad) keeping the reset line low and allowing the counter to proceed. However, since the keypad pulse begins slightly before the clock, a 0.1uF capacitor is connected to the reset line to delay the reset until the inverted clock arrives. The values are not crucial and various alternative timing schemes could be employed but the clock signal should be slightly longer than the keypad pulse so that the clock signal can mask out the keypad and prevent resetting the counter in the event the clock pulse ends before the keypad pulse. The fifth output of the counter is on pin 10, so that after four correct key entries have been made, pin 10 will move to a high level and can be used to activate a relay, illuminate an LED, etc. At this point, the lock can be reset simply by pressing any key. The circuit can be expanded with additional gates (such as a CD4011) to accept up to an 8-digit code. The 4017 counting order is 3 2 4 7 10 1 5 6 9 11, so that the first 8 outputs are connected to the NAND gates and pin 9 would be utilized to drive the relay or light. The 4 additional NAND gate outputs would connect to the 4 remaining inputs of the CD4068 (pins 9, 10, 11, 12). The circuit operates from 3 to 12 volts on 4000 series CMOS but only 6 volts or less if 74HC parts are used. The circuit draws very little current (about 165 microamps) so it could be powered for several months on 4 AA batteries assuming only intermittent use of the relay.

CD4017 Decade Counter

The CD4017 is a versatile integrated circuit used as a decade counter. It contains seven binary counters, each capable of counting from 0 to 9. This IC is commonly used in digital displays, timers, and other sequential logic circuits. It consists of seven 4-bit binary counters, each with an enable input and a clock input. The outputs of the counters are available for display or other applications. The CD4017 is a popular choice due to its low cost, availability, and ease of use. It operates on a 5V power supply and has a wide operating temperature range. The IC is characterized by its high input impedance, which minimizes loading effects on the driving circuits. The CD4017 is available in both DIP and SOIC packages, making it suitable for a wide range of applications. This IC is commonly used in digital displays, timers, and other sequential logic circuits. It consists of seven 4-bit binary counters, each with an enable input and a clock input. The outputs of the counters are available for display or other applications. The CD4017 is a popular choice due to its low cost, availability, and ease of use. It operates on a 5V power supply and has a wide operating temperature range. The IC is characterized by its high input impedance, which minimizes loading effects on the driving circuits. The CD4017 is available in both DIP and SOIC packages, making it suitable for a wide range of applications.

74C14

The 74C14 is a versatile integrated circuit that is frequently used as an inverter and also as a buffer. It is a 3-input NAND gate, providing a convenient way to implement logic functions. The IC contains four NAND gates, which can be configured to perform various logical operations. The 74C14 is a widely used component in digital circuits due to its low power consumption, high speed, and ease of use. It operates on a 5V power supply and has a wide operating temperature range. The IC is characterized by its high input impedance, which minimizes loading effects on the driving circuits. The 74C14 is available in both DIP and SOIC packages, making it suitable for a wide range of applications. This IC is commonly used in digital circuits due to its low power consumption, high speed, and ease of use. It operates on a 5V power supply and has a wide operating temperature range. The IC is characterized by its high input impedance, which minimizes loading effects on the driving circuits. The 74C14 is available in both DIP and SOIC packages, making it suitable for a wide range of applications. This IC is commonly used in digital circuits due to its low power consumption, high speed, and ease of use.

CD4068

The CD4068 is a versatile integrated circuit consisting of four 2-input NAND gates. It's frequently employed in digital circuits to perform various logical operations. The IC contains four NAND gates, which can be configured to perform various logical operations. The CD4068 is a popular choice due to its low cost, availability, and ease of use. It operates on a 5V power supply and has a wide operating temperature range. The IC is characterized by its high input impedance, which minimizes loading effects on the driving circuits. The CD4068 is available in both DIP and SOIC packages, making it suitable for a wide range of applications. This IC is commonly used in digital circuits due to its low power consumption, high speed, and ease of use. It operates on a 5V power supply and has a wide operating temperature range. The IC is characterized by its high input impedance, which minimizes loading effects on the driving circuits. The CD4068 is available in both DIP and SOIC packages, making it suitable for a wide range of applications. This IC is commonly used in digital circuits due to its low power consumption, high speed, and ease of use.