Wednesday, March 20, 2013

Electronic Code Lock

Nowadays, electronic code locks are usually based on microcontrollers. However, if you like your electronics discrete, you will enjoy the battery-operated circuit shown here. Since the circuit automatically switches off after the door has been opened and draws no current in the idle state, three alkaline batteries (mignon, AA or R6 cells) are good for around 5,000 door openings. The main advantage is that the door opener can also be powered from the battery, so it’s not necessary to run any extra cables.
Project  Image :
Electronic Code Lock-Schematic-Circuit-Image
Electronic Code Lock Schematic Circuit  Image
Figure 1 shows the schematic diagram of the circuit, which is split into two parts. The first part is the control panel, which consists of a 12-position keypad and two LEDs. The second part is the programming and evaluation logic, which contains only standard logic ICs. The control panel is connected to the logic board by a 16-way flat cable. The keypad circuit is laid out with separate connections to the individual switches, instead of a matrix. The code is programmed using the two pin connector strips K1 and K2.  The circuit allows any desired combination of numbers to be used for the code, up to a maximum of 9 positions. Press-ing a particular button, which in principle is random but which naturally must be specified in advance, awakens the circuit from the zero-current idle state. This Start button cannot be used in the subsequent code sequence. The Start button is programmed by connecting a wire bridge from the associated pin of K2 to pin 1 of K1.  The code sequence is programmed in a similar manner. The first numeral of the code is programmed by connect-ing the associated pin of K2 to pin 2 of K1, the connection for the second numeral is made to pin 3 of K1, the third to pin 4 and so on. Numerals that are not used in the code do not actually have to be connected. However, if the unused buttons are connected to VDD, the code lock will assume that an error has occurred if any of these buttons is pressed and will reset the circuit. Pressing the Start button switches on transistor T1, which connects the supply voltage source to the code lock. This is indicated by the yellow LED (D20).
Circuit diagram :
Electronic Code Lock-Schematic-Circuit -Diagram
Electronic Code Lock Schematic Circuit Diagram
Part List :
Resistors :
R1,R2 = not fitted
R3 = 220kΩ
R4,R5 = 1MΩ
R6 = 220kΩ
R7,R9,R10,R17 = 100kΩ
R8,R12,R14 = 2MΩ2
R11 = 560Ω
R13,R15,R20 = 1kΩ5
R16 = 100kΩ
R18 = 120Ω
R19 = 10k
R21-R24 = 3Ω3
R25-R35 = 22kΩ
Capacitors :
C1,C6,C7,C8,C10 = 100nF
C2,C3,C5 = 10nF
C4 = 1µF
C9 = 330nF
C11 = 47µF 16V radial
Semiconductors :
D18 = 1N4148
D10,D12 = zener diode 1V2
D16 = 1N4001
D19 = LED, green
D20 = LED, yellow
T1 = BC327
T2,T3,T4 = BC337
T5 = BD140
IC1 = 4017
IC2,IC3 = 4069 or 40106
Miscellaneous :
JP1 = jumper
K1,K2 = 12-way pinheader or
wire links
K3,K4 = not required (ribbon
cable )
K5, K6 = 2-way PCB terminal
block, lead pitch 5mm
S1-S12 = pushbutton with
make contact
Since the logic ICs are now enabled, the output of IC3f will be High, so T2 also conducts and pulls the base of T1 to ground. This means that the Start button can be released without affecting the circuit. However, C11 can now slowly charge via the high resistance of R12 until the voltage at the inverter input is high enough to cause its output to go Low, which interrupts the supply voltage to the circuit and puts it back into the idle state. The valid code must therefore be entered during the time interval determined by this R–C time constant. Once the supply voltage is disconnected, C11 discharges rapidly via D18. This is important, since other-wise C11 could retain its charge for a long time. This would make the time allowed for entering the code significantly shorter the next time the lock is used.  Pressing the Start button also has other consequences. Via the Start switch, ground potential arrives at IC2d, where it causes a pulse to be generated that places counter IC1 in a defined state (Q0 = 1) prior to the entry of the first code numeral. The first code numeral can now be entered. If the correct button is pressed, the High potential from Q0 passes through the closed switch to reach IC2d–IC2a. This net-work generates a positive pulse at the instant that the but-ton is released. This pulse clocks the counter, so that the High level from Q0 moves by one position to Q1. This process repeats itself until all code numerals have been entered.
PCB Layout :
Pcb Lyout
Electronic Code Lock Schematic PCB Layout
After the ninth numeral has been entered, the positive volt-age jumps to Q9, where it charges C4 (if jumper JP1 is installed). While C4 is charging, the output of IC2e goes Low for approximately two seconds, and the output of IC3d goes high for the same interval. Power transistor T5 is switched on via R19 and T4 to supply current to the door opener. At the same time, IC3a switches on the green LED (D19) to indicate that the door can be opened. T3 limits the current through the door opener to around 700 mA. Once C4 is sufficiently charged, the output of IC2e changes to High. Not only does this switch off the door opener, but the positive edge also generates a pulse in the network IC2f/IC3c that passes through D14 to reach IC1 as a reset pulse (D14, D17 D13 and R7 together form a ‘wired-or’ gate). Inverter IC3b also provides the power-up reset to the counter. The reset signal places the circuit back into its initial state. What happens if an incorrect button is pushed? In such a case a Low level is passed through in place of the High level from the counter output. This has the same consequence as the Low level from the Start button: the counter is reset.
Note that you can also modify the circuit to use fewer than nine numerals for the code. All that is necessary is to connect C4 via a jumper to another counter output in place of Q9 (for example, to Q4 for a four-position code). The diode at the selected output of the counter can be replaced by a wire jumper, and the ‘higher level’ diodes can also be omit-ted. The active ‘on’ time of the door opener is 2 s. If this seems to be too short, the value of R8 or C4 can be increased. However, this also increases the amount of power drawn from the battery, especially considering that the door opener is by far the biggest power glutton in the circuit. In order to integrate the circuit into an existing door opener or to use it to operate an ac door opener, you should connect a relay to K5. Before assembling the circuit using the printed circuit board shown in Figure 2, you should separate the two sections by sawing between K3 and K4. The logic board should not be fitted directly behind the pushbuttons for entering the code. Instead, it is better to separate the entry pushbuttons, the LEDs and the door opener from the logic circuit board with a length of cable. Otherwise, a screw driver or a bit of wire connected between the emitter and collector of T5 is all that is needed to outfox the code lock and open the door.
Fitting the components to the circuit board should not be difficult. The ICs can be mounted in sockets. The author used 4049 inverter ICs, but in the Elektor Electronics lab prototype we used 4069’s, which are functionally compatible but not pin-compatible, and we also tried a 40106, which has Schmitt-trigger inputs. With a 4069, normal 1N4148 diodes can be used for D10 and D12. The best solution is to use the relatively noise-immune 40106. However, it is then necessary to use Zener diodes for D10 and D12, due to the higher threshold voltage. A 3.3-V type is ideal with an operating voltage of 15 V. There is one thing you should not overlook: with low-voltage zener diodes, the band on the package marks the anode instead of the cathode, as you would normally expect. At least, this is true in most cases, but not always.
Author : R. Heimann - Copyright :  Elektor Electronics

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.