This is a simple but effective code lock circuit that has an automatic reset facility. The circuit is made around the dual flip-flop IC CD4013. Two CD 4013 ICs are used here. Push button switches are used for entering the code number. One side of all the push button switches are connected to +12V DC. The remaining end of push buttons 2,3,6,8 is connected to clock input pins of the flip-flops. The remaining end of other push button switches are shorted and connected to the set pin of the flip-flops.
The relay coil will be activated only if the code is entered in correct sequence and if there is any variation, the lock will be resettled. Here is correct code is 2368. This makes the lock open for a fixed amount of time and then it locks automatically. The time delay can be adjusted by varying the values of resistance and capacitance.