Build a 12-key keypad entry system that only unlocks itself when the correct passcode has been entered.
|3||5.6K Resistor (R1, R7, R8)|
|5||100K Resistor (R2, R3, R4, R5, R6)|
|2||100nF Capacitor (C1, C3)|
|1||100uF Capacitor (C2)|
|15||1N4148 (D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14, D15)|
|1||1N5817 Diode (D16)|
|2||2N3904 Transistor (Q1, Q2)|
|1||7805 Linear Regulator (U1)|
|1||Micro Switch (S9)|
|13||Tactile Switch (S1, S2, S3, S4, S5, S6, S7, S8, S10, S11, S12, S13)|
|1||5V Solenoid (L1)|
|1||5V Buzzer (BZ1)|
Nothing is more irritating than someone going through your cupboards or your personal space. If you (like myself) feel that it needs to stop then worry no more! In this project, you will learn how to build a 12-key keypad entry system that only unlocks itself when the correct passcode has been entered.
PIC16 Keypad Entry Schematic
How Does the Keypad Entry System Work?At the heart of the circuit is the PIC16F84 (but this could also be the PIC16F88 or the PIC16F819) which reads the key presses, and controls the solenoid and the beeper. Each key has a diode to prevent multiple key presses from causing interference and the microcontroller scans one row at a time. When the microcontroller detects that the enter key has been pressed it will check to see if the entered code is equal to the passcode. If the code matches the system, it activates the solenoid and this allows for the door, cupboard, or whatever you want to lock to open. The system releases the solenoid only when the micro switch has been activated, which is used to detect when the door has been closed.
When buttons are pressed, the microcontroller also makes a short beep occur on the buzzer. If the wrong code is typed, the buzzer will make 3 beeps to indicate that the code is incorrect. If the code is correct, the beeper makes 9 short beeps and engages the solenoid to indicate success. The power regulation circuitry is provided by a 7805 with all the needed reverse protection, EMF protection, and smoothing. The buzzer and solenoid are also in parallel with diodes to prevent damage from occurring to the transistors that control them.
Constructing the DIY Keypad Entry System CircuitThe project shown here uses a custom PCB made on a milling machine. However, this project can just as easily be made on a breadboard or stripboard for those who do not wish to use a custom PCB. If you intend to build this project is for security, the keypad should be separate from the main controller. This is to prevent individuals from potentially hacking the circuit by forcing the solenoid to open.
The micro switch needs to be mounted in a location such that when the door or cupboard is closed, the micro switch is activated. This is so the controller can deactivate the solenoid and relock the system. When using the PIC16 key entry system, it may be a good idea to build in a backup power supply or a method for activating the solenoid in case something goes wrong with the code or circuit. You can find the ASM and KiCad files below: