Digital Code Lock using Arduino

Digital code lock systems are most common on security systems. An electronic lock or digital lock is a device which has an electronic control assembly attached to it. They are provided with an access control system. This system allows the user to unlock the device with a password. The password is entered by making use of a keypad. The user can also set his password to ensure better protection. The major components include a keypad, LCD and the controller Arduino. This article describes the making of an electronic code lock using arduino.

What you will learn?
  1. How to connect keypad and LCD to arduino?
  2. How to take keypad input?
  3. Comparing keypad input?
  4. Limiting the input?
  5. How to make complete digital code lock application?
Components Required
  1. Arduino Uno
  2. 16×2 LCD Display
  3. 4×4 keypad
  4. Relay
  5. 1K Resistors Qty. 3
  6. BC548
  7. LEDs

Digital Code Lock Circuit

Code lock circuit is constructed around arduino uno, using LCD and keypad. LCD and keypad forms the user interface for entering the password and displaying related messages such as “Invalid password”, “Door open”, etc. Two LEDs are provided to indicate the status of door whether it is locked or open.

Arduino Code Lock Circuit
Arduino Code Lock Circuit

Digital Code Lock Arduino Code

                Program is constructed using two libraries “LiquidCrystal” and “Keypad”. Program have different modules, Setup, Loop, Lock. In setup we initialize all the IO connections and LCD, Keypad. In main loop we are taking pressed keys in array “code[]”, Once the four digits are entered we stop accepting keys. We are using numeric keys and ‘C’ , “=” key. ‘C’ key is used to lock or clear the display in case wrong password is entered. We can hide the entered password by putting  Star character ‘*’.

                After entering password ‘=’ key acts as ok. If password is correct door is kept unlocked for few seconds. If it is incorrect message will be displayed.

Conclusion

This code demonstrates how to construct digital code lock and its application using arduino.

We have used almost all the IO lines of arduino, now you know that analog lines have digital numbers from 14 to 19.

Leave a Reply

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