The 4017 decade counter is the heart of the circuit. Only one output is on at any one time. As pulses are applied to the clock input, the next output in the sequence goes high and so on. Initially the counter is reset with output0 on. When the correct switch is pressed, in this case SW1, this provides a pulse to the clock of the counter, advancing it to the next output which in turn supplies the voltage to another (or the same) switch. When this is pressed the process repeats, until the last output goes high, in this case output6, which triggers a monstable made from 2 NOR gates, R4 and C2. This provides an output pulse for Q2 which drives a relay. The relay can activate a solenoid or other locking device to unlock or open a door.
The reset section, made from Q1, R1, C1 and 2 NOR gates, holds the counter at output0 unless a clock signal (button press) is received. This conducts Q1 via R2, shorting out C1, which in turn releases the reset on the counter allowing it to count to the next output. When any switch is released and the clock pulse ends, Q1 switches off, allowing C1 to start charging via R1. This takes about 2 seconds for C1 to reach logic 1 level for the NOR gates which is inverted twice, sending a reset to the counter thus cancelling any inputs entered so far. Therefore the swithces must be pressed within 2 seconds of each other otherwise the counter resets. This has the added advantages of resetting the counter when the circuit powers up, removes the need to check for incorrect switch presses and resets whether an entry is complete or incomplete.
A few tips...
- Have a good power supply. Solenoids can pull large currents and cause circuits to "twitch" when activated. D8 and C3 help suppress any voltage fluctuation in the supply.
- To alter the timings, increase R1 to give you more time between switch presses, and adjust R4 to change the time the solenoid is activated for. At pressent it is set to about 2 seconds also.
- You can add more switches by connecting any output via a diode to one side and the other to the clock input, the same as SW1 to 3.
- A code can have two numbers the same sequentially and the circuit will still work. For example 113322.
- To alter the code, reconnect the diodes to different switches - make sure the other side of the switches all go to the clock inputs.
Designed by Phil Townshend 2004