Installations with restricted access are often protected using an access code. If you don’t have particularly demanding requirements regarding modifying the code, you can manage quite nicely with a static design with the access code fixed in the hardware. The access code can be set by inserting wire links in the IC socket shown at the left in the schematic diagram. The code ‘0280’ is shown configured in the drawing. The user enters the code with S1–S10. The most important components in this circuit are the four NAND gates (4011 CMOS IC) and the counter with ten decoded outputs (4017 CMOS IC). R1–R4 hold the four pushbutton inputs at ground level if no button is pressed. No measures need be taken to debounce the switch signals, since the circuit simply ignores repeated button presses. In the quiescent state, a ‘1’ is applied to the reset input (pin 15) of IC2, which causes output Q0 (pin 3) of IC2 to be the only output with a ‘1’ level. All other counter outputs are at the ‘0’ level.
Dual LED D6 will be on and red to indicate that a code can be entered. If the button for the first digit of the preset code is now pressed (in this case the ‘0’ button), the output of IC1a will go to ‘0’ and the reset input of IC2 will also go to ‘0’ via D1 and D5. When the button is released, a rising edge appears at the clock input of IC2, which causes the counter to be incremented by 1. Thanks to R6 and C1, the reset input of IC2 remains low for around 10 seconds. Output Q1 (pin 2) of the counter is now ‘1’ as a result of the clock pulse, and IC1b is waiting for the second button (‘2’) to be pressed. If that doesn’t happen within 10 seconds, C1 discharges via R5 and R6 to a level that causes IC2 to be reset. Dual LED will again become red, and the user must start entering the code again.
However, if the buttons for the each of the remaining digits of the code are pressed correctly within 10 seconds, the Q4 output (pin 10) will ultimately go to ‘1’ and the dual LED will change to green. After 10 seconds, C1 will again be discharged and the dual LED will change back to red. The Q4 output can be used to switch something, such an electronic door latch. If you want to change the code, you only have to change the configuration of the wire jumpers in the IC socket. The combination of diodes D1–D4 and R5 acts as an AND gate. If the output of one of the four NAND gates in IC1 is ‘0’ (which is always the case if a correct button is pressed), a ‘0’ is applied to the clock input of IC2 as long as the button is held pressed. If you find a delay of 10 seconds too long, you can reduce the value of R6 or C1. The time is approximately equal to the product of R6 and C1 (R6 x C1).