Two-of-Three Door Controller: Choosing the Right Logic
A college access-control door has three independent credential inputs: card (C), keypad PIN (P) and supervisor key (K). The security committee's rule is that the door unlocks when at least two of the three are valid within the same 30-second window; a single credential must never open the door, because a lost card alone was enough to open the old door last year. A local vendor has quoted two cheaper alternatives: a 'series board' that unlocks only when all three credentials are valid, and a 'parallel board' that unlocks when any one is valid. The technician has wired all three sensors as active-high inputs, and the lock solenoid is active-high. The committee also wants the board built from 74LS00 quad 2-input NAND ICs to keep spares simple, and has asked how many ICs the design will need.
1. Derive the minimal Boolean expression for the unlock output U from the committee's stated rule, and justify why the expression matches the rule rather than only stating the answer.
Read the worked answer
Truth table (8 rows, inputs C P K): U = 1 only for 0 1 1, 1 0 1, 1 1 0 and 1 1 1 - minterms 3, 5, 6, 7. Every row with 0 or 1 valid credentials gives U = 0, which is precisely the committee's rule.
K-map grouping.
- Cells 3 and 7 differ only in C, so they group to PK.
- Cells 5 and 7 differ only in P, so they group to CK.
- Cells 6 and 7 differ only in K, so they group to CP.
No group of four or eight is possible, so the minimal SOP is U = CP + CK + PK (the 2-of-3 majority function).
Why this is right, not just algebra. Each product term says 'these two credentials are present, and the third one does not matter'. Since every term contains at least two variables, no input can raise U on its own - which is the security requirement. The three terms together cover every combination in which two or three credentials are valid, so no legitimate two-credential holder is locked out. A useful check is to evaluate all eight rows of the derived expression against the truth table; they match in every row.
2. Assess the two vendor boards against the committee's rule. For each, name the concrete failure that would occur and state which one you would reject most strongly.
Read the worked answer
Series board (U = CPK). This requires all three credentials every time. A supervisor holding a valid card and PIN but no key would be refused; in an emergency, staff who have lost or left the key would be locked out. It is fail-secure (it never opens on one credential) but it contradicts the agreed rule and will be bypassed by staff propping the door open - a real-world security loss.
Parallel board (U = C + P + K). Any single credential opens the door. This reproduces exactly last year's incident: a lost or photographed card is enough to walk in. It also means a single stuck-high sensor input or a short to Vcc unlocks the door permanently, with no second factor to stop it.
Judgement. Reject the parallel board most strongly: it is an availability-friendly but unsafe design, and it fails the single most important requirement. The series board is safe but over-restrictive; it would be acceptable only if the committee rewrote its rule to three-factor access.
The majority expression U = CP + CK + PK is the only one of the three that satisfies both halves of the rule - never one credential, always two.
3. The board must be built from 74LS00 quad 2-input NAND packages. Show how U is implemented in NAND form, count the gates and packages, and note the practical wiring precautions.
Read the worked answer
NAND construction of U = CP + CK + PK.
- Each product needs a NAND followed by an inverter (inputs tied together): CP = 2 gates, CK = 2 gates, PK = 2 gates - 6 gates.
- The three terms are added with NAND: first NAND(CP, CK) to give (CP.CK)', then NAND that with PK, then invert the result. That is 3 more gates.
Total 9 two-input NAND gates. A 74LS00 contains 4 gates, so packages needed = ceiling(9/4) = 3 ICs (12 gates, 3 spare). Nine gates do not fit in two packages; sharing inverted terms between stages does not bring the count down to 8, so the third IC stays on the order.
Practical precautions.
- Tie every unused NAND input to Vcc or GND; a floating TTL input picks up noise and can produce a false unlock.
- Fit a 100 nF decoupling capacitor across Vcc/GND of each IC, close to the package.
- Add a pull-down resistor on each sensor input so a broken wire reads 0 (no credential), not 1.
- The solenoid is active-high, so drive it through a transistor or relay, never directly from a logic output; add a flyback diode across the coil.
- Keep the 30-second window in a small timer so that two credentials entered far apart do not combine into a false unlock.