Two-Key AND Gate Demonstration
Two switches feed a 2-input AND gate, and the output light is HIGH only when both inputs are HIGH. The security framing is an educational Boolean model, not a deployable access-control system.
A two-condition combinational interlock: the Door Unlocked light turns on only while both key switches are on.
What You'll Learn
- Read and write the complete 2-input AND truth table.
- Translate “both keys must be on” into Door Unlocked = Key 1 · Key 2.
- Distinguish an AND policy from OR and NAND alternatives.
- Verify commutativity by exchanging the two input values.
- Separate a Boolean interlock demonstration from a production security design.
How It Works
The production circuit has two input switches, labeled Key 1 and Key 2, connected to one 2-input AND gate. The gate drives a single output light labeled Door Unlocked. There is no third credential or override input in the actual component graph.
The implemented function is Door Unlocked = Key 1 · Key 2. The output is 1 only when both inputs are 1; the other three input combinations produce 0.
This is a direct example of logical conjunction: every required condition must be asserted simultaneously. Because AND is commutative, exchanging the two key wires does not change the result. Because it is associative, a wider all-conditions rule can be built by cascading additional 2-input AND gates.
The circuit is an educational policy model, not a complete access-control system. Real security equipment also requires authenticated sensors, tamper handling, fault detection, state retention, timing, and fail-safe output drivers.
Truth Table
The two input switches produce four combinations. Door Unlocked is high only for the all-ones row.
| Inputs | Output | ||
|---|---|---|---|
| Key 1 | Key 2 | Door Unlocked | |
| 0 | 0 | 0 | Neither key is on — output low. |
| 0 | 1 | 0 | Only Key 2 is on — output low. |
| 1 | 0 | 0 | Only Key 1 is on — output low. |
| 1 | 1 | 1 | Both keys are on — Door Unlocked high. |
Boolean Expression
The output is high only when both Key 1 and Key 2 are high.
De Morgan's law expresses the same AND function as the negation of the OR of the two complemented inputs.
Try It Step-by-Step
Set the listed controls in the embedded circuit, then compare the observed modeled state with the expected result.
- 1Key 1=0Key 2=0Expected:
Door Unlocked = 0What you'll see:With both switches off, both AND inputs are 0 and the output light is dark. - 2Key 1=1Key 2=0Expected:
Door Unlocked = 0What you'll see:Key 1 alone is insufficient; the second AND input remains 0. - 3Key 1=0Key 2=1Expected:
Door Unlocked = 0What you'll see:Key 2 alone is also insufficient, confirming that the input order does not matter. - 4Key 1=1Key 2=1Expected:
Door Unlocked = 1What you'll see:With both switches on, the AND output becomes 1 and the Door Unlocked light turns on.
Components Used
Applications and Design Context
Two-condition permissives. A machine action may be allowed only when a guard is closed and an enable command is present.
Dual-sensor validation. Two independent ready signals can be combined before a downstream stage is enabled.
Chip-enable qualification. An address-select result may be ANDed with a global enable before activating a device.
Write gating. A storage element can accept a write only when both select and write-enable conditions are asserted.
Educational access models. Key switches provide an intuitive way to visualize an all-required Boolean policy without implying a complete security implementation.
Frequently Asked Questions
Why use AND instead of OR?
AND matches the policy “both conditions must be true.” OR would assert the output when either key alone is high, which is a different policy.
How can I require a third key?
Add a third input with another 2-input AND: first combine Key 1 and Key 2, then AND that result with Key 3. Associativity makes the cascade equivalent to a 3-input AND.
How would I create an active-high locked or alarm signal?
Use the complemented AND output: Locked = ¬(Key 1 · Key 2). A NAND gate produces that signal directly, but the production circuit shown here contains only an AND gate and the unlock light.
How is a 2-input AND implemented in silicon?
A conventional static-CMOS 2-input AND is commonly implemented as a NAND stage followed by an inverter. Exact device count, delay, power, and drive strength depend on the chosen cell library and circuit topology.
Does key order matter?
No. AND is commutative, so swapping Key 1 and Key 2 leaves the truth table unchanged. Their labels may represent different real-world checks, but the gate treats both inputs symmetrically.
What propagation delay does the circuit have?
The simulator presents the logical result without modeling a specific hardware delay. A physical implementation has input-to-output propagation delay determined by its technology, loading, supply, and routing.