Wednesday, August 6, 2008

Digital Combination Lock

The circuit above above makes use of the CMOS 4017 decade counter IC. Each depression of a switch steps the output through 0 - 9. By coupling the output via an AND gate to the next IC, a predefined code has to be input to create the output. Each PBS switch is debounced by two gates of a CMOS4001 quad 2-input NOR gate. This ensures a clean pulse to the input of each CMOS 4017 counter. Only when the correct number of presses at PBS A will allow PBS B to become active. This is similar for PBS C and PBS D. At IC4, PBS D must be pressed 7 times. Then PBS C is again pressed 7 times, stepping from output 1 to output 8. The AND gate formed around CMOS4081 then goes high, lighting the LED. The Reset switch can be pressed at any time. Power on reset is provided by the 100n capacitor near the reset switch.

Electronic Keypad

The IC is a quad 2 input "AND" gate, a CMOS 4081. These gates only produce a HIGH output, when BOTH the inputs are HIGH. When the key wired to 'E' is pressed, current through R1 and D1 switchs Q5 on.The relay energises; and Q5 is 'latched on' by R8. Thus, the Alarm is set by pressing a single key,say one of the two non-numeric symbols.

The alarm will switch off when the 4 keys connected to "A,B,C,D" are pushed in the right order.The circuit works because each gate 'Stands' upon its predecessor.If any key other than the correct key is pushed, then gate 1 is knocked out of the stack, and the code entry fails. Pin 1 is held high by R4. This 'Enables' gate 1; and when button 'A' is pressed, the output at pin 3 will go high. This output does two jobs.It locks itself 'ON' through R2 and it 'Enables' gate 2, by taking pin 5, high. Now, if 'B' is pressed, the output of gate 2, at pin 4 will go high. This output does two jobs. It locks itself 'ON' through R3 and it 'Enables' gate 3 by taking pin 12 high.
Now, if 'C' is pressed, the output of gate 3 will lock itself 'ON' through R5 and, by taking pin 8 high, 'Enable' gate 4. Pressing 'D' causes gate 4 to do the same thing; only this time its output, at pin 10, turns Q4 'ON'. This takes the base of Q5 to ground, switching it off and letting the relay drop out. This switches the alarm off.

Any keys not connected to 'A B C D E' are wired to the base of Q1. Whenever 'E' or one of these other keys is pressed, pin 1 is taken low and the circuit is reset. In addition, if 'C' or 'D' is pressed out of sequence, then Q2 or Q3 will take pin 1 low and the circuit will reset. Thus nothing happens until 'A' is pressed.Then if any key other than 'B' is pressed, the circuit will reset.
Similarly, after 'B', if any key other than 'C' is pressed,the circuit will reset. The same reasoning also applies to 'D'.
The Keypad needs to be the kind with a common terminal and a separate connection to each key. On a 12 key pad, look for 13 terminals. The matrix type with 7 terminals will NOT do. Wire the common to R1 and your chosen code to 'A B C D'. Wire 'E' to the key you want to use to switch the alarm on. All the rest go to the base of Q1.

The diagram should give you a rough guide to the layout of the components, if you are using a stripboard. The code you choose can include the non-numeric symbols.In fact, you do not have to use a numeric keypad at all,or you could make your own keypad.
I haven't calculated the number of combinations of codes available, but it should be in excess of 10 000 with a 12 key pad; and, after all, any potential intruder will be ignorant of the circuit's limitations. Of Course, if you must have a more secure code, I can think of no reason why you shouldn't add another 4081 and continue the process of enabling subsequent gates. Or you could simply use a bigger keypad with more "WRONG" keys.
Any small audio transistors should do. The 27k resistors could be replaced with values up to 100k. And the only requirements for the 4k7 resistors is that they protect the junctions while providing enough current to turn the transistors fully on.
Capacitors (C1 C2 C3 C4 C5) are there to slow response time and overcome any contact bounce. They are probably unnecessary.

Electronic Doorbell with Counter

This circuit uses a synthesized sound chip from Holtek, the HT-2811. This reproduces the sound of a "ding-dong" chiming doorbell. Additionally, the circuit includes a CMOS 4026 counter display driver IC to count your visitors.

Circuit Notes:
The Holtek HT-2811 is available from Maplin electronics in the UK, order code BH69A. The operating voltage must remain within 2.4 to 3.3 Vdc and standby current is minimal. The reset switch zeroes the count,and the 7 segment display is a common cathode type. To save power consumption the display can be enabled or disabled with a switch as shown in the above diagram. The count will still be held in memory. The IC pin out for the 4026 is shown in pin order below:

Pin 1 is the clock input
Pin 2 is the clock enable
Pin 3 is display enable
Pin 4 enables the carry output
Pin 5 is the carry output
Pin 6 is display segment f Pin 7 is display segment g
Pin 8 is 0 V.
Pin 9 is display segment d Pin 10 is display segment a
Pin 11 is display segment e Pin 12 is display segment b
Pin 13 is display segment c Pin 14 is the2 output
Pin 15 is reset
Pin 16 is +Vcc

The envelope of the chime is set by the 220k, 330k, 3u3 and 4u7 resistors and capacitors. These values are the manufactures default values, but may be adjusted to alter the length and delay of the chime.The combination of the 2k2, 22k and 47u resistor capacitor network has a double function. It provides a debouncing circuit for the bell press and at the same time has a sufficiently long time constant. This ensures that anyone rapidly pressing the doorbell switch, only advances the count once.The 47u capacitor may be increased in size, if needed.

Circuit Expansion:
The count may be expanded for up to 99 visits by cascading two CMOS 4026 IC's and using an additional 7 segment display. This is achieved by wiring pin 5 ( the 10's output ) of the first CMOS4026 to pin 1 (the clock input) of the second IC.

Transistor / Diode / IC (DIP) Outlines

Generating -5 Volts From a 9 Volt Battery

A 555 timer can be used to generate a squarewave to produce a negative voltage relative to the negative battery terminal. When the timer output at pin 3 goes positive, the series 22 uF capacitor charges through the diode (D1) to about 8 volts. When the output switches to ground, the 22 uF cap discharges through the second diode (D2) and charges the 100 uF capacitor to a negative voltage. The negative voltage can rise over several cycles to about -7 volts but is limited by the 5.1 volt zener diode which serves as a regulator. Circuit draws about 6 milliamps from the battery without the zener diode connected and about 18 milliamps connected. Output current available for the load is about 12 milliamps. An additional 5.1 volt zener and 330 ohm resistor could be used to regulate the +9 down to +5 at 12 mA if a symmetrical +/- 5 volt supply is needed. The battery drain would then be around 30 mA.

555 Tone Generator (8 ohm speaker)

This is a basic 555 squarewave oscillator used to produce a 1 Khz tone from an 8 ohm speaker. In the circuit on the left, the speaker is isolated from the oscillator by the NPN medium power transistor which also provides more current than can be obtained directly from the 555 (limit = 200 mA). A small capacitor is used at the transistor base to slow the switching times which reduces the inductive voltage produced by the speaker. Frequency is about 1.44/(R1 + 2*R2)C where R1 (1K) is much smaller than R2 (6.2K) to produce a near squarewave. Lower frequencies can be obtained by increasing the 6.2K value, higher frequencies will probably require a smaller capacitor as R1 cannot be reduced much below 1K. Lower volume levels can be obtained by adding a small resistor in series with the speaker (10-100 ohms). In the circuit on the right, the speaker is directly driven from the 555 timer output. The series capacitor (100 uF) increases the output by supplying an AC current to the speaker and driving it in both directions rather than just a pulsating DC current which would be the case without the capacitor. The 51 ohm resistor limits the current to less than 200 mA to prevent overloading the timer output at 9 volts. At 4.5 volts, a smaller resistor can be used.