With two integrated circuits and a transistor, it is absolutely possible to build a highly reliable Electronic Lock, to be used to open a door, or activate an alarm, or any other electronic equipment. As you will see, the key consists of a common phone jack.
High-security electronic locks, are becoming more sophisticated, but cost quite expensive. The effectiveness of many systems is often weakened by the ingenuity of thieves, who do not hesitate to buy the most advanced equipment for studying the locks, and thus find a way to hack them.
Here we propose a cost-effective solution based on a personalized electronic key, which is not commercially available and therefore cannot be easily hacked. Despite the fact that the solution we propose is based on a very simple circuit, it exhibits a high degree of security and flexibility.
The electronic circuit
We begin the description of the circuit shown in Figure 1, by starting from the IC1 / A NAND gate. IC1 / A (see Figure 1) is used on a feedback oscillator and produces a square wave output. From IC1’s datasheet, we find that for a supply voltage of 12V, the oscillator frequency will be given by the formula:
Hertz = 1100: (C1 in microfarad x R1 in kilohms)
With C1, R1 being 1uF and 100 kilohms, respectively, the expected frequency of oscillation will be approximately:
1100: (1 x 100) = 11 Hertz
We use the term "approximately" because electrolytic capacitors usually have large tolerances (about 20%).
The signal from the output of the oscillator, is applied to the input of the second NAND gate (IC1 / B), which is used as an inverter and buffer. The output of the inverter is applied to the C2-R2-R4 network, which is actually a filter, and produces some phase shift. The output of the filter is led to one input of the IC2 / A XNOR gate. The output of the oscillator is led to the other input of IC2 / A, via an identical filter. The replica filter is composed of elements C3-R3-R5. However, R3 and C3 are part of the key, and they are not included on the main circuit (lock). An RS latch, consisting of IC1-C and IC1-D gates follows the XNOR gate.
Before continuing, we suggest you study the truth table of the XNOR gate, and also the truth table of the RS latch, that we present in Figure 2.
According to the truth table, the output of the XNOR gate goes to "logic 1" only when both its inputs remain at the same logic state (1-1 or 0-0) simultaneously. Moreover, while the S input of the RS-latch is at logical-1, the Q output of the latch locks on its logic-0 state. Observe also that the C7 can be charged via R7, and can be discharged through the DS1 diode.
On key (R3-C3) absence, one input of IC2 / A will be at "logical 0", as it is grounded through R5. At the same time, the other input of gate IC2 / A, will change continuously from 0 to 1, back to 0, back to 1, and so on, as it is connected to the oscillator. Therefore, the output of gate IC2 / A will be on an unstable condition. The same will be true also for the A output of the latch, and will cause DL1 LED to flash. The B output of the latch will also oscillate and will produce pulses, that they will discharge C7 through DS1. The discharge through DS1 will be faster than charge through R7, and C7 capacitor will remain uncharged. Thus, the output of IC2 / B will remain at logic 0. The outputs of the gates IC2 / C and IC2 / D will also remain at logic 0 and the relay will remain off.
With the key in place, both inputs of IC2 / A will be at the same logic state, so the output of the gate will go at logic 1, and the output A of the latch will switch to logical 0. Then, the DL1 LED will stop blinking, and will be steady on, and at the same time, the output B of the latch will switch to logic 1. In these circumstances, DS1 will be in its cut-off state (off) and C7 will be charged through the R7. Once the capacitor is charged, the output of IC2 / B will go in logic 1. The outputs of the gates IC2 / C and IC2 / D will also go at logic 1 and the relay will be turned-on. As long as the relay remains energized, the DL2 LED will also be at its on-state. Therefore, DL2 indicates that the lock is "unlocked."
Observe that the circuit unblocks only with the correct key. A random key will cause some phase difference to be induced between the input pins of IC2 / A. Thus, both inputs will not be at the same state simultaneously, and the relay will not be energized.
How to build the Simple Electronic Lock
You may assemble the circuit on its printed circuit board, according to the assembly guide of Figure 3. The use of IC-sockets is highly recommended. Firstly, you may solder the IC-sockets, then the resistors, the capacitors, the relay, the LED's, and finally the transistor. Regarding C1, C7, and DL1 and DL2, you should pay some attention in order to place them on the PCB according to their correct polarity.
Please note that the PCB has two jumpers (see Figure 3). One jumper is in the upper right corner of IC2, and the other one is in the upper left corner of IC1. Both jumpers are made from a copper wire.
TR1 must be placed on the PCB, with the flat surface of its body pointing toward the relay. The circuit should be powered from a stabilized source of 12V.
The electronic Key
The Key is made from a male phone jack. R3 and C3 are connected in series and are soldered within the phone jack. Remember that the values of C2-R2-R4 must be identical to the values of R3-C3-R5, otherwise the key will not activate the relay. So, for these specific elements, you must use low tolerance components (1% for resistors and 5% for capacitors). You may use different than the recommended values for C2-R2-R4 but still, the values of C3-R3-R5 must absolutely match. Step by step instructions on how to make the electronic key are illustrated in Figure 4.
Printed circuit board for the Simple Electronic Lock