Saturday, 9 September 2017

Keypad Door Lock using AVR Microcontroller – Atmega16

Password Based Keypad Door Lock  In this article, a digitally secured lock based on password verification is explained. The system uses a seven segment display array to show the password, a matrix keypad to enter the numbers/password and operates a relay (to activate the solenoid valve) for locking and unlocking purpose. The system alarms through a buzzer if a wrong password is entered for 3 times continuously and an SMS is sent to a predefined contact number. The password can be changed whenever required, but only after correctly entering the present password. The password is stored in the EEPROM of the microcontroller so that, power failure or reset of the system does not affect the password recognition. Circuit Diagram  The system contains a seven segment display array, a 4X4 matrix keypad and a GSM module to send the status message. Based on these requirements, any microcontroller with 3 I/O ports and one UART peripheral is sufficient. In this article ATMEGA16 microcontroller is used. The circuit is developed using the Proteus Simulation software to demonstrate the operation. There is a real-time feature called the ‘Virtual Terminal’ in this software which is used in this article to send the SMS through a GSM Module connected to the computer.   The circuit diagram for connecting the GSM module to the computer is shown below. A detailed explanation on this procedure is provided in the article, “Virtual Comports in Proteus”.   The Matrix Keypad  In this circuit, a 4X4 matrix keypad is used to enter the password and to interact with the system. A function called the ‘get_key’ function is used to read the pressed key and this key information is passed to the ‘run_key_function’ which is a ‘switch statement’ with 16 cases, and is assigned with one case for each key. As there are 16 keys in the keypad, key value ranges from 1 to 16 and by default, the key value is set out of this range during initialization of the key variable. The ‘get_key’ function refreshes the columns and reads the rows for detecting the pressed key (if any). Whenever a key is pressed this default value is replaced by the currently pressed key. Now, the ‘run_key_function’ is executed and corresponding statements for the pressed key are executed. After execution of these statements, the display function is called until the pressed key is not released. Soon after the key is released, again the key value is set out of range. Below is the program code for the functions ‘get_key’. The ‘get_key’ function can be easily modified for keypads other than the 4X4 matrix.     The Display  As the password is of four digits, four seven segment LED’s are multiplexed. There is an option to show/hide the password while entering. The display function presented in this article uses one for loop and it can be modified easily if the number of digits is varied. If the show option=1 then digits are shown as they are and if show option=0 then the ‘G’ segment of the displays is enabled instead of the entire digit. The program code for the display function is shown below.   The entered number is read and stored in the form of an array so, each digit of the number is sent to the display array after enabling the corresponding digit. Here, the show/hide option is read and data is sent depending on the value of the ‘show’ variable as discussed above. The ‘clear’ key is used as the backspace to clear the last entered key. When this clear key is pressed the array index is decremented by...
read more

The post Keypad Door Lock using AVR Microcontroller – Atmega16 appeared first on Electronic Circuits and Diagram-Electronics Projects and Design.

No comments:

Post a Comment

Tiny, wireless antennas use light to monitor cellular communication

Researchers developed a biosensing technique that eliminates the need for wires. Instead, tiny, wireless antennas use light to detect minute...