Diy Passcode Lock System Using Arduino

Introduction: Diy Passcode Lock System Using Arduino

About: Like to learn and do electronics and hardware stuffs

Hi guys how are you ?

i hope you are fine !

Have you saw Passcode lock system in some homes?

It helps to keep our home secured !

I'am also saw one in my neighbour's house. He bought it few days ago. I really need one like that . But it is little bit expensive for me. So i decided to make one.
The market cost of a passcode lock system that doesn't have a LCD display is about 70$. I thought, it is better to make one rather than buying one . Also it is super easy and cheap to make . I'am only spend 10$ for the whole project

I referred so many instructable to make a good one . Also made some more features in my passcode lock system like automatic LCD back light turn off.

The main feature of my passcode lock system is accessed the EEPROM for keep the password when resetting the code.

This lock system can be use for to control your home appliance like TV, Refrigerators

or your computer. I used this for controlling the garage power supply in my house.

Well , I'am not boring you . lets start to make .

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.


First we need ro collect all the parts that we need to do this project. the parts list is given below.

Here are the parts you need to collect :

  • Arduino Uno or mega( else make a Diy Arduino from here)
  • 16x2 LCD display.
  • 4x4 Metrix keypad.
  • Relay module 2nos.(make a diy relay from here)
  • 10k potentiometer.
  • LEDs( blue,red, green).
  • PIR motion sensor.
  • 5 volt power supply module.(better to make one yourself from here)
  • General purpose PCB.
  • "10"mm thickness Foam board sheet(1sq feet).
  • Male to Male jumper wire.
  • Male to Female jumper wire.
  • Header pins(male and female).
  • Buzzer

Other tools and parts used in this project :

  • Soldering iorn.
  • Soldering wire.
  • Soldering flux.
  • Hookup wire.
  • Instant adhesive glue.
  • Utility knife.
  • Some small screws for mounting the Arduino and other modules.
  • A Box to Put your Arduino and other electronics or use a foam board sheet to make one yourself.


  • Arduino IDE.

i think that's all we needed.

After collecting everything lets go t the next step.


The LCD display is a essential part of our passcode lock . Every instruction from the Arduino will shown in the LCD display.

So,First we need to make a custom LCD display PCB board . It will help us to reduce some space in the enclosure and some jumper wire.

Before making the board note some instructions:

• The cathode of the LCD display not connecting directly to the power,we need that to automatic LCD backlight dim.
• Don't give more than 5 volt to the break out board, else your LCD display damage.
• Always double check the connections for any wrong wiring.

Make the LCD display break out board:

1. Firstly take a general purpose PCB then clean the copper side well.
2. After that rub some soldering flux on the copper surface.
3. Then mount the components and solder it.
4. After soldering everything connect the components each other as shown in the schematics.
5. Then clean the existing soldering flux.

We made the custom LCD PCB board, Now its time for inspecting the board for any short circuits and wrong connections . Any wrong connection you make will affect the LCD, almost your LCD will damage.

Also give 5 volt (5 volt is the maximum ) , If you give more than 5 volt then you can throw the LCD display to waste bin .

I almost thrown 2 or more LCD display by giving more than 5 volt :(

careful about that.!

If everything fine , we can jump to the next step !


Now its time for wiring the Arduino. See the above images and carefully connect all the parts to the Arduino.

I used Two male jumpers to connect the keypad to the Arduino as shown in the above images.

The PIR motion sensor,relays are connected directly using some jumpers.

It is pretty east to connect not much complicated wiring.

You can use the above diagram to connect the parts. Here i will explain by parts :

  • LCD display RS pin to Arduino D13.
  • LCD display E pin to Arduino D12
  • LCD display D4 pin to Arduino D11
  • LCD display D5 pin to Arduino D10
  • LCD display D6 pin to Arduino D9
  • LCD display D7 pin to Arduino D8
  • LCD +ve pin to Arduino 5 volt
  • LCD -ve pin to Arduino GND
  • LCD display Cathode pin1 to Second Relay module COM
  • LCD Display Cathode pin 2 to Second Realay Module NO

  • keypad pin 1 to Arduino D7
  • keypad pin 2 to Arduino D6
  • keypad pin 3 to Arduino D5
  • keypad pin 4 to Arduino D4
  • keypad pin 3 to Arduino D3
  • keypad pin 2 to Arduino D2
  • keypad pin 1 to Arduino D1

  • LED anode to Arduino A0
  • LED cathode to Arduino A0
  • Buzzer Red wire to Arduino A0
  • Buzzer Black wire to Arduino GND

  • First Relay +v pin to Arduino VCC
  • First Relay -v pin to Arduino GND
  • First Relay input pin to Arduino A5

  • PIR sensor vcc to Power supply module +v
  • PIR sensor GND to Power supply module -v
  • PIR sensor output to Second Relay Input

  • Second Realy +v pin to Power supply module +v
  • Second Relay -v pin to Power Supply Module -v

After connecting all parts lets go to next step.


Now we completed all the hardware connections successfully.

Now its time for uploading the sketch to arduino.

Just simply download the file from below open it with your Arduino IDE. upload it.

there are two step follow the two step.

FIRST STEP : generating default passcode:

we need to generate a default password to use for initialization of the device, after that you can change the password.

  1. Firstly download the file called DEFAULT_PASSWORD.ino
  2. After that just open the file with Arduino IDE.
  3. Simply connect your Arduino to your PC,upload the sketch.

Now the default password is"1234"

uploading the main sketch to Arduino:

  1. Now its time for uploading the main sketch to the Arduino.
  2. Firstly download the file called PASS_CODE_LOCK_v1.1.0.ino
  3. After that just open the file with Arduino IDE.
  4. Simply connect your Arduino to your PC,upload the sketch.

NOTE: defult password is 1234.


Now its time for fixing everything in a box.

This is the hardest step in this project . It took me hours to design and fix the parts in the box.

Find a box yourself that we can use to put all our electronics together . I used foam board to make a box myself .

If you also need to make a box like i made , follow the below step.

Here i used a 10mm Hard foam board sheet.

  • First see the above image, and cut all pieces in correct messurement.
  • After that glue the pieces like a box as shown in the above images, do not glue the top lid of the box.
  • Fix the Arduino, Relays,power supply module in the box using some screws.
  • Cut the holes for mounting the LCD display and other parts on the top lid of the box.
  • Fix the keypad above the top lid, and also fix the LCD display and other parts on the top lid as shown in the above images.
  • after all use glue or screws to fix the top lid of the box.

Now you can fix the box any where in the house like in walls , table etc....

Step 6: DONE...!

We made it guys !

Watch the above video to see how it is work.


Automation Contest 2016

Participated in the
Automation Contest 2016

Be the First to Share


    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge
    • Arduino Contest 2020

      Arduino Contest 2020



    3 years ago

    guys if you like this instructable please vote for this instructable in automation contest