4×4 keypad Arduino and Save passkey to EEPROM

4×4 keypad Arduino and Save passkey to EEPROM

This tutorial is about interfacing to a 4×4 keypad to an Arduino board, save passkey, retrieve passkey and finally unlock something (something like access control). It is an upgrade to the first post I made some months back on Security access control.

See also:

In this tutorial, our default passkey will not be hardcoded to the code rather it will be saved and retrieved from memory (EEPROM).

EEPROM (also E2PROM) stands for Electrically Erasable Programmable Read-Only Memory and is a type of non-volatile memory used in computers, integrated in microcontrollers for smart cards and remote keyless system, and other electronic devices to store relatively small amounts of data but allowing individual bytes to be erased and reprogrammed.

EEPROMs are organized as arrays of floating-gate transistors. EEPROMs can be programmed and erased in-circuit, by applying special programming signals. Originally, EEPROMs were limited to single byte operations which made them slower, but modern EEPROMs allow multi-byte page operations. It also has a limited life for erasing and reprogramming, now reaching a million operations in modern EEPROMs. In an EEPROM that is frequently reprogrammed while the computer is in use, the life of the EEPROM is an important design consideration.

Let us go ahead and gather our materials. Please note that some of these materials are available in our store:

 

Setup

KeyPad:

I used Arduino pins D22, D24, D26, D28 for the rows and pins D23, D25, D27, D29 for the columns.

 

16×2 LCD:

I used Arduino pins D43 = RS, D41 = EN, D39 = d4, D37 = d5, D35 = d6, D33 = d7

 

Relay Module:

I used Arduino Pin D30 = Relay in pin

 

How the System works

The system boots up and asks for passkey, when the user enters the correct passkey it will unlock (the relay will switch). if the passkey is incorrect, the attempts will be incremented and if it is up to 3. The lock will freeze, only the correct passkey will unfreezed it. Pressing key A will enter the update passkey mode but this mode won’t work if it is freezed. Pressing key # clears the key and any previous pressed key and pressing the * key will automatically lock the lock again.

 

Code

Download Code from Github

 

Results

opened - steinacoz
opened – steinacoz

 

locked - steinacoz
locked – steinacoz
locked - steinacoz
locked – steinacoz

 

 

Did you enjoy this post? Feel free to drop your comments and follow our Social media channels for tutorials like these.

 

Leave a Reply

Your email address will not be published. Required fields are marked *