The secret key is a way to get a piece of equipment can only be activated if the provided buttons are pressed in the proper order. We will use the AND gate to make the equipment work like this.

And the gates are electronic circuits that have a minimum of 2 pieces of inputs and one output. The output of this gate will only become 1 if all inputs are 1. If either of the input value is 0, then the output would be 0 even though all other inputs are 1.
“0” and “1” in the logic circuit is translated as follows. “0” is the voltage closer to 0V (no need to be 0V). While the “1” is the voltage that is closer to the voltage supply (not necessarily equal to the voltage supply). There are limits how high the voltage will be 0 and how low the voltage will be considered as 1. In addition, the supply voltage which may be used also have limitations. For TTL families, we only may use 5V voltage. While for CMOS, the voltage that can be used have a wide range.
And with the nature of the AND gate where the output will become 1 only if all of input value are 1, we can arrange a chain of AND gates to form the secret keys as follows:

C1 will ensure that when the circuit first turned on, an input of U1A is 0 because they are attracted to the ground. Thus, the output of U1A is also definitely 0. With the feedback using R2 10K, then the other input of U1A also will be 0. Thus, although after a few moments then C1 will contain a charge that causes the input that connects to C1 U1A become 1, because the other input is still valued 0, then the output of U1A will also remain 0.
The output of U1A is connected as input of U1B. If the output of U1A is still 0, then the output of U1B will be maintained to remain 0. So it is with U1C and U1D.
If we press the S2 button, then all the input U1A become 1. And from the feedback R2, then this state will be retained even though the S2 has been released again.
U1B output remains 0. But if we press the S3, so this time U1B has allowed for the output to become 1. Events like this also applies to U1C and U1D. Thus, in order U1D output can be 1, then we have to press buttons in sequence from S2, S3, S4, and S5.
The output of U1D used to activate the relay uses an NPN transistor. If the output of U1D is low (0), then the transistor will be OFF and the relay will be inactive. If U1D high (1), then the transistor will be ON and the relay will be active.
To reset the state to the initial state, press the S1 button. If the button S1 is pressed, then one input of U1A will has the value of 0. Thus the output will be 0. This situation will be locked with the R2 feedback. The return of output of U1A to 0 causes the output of U1B also 0. And so on until the output U1D.
Examples of the above circuit is not a good design of the secret keys circuit. Actually we do not have to press buttons in sequence from S2 to S4. We simply press the four buttons simultaneously or alternately by pressing it repeatedly while avoid pressing the S1 button. The good news is that we can put those buttons at random and no one knows which button is the button S1 besides us.
Although the design of the secret key is not a good design, but this design will be able to give a good overview to understand how we take advantage of AND gate.
And that it must be remembered, the AND gates used must be a CMOS ❗ One example is 4081.
numpang copy pak, untuk belajar saya dan siswa, trims
nand ttl ga papa,tambahin ic ULN…hehehe