The heart of the circuit is a 4022 octal counter. When first powered up, C2 is charged via R5, so the reset input of the couitter is kept high. That causes output Qo to go high while all other outputs are low. With the switches wired as shown, when 54 is pressed, the BS170 is switched on via de-bouncing network R2/C1, and U1 receives a clock pulse. Also, C2 is discharged via R4 and D1 removing the reset signal of the counter, allowing it to advance. The time required for C2 to charge via R5 (e.g., to reset the counter), is the maximum time that can lapse before the next key is pressed.The above cycle is therefore repeated only if S8 (connected to the Q1 output) is pressed in time.When all keys have been pressed in time and in the correct order, Q7 goes high for about four sec-onds to drive the "unlock" circuitry (e.g., a relay driver for an automatic door opener. A builder can change the code by reviewing the switches. The code for the lock shown in the circuit diagram is 4-8-0-1-5-7-0. However, the 4022 octal counter can be replaced by a 4017 divide-by-10 counter. That will make it possible to add two more digits to the combination.