Make Your Own Combination Lock that Will Work with a Push of a Button and Arduino

Create Combination Lock with a Push Button & Arduino

 If you have documents or items you would like to keep private, you could benefit from a combination lock.  Old-school combination locks have been around for decades protecting everything from briefcases to lockers to secretive rooms. Now, you can have a high-tech version using Arduino to create a combination lock that will work at the push of a button!

In this project inspired by builders High Voltages and Asim Zulfiqar you will learn to make your own combination lock 21st-century style. You can set a combination password using an Arduino keypad module, or you could also use RFID cards for access. For this project, you will set a 6-digit passcode – if your push the buttons in the correct 6-digit sequence, the green LED light will come on. If you enter the wrong 6-digit passcode, the red LED will light up.

Here are the parts, tools, and services you’ll need:

  • Arduino UNO & Genuino UNO
  • Arduino IDE
  • 6 X Digital Push Buttons (the project creators recommend this version by DFRobot)
  • 1 X Green 5mm LED
  • 7 X Red 5mm LED
  • Jumper Wires
  • Breadboard
  • (Optional) Soldering Iron (useful if you want to solder your components together)
  • (Optional) Autodesk tinkercad (useful if you want to incorporate simulation)

 1. Set up the push button interface

First, you will want to use Arduino to interface with your buttons so that the buttons will give 0V when pushed, and 5V when released – this is the pull-up configuration. (Alternatively, you could use the pull-down configuration, where the buttons give 5V when pushed, and 0V when released, but we’re following High Voltages and Asim Zulfiqar who use the first method).

 For the pull-up configuration, you do not need an external resistor.  Instead, you are utilizing Arduino’s internal pull-up resistor.

Arduino Combination Lock with Push of a Button

2. Change the combination code

Next, you will want to change the combination code.

Begin by opening up the Arduino code and finding this sequence: “int code[] = {6,5,5,4,3,2};” 

According to this sequence, the combination is 6-5-5-4-3-2 – if you push the buttons in that order, the green LED light should come on.

3. Make your circuit and upload the code

Next, you’ll need to set-up your circuit and program the code. You can follow along with this video tutorial to make sure you set up everything correctly.

You can also find downloads for both the schematics of the circuit diagram and the code you will need on this resource page.

**Don’t forget, you need to make the circuit open Arduino IDE and you’ll need to select the board and port in order to upload your code.

Now you’ve got a combination lock to protect your privacy!  What exciting secrets will you lock away?

All of us here at Vilros hope you’ll love using your new Arduino UNO combination lock.  If you’d like to find more Arduino project ideas, please bookmark the Vilros Projects blog and come back to find new projects you can try!


GET IN TOUCH

MAKE:INSPIRE TEAM

x