DigiLock - Digital Security Lock

As part of building DigiLock – Digital Security Lock, I learned how to create layers of security and use user feedback via software and hardware components. The design challenged me to go beyond simple Arduino projects and explore real-world applications of digital locks, where authentication occurs through both a remote code and a physical logic gate override. I also stepped outside of my comfort zone to work with some components I had never previously used before (IR receiver, an I2C LCD, RGB LED, and buzzer), adding complexity and variation to the system. I learned how to decode IR signals using the IRremote.h library, update LCD messages with the LiquidCrystal_I2C.h library, and mix colours using analogWrite() and an RGB LED as visual indicators. I also learned how to implement time-based logic using millis() instead of delay(), which allows for a lockout after three failed attempts to access the secured data. What made this project most interesting was the ability to combine digital logic hardware (AND gate) with code-based verification through an IR receiver to require the user to send the correct IR code, and to satisfy physical conditions (pressing a button and touching the sensor). Instead of going the basic logic gate chip or a touch sensor route, DigiLock uses a physical override system made up of a push button and an IR tracking sensor. The button gives one input, and the IR sensor acts as a second logic input, simulating a logic AND gate state. This ensures that the user must engage the button and trigger the IR sensor (e.g., by having a hand or reflective surface) to allow access, thus making the system more secure and engaging. Through this project, I've become more aware of how multi-factor security systems are managed to protect access points, and how to design interactive embedded systems that meet functionality and security needs.
Supplies

Set Up the Breadboard and Power Rails

Take some jumper wires and connect the 5V and GND pins on the Arduino to the red and blue power rails on your breadboard. This way, all of your components will have an easy way to receive power and ground from the same source.
Connect the IR Receiver Module

Place the IR receiver on your breadboard and attach its pins to the Arduino. VCC connects to the 5V rail, GND connects to the GND rail, and OUT or Signal connects to digital pin 12 on the Arduino. This sensor will allow your project to detect input from and decode a signal from an IR remote, or "digital key".
Connect the RGB LED

Insert the common anode RGB LED into the breadboard. Connect the red, green, and blue LED pins to digital pins 11, 10, and 9 using a wire corresponding to each colour of the LED. The longest leg (anode) connects to power through a resistor. The LED will change colours depending on the system status; clear when ready, green when access is granted, red when denied, etc.
Connect the Piezo Buzzer

Place the piezo buzzer into the breadboard. Attach the positive (+) pin of the buzzer to digital pin 7 on the Arduino and the negative (–) pin to the GND rail to create different tones for successful, failed, or locked-out actions.
Connect the I2C LCD Display

Either connect your 16x2 I2C LCD to the breadboard, or use jumper wires to connect directly to the Arduino. You will connect the GND pin to the ground, VCC to 5V, SDA to the analog pin A4 and SCL to the analog pin A5. In the Arduino IDE, ensure the LiquidCrystal_I2C library is installed as the LCD will be used to display messages such as "Enter Password", "Access Granted", or "LOCKED OUT."
Connect the IR LED

If you are using an IR LED for visual feedback, attach it to the breadboard, ensuring the longer leg (or anode) is connected to pin 8 on the Arduino and the shorter leg (or cathode) is connected to ground with a resistor. Therefore, every time a signal is received from the IR remote, the LED will blink briefly, indicating that the user pressed the button on the IR remote.
Create the Logic With the Tracking Sensor and Push Button

To build the override logic system, we will be using a push button with a tracking sensor. The push button and tracking sensor work together as an AND gate. Both must be triggered to have access.
Place the push button on the breadboard. Connect one leg of the button to GND and then the other leg to one of the inputs of the AND gate chip. Then you will want to connect a 10KΩ resistor between the pin and ground to keep the pin state as LOW unless the button is pushed.
Next, wire the tracking sensor. You will connect VCC to 5V, GND to GND, and the OUT pin to the second input of the AND gate chip. When the tracking sensor detects a nearby object, such as a hand, it will produce a HIGH signal on its OUT pin.
The output of the AND gate chip connects to pin 6 on the Arduino.
In your code, the access will only happen if:
- You press the correct IR remote button
- You press the button physically
- The tracking sensor detects a nearby object
By adding a second layer of physical confirmation, we have made the digital lock more secure.
Note: A PIR sensor is used as a placeholder in Tinkercad, as the tracking sensor is not available on the platform.
Upload the Code to the Arduino
Connect your Arduino to your computer using a USB cable. Open the Arduino IDE and copy the DigiLock code to a new sketch. Make sure the IRremote, Wire, and LiquidCrystal_I2C libraries are installed.
Libraries Download:
- IRremote: https://github.com/Arduino-IRremote/Arduino-IRremote
- Wire: https://github.com/czukowski/Wire.h
- LiquidCrystal_I2C: https://github.com/johnrickman/LiquidCrystal_I2C
Go to the Tools menu and select the correct board and port. Now, click Upload to load the program onto your Arduino. Your system should now be functional.
Downloads
Test the Digital Lock System

After everything has been connected and code uploaded, power up your Arduino. The LCD screen should display "Enter Password:". Point your IR remote at the receiver and press the button you programmed as the password. If the override (sensor + button) is also triggered, the LCD should display "Access Granted", while the LED will illuminate green, followed by a tone indicating success. If the entry given is only a correct password and not the active override, the system will provide a warning message and deny access. Finally, if denied access after three total incorrect attempts, the system will lock itself for a total of 10 seconds.
Final Touches

Tidy up your wiring to improve the readability of the setup and the neatness of the display. You can bundle together jumper wires with tape or a cable tie. If you are submitting this project for a showcase or demo, please label your components and write your name and project title on a sticky note attached to the board. You could also create a tidy prop to represent a real-world application. This helps the overall project appear professional and presentable. A sample idea is shown above.