Simple combination lock

29,006

Circuit Image

This experiment can be constructed using a single 8-position DIP switch, but utilizing two switch assemblies enhances the understanding of the concept. One switch assembly retains the correct code for unlocking the lock, while the other serves as the data entry point for the user attempting to unlock it. In practical applications, the switch assembly containing the "key" code must be concealed from the user, necessitating its placement away from the data entry switch assembly. This results in the requirement for two separate switch assemblies. However, with a clear understanding of the concept, it is feasible to create a functioning circuit using only one 8-position switch, where the left four switches are designated for data entry and the right four hold the "key" code. This circuit demonstrates the application of XOR (Exclusive-OR) gates as bit comparators. Four XOR gates compare the respective bits of two 4-bit binary numbers, each entered into the circuit via a switch set. If the two numbers match exactly, the green "Go" LED illuminates when the "Enter" pushbutton is pressed. Conversely, if the numbers do not match, the red "No go" LED lights up upon pressing the "Enter" button. Given that four bits yield only sixteen possible combinations, this lock circuit lacks sophistication. In a real-world application, such as a home security system, the "No go" output would need to connect to an alarming device to deter unauthorized attempts at code entry, as trying all combinations (0000 through 1111) would be relatively quick. This experiment does not cover the integration of this circuit into a comprehensive security system or locking mechanism; instead, it focuses on recognizing a pre-entered code. The "key" code must remain hidden from view. In a practical security system, the data entry switch assembly would be positioned outside the door, while the key code switch assembly would be located behind the door alongside the rest of the circuitry. In this experiment, the two switch assemblies are likely to be placed on separate breadboards, but it is also possible to construct the circuit with a single 8-position DIP switch assembly. The primary objective of the experiment is to introduce the principle of XOR gate code comparison. An XOR gate outputs a "high" (1) signal when the input signals differ in logic state. The outputs of the four XOR gates are connected through a diode network that acts as a four-input OR gate: if any XOR gate outputs a "high" signal—indicating a mismatch between the entered code and the key code—then a "high" signal is sent to the NOR gate logic. If the two 4-bit codes are identical, none of the XOR gate outputs will be "high," and a pull-down resistor connected to the common terminals of the diodes will provide a "low" signal state to the NOR logic. The NOR gate logic serves a straightforward function: it prevents either LED from illuminating unless the "Enter" pushbutton is pressed. Only when this pushbutton is activated can either LED be energized. If the Enter switch is pressed and all XOR outputs are "low," the "Go" LED will light up, signifying that the correct code has been entered. If the Enter switch is pressed and any XOR outputs are "high," the "No go" LED will illuminate, indicating an incorrect code entry. In a real security system, it would be prudent to implement a deterrent mechanism for the "No go" output to discourage unauthorized individuals from discovering the correct code through trial and error.

The circuit described utilizes an 8-position DIP switch for input, with two potential configurations: a single switch for both data entry and key code or two separate switch assemblies for enhanced security. The XOR gates serve as the core component for comparing the binary inputs, providing a straightforward mechanism for determining code validity. Each XOR gate compares corresponding bits from the two 4-bit binary numbers, generating a "high" output when the bits differ. This output is monitored by a diode network, which aggregates the signals and feeds them into a NOR gate.

The NOR gate's function is critical, as it ensures that the LEDs only activate when the "Enter" button is pressed. This design prevents accidental triggering of the indicators and ensures intentional user action is required for code validation. The circuit's simplicity, with only sixteen possible combinations, makes it suitable for educational purposes, illustrating fundamental concepts of logic gates and binary comparison. However, in practical implementations, additional security measures would be necessary, such as integrating alarm systems or time delays to prevent brute-force attacks on the code. The design emphasizes the importance of securely concealing the key code and provides a foundational understanding of XOR gate operations in digital logic systems.This experiment may be built using only one 8-position DIP switch, but the concept is easier to understand if two switch assemblies are used. The idea is, one switch acts to hold the correct code for unlocking the lock, while the other switch serves as a data entry point for the person trying to open the lock.

In real life, of course, the switch a ssembly with the "key" code set on it must be hidden from the sight of the person opening the lock, which means it must be physically located elsewhere from where the data entry switch assembly is. This requires two switch assemblies. However, if you understand this concept clearly, you may build a working circuit with only one 8-position switch, using the left four switches for data entry and the right four switches to hold the "key" code.

This circuit illustrates the use of XOR (Exclusive-OR) gates as bit comparators. Four of these XOR gates compare the respective bits of two 4-bit binary numbers, each number "entered" into the circuit via a set of switches. If the two numbers match, bit for bit, the green "Go" LED will light up when the "Enter" pushbutton switch is pressed.

If the two numbers do not exactly match, the red "No go" LED will light up when the "Enter" pushbutton is pressed. Because four bits provides a mere sixteen possible combinations, this lock circuit is not very sophisticated.

If it were used in a real application such as a home security system, the "No go" output would have to be connected to some kind of siren or other alarming device, so that the entry of an incorrect code would deter an unauthorized person from attempting another code entry. Otherwise, it would not take much time to try all combinations (0000 through 1111) until the correct one was found!

In this experiment, I do not describe how to work this circuit into a real security system or lock mechanism, but only how to make it recognize a pre-entered code. The "key" code that must be matched at the data entry switch array should be hidden from view, of course.

If this were part of a real security system, the data entry switch assembly would be located outside the door, and the key code switch assembly behind the door with the rest of the circuitry. In this experiment, you will likely locate the two switch assemblies on two different breadboards, but it is entirely possible to build the circuit using just a single (8-position) DIP switch assembly.

Again, the purpose of the experiment is not to make a real security system, but merely to introduce you to the principle of XOR gate code comparison. It is the nature of an XOR gate to output a "high" (1) signal if the input signals are not the same logic state.

The four XOR gates` output terminals are connected through a diode network which functions as a four-input OR gate: if any of the four XOR gates outputs a "high" signal - indicating that the entered code and the key code are not identical - then a "high" signal will be passed on to the NOR gate logic. If the two 4-bit codes are identical, then none of the XOR gate outputs will be "high, " and the pull-down resistor connected to the common sides of the diodes will provide a "low" signal state to the NOR logic.

The NOR gate logic performs a simple task: prevent either of the LEDs from turning on if the "Enter" pushbutton is not pressed. Only when this pushbutton is pressed can either of the LEDs energize. If the Enter switch is pressed and the XOR outputs are all "low, " the "Go" LED will light up, indicating that the correct code has been entered.

If the Enter switch is pressed and any of the XOR outputs are "high, " the "No go" LED will light up, indicating that an incorrect code has been entered. Again, if this were a real security system, it would be wise to have the "No go" output do something that deters an unauthorized person from discovering the correct code by trial-and-error.

In other words, there should be some sort of penalty f 🔗 External reference