Specifications

CONSTRUCTION
DIGITAL CODE LOCK
A
versatile digital code lock circuit
is presented here, which can have
up to 32-digit long secret code.
The length of the secret code can be eas-
ily varied by changing the position of
jumpers. The available options are to
make the code 2-, 4-, 8-, 16-, or 32-digit
long. When the keyed-in code matches
with the stored secret code, a relay gets
energised. The contacts of the relay may
be used appropriately to operate, lock, or
unlock any device or appliance, as desired
by the user.
The circuit makes use of a RAM to
store and output the stored code to en-
able in-situ coding and changing of the
code easily. To retain the contents of RAM
in case of power failure and to save power,
a 4.5V battery backup arrangement is pro-
vided, so that the system may operate in
power-down mode with the battery cater-
ing to the retention of only the RAM’s
contents. Thus, the power supply to the
circuit can be switched off to minimise
the power consumption to about 0.6 mA.
The Circuit
Memory organisation. A 6116 static
RAM (2048 x 8-bit) IC5 is used in the
circuit with A9 and A10 address pins con-
nected to the ground. Thus, here we are
effectively using an address space of 512
locations only. This address space of 512
locations is further divided into 16 pages
of 32 locations each. Page selection is done
using 4-way DIP switch S2 in the circuit.
Thus, in each page, an address space of
32 is available for storing the secret code.
Each digit of the code comprises a hex
digit, which can be stored as a nibble,
requiring only 4-bit data space. It is stored
as data bits D4 through D7 in each loca-
tion. Data bits D0 through D3 are not
used and the corresponding pins are
therefore pulled to ground via 10-kilo-ohm
resistor R3. Thus, maximum length of a
code can be up to 32 hex digits. One can,
however, keep one’s secret code spread
over all the 16 pages randomly. For ex-
SRAM 6116 is a volatile type memory.
Therefore battery backup is required to
retain data during power failures. The cir-
cuit around transistor T1, comprising di-
odes D1 through D4, resistors R4 and R5,
capacitor C4, and a 4.5V battery pack
connected to pins 24 and 18 of IC5 (SRAM
6116), allows the changeover of the cir-
cuit to operate in power-down mode dur-
ing power failures. In this mode, the static
RAM chip retains data, while consuming
very little power with as low a current as
0.03 mA to 0.6 mA—depending upon the
chip used. For example, HM611L-5 will
draw 0.03 mA at 2V V
dd (in power-down
mode), as per databook. This gives a long
life to the battery.
Address counter. IC8 (74HC4040) is
a 12-stage binary counter, in which the
five least significant address lines A0
through A4 (for addressing 32 locations)
are sequentially selected on receipt of
clock pulses. Selection for the required
number of hex digits to be used as secret
code can be made by jumpering one of
the output pins (7, 6, 5, 3, or 2) of IC8 to
pin 2 of IC9 (74LS32), using jumper JPN1
for obtaining 2-, 4-, 8-, 16-, or 32-digit
long secret code, respectively.
Keyboard encoding. 16-key key-
board encoder IC1 74C922 from National
Semiconductor is used in conjunction with
a 16-digit keypad for encoding the pressed
key data. It comprises an internal oscilla-
tor for clock generation for its own use
and an inbuilt key debounce circuitry. Ca-
pacitors C2 and C3 connected to its pins
6 and 5 determine the key scanning fre-
quency and debounce period, respectively.
This chip gives a 4-bit data output
from pin 14 through 17, corresponding to
a pressed key. Whenever a key is pressed,
DA (data available) output pin 12 goes to
logic 1, to indicate availability of fresh
data at its output pins (14 through 17).
This pin 12 reverts to its logic low state
when the pressed key is released. The
data outputs of IC1 are tri-state. Its out-
put enable (OE) pin 13 is grounded
through resistor R2 to keep this chip in
enabled state. The DA output signal at
its pin 12 is used for the following func-
tions via the gates of quad NAND Schmitt
IC4 and IC7:
(a) As a clock for 12-stage binary
counter IC8 (74HC4040) via Schmitt
NAND gates N1 and N8, which advances
the counter by one count for every clock.
(b) For sounding of buzzer BZ1 and
BISWAJIT GUPTA
PARTS LIST
Semiconductors:
IC1 - 74C922 hexadecimal
keyboard encoder
IC2 - 74HC244 octal tri-state buffer
IC3 - 74HC688 8-bit comparator
IC4, IC7 - 74HC132 quad 2-input
NAND gate with Schmitt
trigger input
IC5 - 6116 2k x 8-bit SRAM
IC6, IC8 - 74HC4040 12-stage binary
counter
IC9 - 74LS32 quad 2-input OR gate
IC10 - 74LS74 dual J-K Flip-Flop
IC11 - 7805 regulator 5V
T1 - BS170 n-channel MOSFET
T2 - BC548B npn transistor
D1, D2, D5 - 1N4148 switching diode
D3, D4 - 5.1V, 0.25W zener diode
D6 - 1N4001 rectifier diode
D7, D8 - 1N4007 rectifier diode
LED1 - Red LED
LED2 - Yellow LED
LED3 - Green LED
Capacitors:
C1, C3 - 1µF, 10V tantalum
C2 - 100nF ceramic disk
C4 - 470nF ceramic disk
C5 - 10µF, 10V electrolytic
C6 - 2200µF, 25V electrolytic
C7 - 100nF, ceramic disk
Resistors (all ¼-watt, ±5% carbon, unless
stated otherwise):
R1 - 100-kilo-ohm
R2, R3, R5,
R7, R10, R11- 10-kilo-ohm
R4 - 1.5-kilo-ohm
R6, R8, R9 - 470-ohm
R12 - 27-ohm
R13 - 2.7-kilo-ohm
RN1 - 4x10-kilo-ohm resistor net-
work (5-pin SIP)
Miscellaneous:
RL1 - 12V, 500-ohm relay, PCB
mountable
S1 - SPDT switch
S2 - 4-way DIP switch
S3 - Push-to-on switch
BZ1 - 12V DC buzzer with inbuilt
oscillator
X1 - 230V AC primary to 12V-0-
12V, 500 mA secondary
transformer
ample, one can arrange to store an eight
hex-digit secret code as first two digits in
1st page, next three digits in 8th page,
next one digit in 3rd page, and the last
two digits in 14th page.
RUPANJANA
146