Maker Pro
PIC

Keypad Entry System With PIC16 Microcontroller and Solenoid

April 03, 2017 by Robin Mitchell
Share
banner

Build a 12-key keypad entry system that only unlocks itself when the correct passcode has been entered.

Tools

3 5.6K Resistor
5 100K Resistor
2 100nF Capacitor
1 100uF Capacitor
15 1N4148
1 1N5817 Diode
2 2N3904 Transistor
1 5V Solenoid

Hardware

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 Circuit

The 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.

Completed system with solenoid

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:

DIY Keypad Entry System Files

Author

Avatar
Robin Mitchell

Graduated from the University Of Warwick in Electronics with a BEng 2:1 and currently runs MitchElectronics.

Related Content

Comments


You May Also Like