DIY Keypad Entry System with PIC16 Microcontroller and Solenoid

By Robin Mitchell

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.

 

Required Materials

 

PIC16 Keypad Entry Schematic

 

PIC16 keypad entry schematic

You can find a full-sized schematic here.

How Does it 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.

 

DIY keypad entry system

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

Recommended Posts

Leave a Comment

70 − 66 =

Start typing and press Enter to search