942

27

2

Published

There are numerous websites that have posted this project & it is present on various youtube channels , and maybe even this website has a few of these. But I'm making an effort here to explain this in a simpler and more informative manner.

Password based door lock can be implemented in your home and work place to secure your personal belongings.

So, let's get started.

Hardware components:

• Arduino UNO
• Texas Instruments Dual H-Bridge motor drivers L293D
• Linear actuator

Step 1: Understanding the Keypad Construction

The major component of this project is the matrix keypad. I have used a 4x4 membrane keypad which looks like this shown above.

The keys on the keypad are basically push buttons. These button switches are 'closed' when pushed and once the force is released, they go back to their natural state i.e. 'open'

The image shows how the keypad is connected internally as rows and columns. When, suppose, 1 is pressed, column 1 and row 1 are connected together. When 9 is pressed r3 and c3 are connected together.

Step 2: Scanning the Keys on Keypad

Scanning is done with 4 keys configured as outputs and 4 keys as inputs. I made all the columns the inputs using input pullup resistors, and all the rows the outputs. Using programming, all the rows are made LOW one by one, multiple times in a second. So, when a key is pressed, the corresponding column becomes LOW. The state of the input pins to which all the columns are connected, is read, multiple times. Whenever a LOW state is read, it means that a key in that column is pressed. If a certain row is low and at the same time a certain column is low, then the pressed key is determined.

For e.g. if 1 is pressed, column 1 will be low. And since each row is made LOW so so fast, one by one, even if you press the key for a very short span, row 1 will be found LOW sometime and it will be determined that 1 is pressed. If row1==low && column1==low, it means that 1 is pressed.

This is shown in code 1. I wrote this code myself because I wanted to upload it to stm32 board and the KEYPAD library wasn't compatible. With this code, you'll understand what I explained above. Or you can simply use the keypad library and run the 'customkeypad' example. Both will serve the same purpose. But that code won't explain you the working.

Step 3: Schematics

Construct the circuit using the above schematics and diagram.

When you press the correct password, the linear actuator activates and unlocks.

Step 4: Working Demo

Using serial monitor, each key that is pressed is displayed on the screen. This is shown in video 1.

After the key determination works fine, its time to work on the password. Its so simple. What I did was - made a string "1234". This is the password that I had set. Now, I made another array. Whatever the key value is, its stored in this array. When count reaches 4, both the strings are compared. If they match - the password is correct, else not. This is shown in code 2. I connected an LED to the pin 11. So, that when the password is correct, it glows. It is shown in video 2. Now, the component that will be used as the lock: 12 V linear actuator. It looks like this.

This is operated using L293d IC which is otherwise commonly known as the 'motor driver' IC. This IC is conected to the 12v supply. It takes inputs from the Arduino i.e. 5v input, and outputs 12v to its output pins (to which the actuator is connected). So, when the password is correct, pin 11 is set high and pin 12 is set low. Pins 11 and 12 are connected to the inputs of the l293d. Hence, the actuator is pulled inside and the door opens. shown in video 3.

Recommendations

• Arduino Class

69,947 Enrolled

• Planter Challenge

We have a be nice policy.