This circuit uses two comparators that are combined in what is called a window comparator, i.e. resistors R2, R5, and R10 determine a voltage window within which the voltage applied to the junction of D2 and D6 must lie in order for the outputs of IC2. A and IC2.B to both be high at the same time. Given the value used for these resistors, this window is from 10/21 to 11/21 of the comparator supply rail (5 V). If IC2.A and IC2.B outputs are both high at the same time, transistor T1 is saturated via the AND gate formed by D3 and D4, and relay RE1 is energized to operate the electric latch or any other locking device. The key is defined by the generation of the specific voltage at the junction of D2 and D6, formed, for example, by a simple stereo jack containing the two resistors R4 and R8.
Together with R1 and R9, they form a potential divider that needs to be suitably calculated in conjunction with the values of R2, R5, and R10 so that the key can open the lock. Clearly, all this will only work correctly is the supply voltage to these two dividers is stable, which is ensured by IC1, regulating it to 5 V. If we had set the values for R1 and R9, all the readers of this edition of Elektor would have had the same key, which is clearly not a good idea! So you need to decide for yourself not only R4 and R8, which form the key, but also R1 and R9 which let you customize the ‘lock’. Here are the relationships between the values of resistors R1, R4, R8, and R9 for the key to be able to open the lock:
10 · R8 · R9 < 11 · (R1 + R4) · (R8 + R9)
10 · (R1 + R4) · (R8 + R9) < 11 · R8 · R9
Given the size of the window formed by R2, R5, and R10, 5 % tolerance resistors are adequate.
Note too that, as the relationships consist of inequalities, and that there are only two (un)equations for four unknowns, this leaves quite a wide choice for the resistor values. We advise you to set at least two of them to preferred values, which will then let you work out the others. If, as is more than likely, this does not result in other preferred values, you’ll then need to use series/parallel combinations to obtain the calculated values — or else choose different starting values in order to arrive at a better compromise. www.elektor.com/081177