Password based automatic door lock
Security is a prime concern in our day-today life. Everyone wants to be as much secure as possible. An electronic lock allows activation of an electric appliance only on entering the correct password. This is also such an electronic locking system in which PIC16F887A microcontroller plays the role of the central processing unit. The MCU is interfaced with a 4×4 matrix keypad and a 16×2 LCD to form the user interface.
The job of the MCU in this project is to receive signals from the input device (keypad) and take corresponding actions. Whenever any key is pressed on the keypad, the software program in the MCU identifies the pressed key and accordingly turns on or turns off the appliance. Simultaneously, it also displays a message on the LCD screen. The system turns on the appliance on entering a four digit password set by the user and displays message “password accepted” on LCD screen for 2 seconds followed by the message “lock open”. If the entered password is not correct then the message “lock denied” should be displayed on LCD screen for 2 seconds and followed by the message “lock closed”.
The user can also change the password by using corresponding key. Using this circuit any electrical appliance can be made as password protected. It can also be used as an electronic door lock by interfacing the output of the circuit with an electrically actuated door lock.
Block diagram description
The circuit is based on PIC micro controller. It can be divided into five sections: input (4×4 matrix keypad), processing unit (PIC16F877A MCU), appliance controller (relay driver), display (16×2 LCD), and power supply. The PIC16F877A is an 8-bit micro controller. It has 8k×14-bit flash program memory, 368 bytes of RAM and many other internal peripherals like analogue-to-digital converter, USART, timers, synchronous serial port, compare captures and pulse width modulation modules, EEPROM and analogue comparators. The job of the MCU in this project is to receive signals from the input device (keypad) and take corresponding actions. Whenever any key is pressed on the keypad, the software program in the MCU identifies the pressed key and accordingly turns on or turns off the appliance. Simultaneously, it also displays a message on the LCD screen.
A 4×4 matrix keypad is used to give commands and the password to the MCU. It consists of 16 keys arranged in the form of a square matrix of four rows and four columns. Each key in the matrix is labeled according to the operation assigned to it.
A 16×2 LCD is used to display various messages. It also displays an asterisk mark (*) for each digit of the password entered. Control lines EN, RW and RS of the LCD module are connected to pins RA1, RA2 and RA3 of Port A of the MCU, respectively. Commands and the data to be displayed are sent to the LCD module in nibble mode from Port D of the MCU. The higher four data bits of the LCD (D4 through D7) are connected to the lower nibble of Port D (RD0 through RD3) of the microcontroller.
RC2 pin of Port C of the microcontroller is interfaced with the relay driver circuit to switch on or switch off the AC load (appliance). A relay driver circuit is nothing but a simple electronic circuit that drives an electromechanical relay. In this project, a 6V, single-changeover relay is used for switching the appliance ‘on’ or ‘off.’ Whenever the user enters the correct password, RC2 pin goes high. The relay energies and the appliance turn ‘on.’ When RC2 is low, the appliance turns ‘off.’ Free-wheeling diode 1N4007 protects the relay driver circuit from the reverse voltage developed in the relay coil.
The 230V AC mains supply is stepped down to 9V AC using step-down transformer X1. The output from the secondary of the transformer is rectified by a bridge rectifier and filtered by capacitor. The filtered output is regulated by ICs to obtain the required 5V and 6V, respectively.
Relay Driver Circuit