Smart Arduino Door Lock System is a sophisticated and customizable security solution that enhances access control in both residential and commercial apartments. Combining the versatility of the Arduino platform with essential hardware components like a keypad, servo motor, and DFPlayer Mini, this project provides a secure, interactive, and user-friendly method to manage door access.
Sponsored by PCBWay and KiCad
At the heart of this system is the Arduino microcontroller, which serves as the brain of the operation, processing user inputs and controlling the various components. This project is brought to life with the help of PCBWay and KiCad, two integral partners in creating a reliable and efficient PCB design.
KiCad was used to design the custom PCB for this system, ensuring seamless integration of all components into a compact, efficient, and professional layout. With its open-source flexibility and user-friendly tools, KiCad enabled us to bring the circuitry to life precisely.
Once the design was finalized, PCBWay provided world-class PCB manufacturing services. Known for their high-quality fabrication and quick turnaround, PCBWay helped ensure the project achieved a professional-grade finish, essential for durability and reliability in a security application.
By using the PCBWay referral link, you’ll receive a $5 instant credit to kickstart your own projects.
Core Features of the Smart Arduino Door Lock System
- User Interaction via Keypad
The system features a keypad for entering a numeric password to unlock the door. Advanced functionalities, such as real-time error correction, allow users to delete characters during input, ensuring a smooth and intuitive experience. - Servo Motor-Driven Lock Mechanism
Upon entering the correct password, the Arduino signals a servo motor to rotate and unlock the door. This motorized mechanism is quiet and reliable, reducing wear and tear compared to traditional mechanical locks. - Audio Feedback with DFPlayer Mini
The inclusion of the DFPlayer Mini module enhances the user experience by providing voice alerts or sound effects for various actions, such as successful entry, incorrect password attempts, or password changes. This makes the system reliable and user-friendly, even for individuals unfamiliar with digital locks. - Password Security and Confirmation
Security is paramount, and the system includes a password confirmation process for setting or updating passwords. This prevents accidental errors and ensures intentional changes to security credentials.
With its combination of robust security, ease of use, and adaptability, the Arduino Door Lock System stands out as an ideal solution for anyone looking to upgrade their security system. This system provides peace of mind through innovative technology and thoughtful design, whether for a home, office, or other secure areas.
Must Read Arduino Door Lock System
Circuit Design Using KiCad

Note: WS2812B NeoPixel pin will connect to D13 of Arduino. Not D12 which is mentioned in the diagram.
Components Required
- Arduino Nano [https://amzn.to/43JiD0X]
- 4×4 Keypad [https://amzn.to/4mNICx1]
- LiquidCrystal I2C Display (20×4) [https://amzn.to/442wMYr]
- Servo Motor [https://amzn.to/4jyRt2H]
- WS2812B NeoPixel LED [https://amzn.to/3ZUbaen]
- DFPlayer Mini MP3 Player Module [https://amzn.to/3T8CdyK]
- 1Kohm Resistors
- 4 ohm Speaker
- Buzzer
- Connecting Wires
- 5 Volt Power Supply
- Breadboard
Circuit Connection
DFPlayer Mini (Audio Player):
- Arduino Pins:
PinD10 (SoftwareSerial RX) > DFPlayer Mini TXPin D11 (SoftwareSerial TX) > DFPlayer Mini RX
- Connected to: DFPlayer Mini (for playing audio feedback)
I2C LCD (20×4 Display):
- I2C Interface Pins:
- Arduino A4> LCD SDA
- Arduino
A5> LCD SCL
- Connected to: 20×4 I2C LCD Display (for displaying messages)
4×4 Keypad:
- Arduino Pins:
- Rows:
Pin 9, Pin 8, Pin 7, Pin 6-> Keypad Rows - Columns:
Pin 5, Pin 4, Pin 3, Pin 2-> Keypad Columns
- Rows:
- Connected to: 4×4 Keypad (for user input)
Servo Motor:
- Arduino Pin:
A1 - Connected to: Servo motor (for controlling the lock/unlock mechanism)
RGB LED (Adafruit Neopixel):
- Arduino Pin: D13
- Connected to: RGB LED strip (for visual feedback)
PAM8403 Audio Amplifier:
- PAM8403 left & right input to DFPlayer Mini SPK1 & SPK2
Speaker:
- PAM8403 Audio Amplifier:
LOUT+ and LOUT- - Connected to: Speaker (for sound feedback)
Buzzer:
- Buzzer positive pin to Arduino D12
Why Choose KiCad for Your PCB Design?
KiCad and PCBWay have partnered to simplify PCB design and manufacturing. Key benefits include:
- Seamless Integration: KiCad now directly supports PCBWay’s manufacturing standards, ensuring design compatibility.
- Easy Ordering: A dedicated plugin enables one-click file uploads and orders within KiCad.
- Community-Driven Enhancements: Continuous improvements are driven by both KiCad’s open-source nature and PCBWay’s community contributions.
- Optimized Libraries: KiCad libraries now include components specifically suited for PCBWay manufacturing.
- Cost-Effectiveness: KiCad’s free software combines with PCBWay’s affordable manufacturing for a budget-friendly solution.
This partnership simplifies the design-to-production process, making KiCad an excellent choice for efficient PCB development.
How to Design PCBs & Order it from PCBWay
Prototyping is necessary to transition this circuit design into a commercial or shareable product. The PCB editor and its accompanying plugins provide the tools to carry out this prototyping phase effectively.

To begin, locate and click on the “Plugin and Content Manager” within the main KiCad interface. This is typically pointed by a dedicated red arrow.

Next, locate and install the necessary PCB plugin i.e., PCBWay.
- In the Plugin Manager interface, use the search field to find “pcbway“
- Click “Install” to begin the installation process.
- Before closing the window, remember to click “Apply Pending Changes” to finalize the installation.
After installing the PCBWay plugin from the KiCad plugin manager, it’s time to build our PCB prototype from the prototype section.

The highlighted area using yellow colour shows the menu icons for all plugins I have installed.

Once I’ve placed all components and routed all the tracks, I perform a Design Rule Check (DRC) to ensure the design adheres to all the necessary rules. If no errors are found, I click the PCBWay icon located within the plugin menu.
This action saves my design in a ZIP file compatible with PCBWay’s manufacturing process. This ZIP file contains all necessary files for production. Subsequently, the plugin automatically opens the PCBWay ordering page, allowing me to customize the manufacturing settings according to my preferences.

Crucial settings, such as the choice of materials, the number of layers (automatically determined based on your design), panel or individual board fabrication (particularly useful for small-scale projects), and board colour (options include classic green, matte green, yellow, red, purple, blue, black, and white), can be adjusted. However, for this demonstration, I will accept the default settings.

Next, I selected my region and chose my preferred courier service according to delivery speed. While DHL generally offers the fastest shipping, other couriers may provide more economical options depending on your budget and time constraints. On the same page, an estimated total price is displayed for reference.

After carefully reviewing all settings and confirming they meet my requirements, I clicked ‘Save to Cart‘ to proceed to the payment step. This process is simple. However, it’s crucial to double-check that the correct design has been uploaded. The plugin simplifies this by automatically naming the file according to your project name. If your design involves a panel or multiple boards combined into a single design with snap-away tabs, ensure that the ‘Different design in panel’ option is correctly set. This option should match the number of unique designs within the panel.
As indicated, the option is selected, allowing you to proceed to checkout using the button provided. You can pay for this specific order separately by checking the corresponding box. This feature is particularly useful when dealing with multiple versions or orders, although it’s crucial to exercise caution to avoid errors if the designs appear similar. Before proceeding, ensure that all shipping details are accurately filled in. You can easily access and update your shipping information on the ‘My PCBWay‘ page. Please review and confirm your shipping details before proceeding with the checkout process.

After a successful review, you will be redirected to the “Awaiting Payment” section where you can choose any payment option including PCBWay credit.
After 3 to 5 business days, you will receive your prototype for your project.
Other Services They Provide
PCB Fabrication:
PCBWay offers high-quality PCB fabrication with precise processes, including automated DFM checks, UV printing, etching, drilling, plating, solder masking, and silkscreen labeling. Rigorous electrical testing ensures reliability, while a variety of materials and finishes are supported. Rapid prototyping and bulk production are available with quick turnaround times.
PCB Assembly
PCBWay provides both SMT and through-hole PCB assembly using advanced automated machinery, reflow soldering, and AOI inspection for accuracy. Services include component sourcing, assembly, and testing, ensuring reliable, ready-to-use PCBs with fast delivery options.
CNC Machining & 3D Printing:
PCBWay offers precision CNC machining and 3D printing services, supporting custom prototypes and parts with a variety of materials like metals and plastics. High accuracy, fast turnaround, and quality assurance make it ideal for both industrial and personal projects.
OEM & EMS Services:
PCBWay’s OEM and EMS solutions cover the entire product lifecycle, from design and prototyping to manufacturing and assembly. They offer end-to-end services, including supply chain management, quality control, and global shipping, ensuring efficient, reliable product delivery.
Project View






System Features Overview
Keypad Input
Users can enter a password using a 4×4 keypad, providing secure and customizable access control.
Password Management
- Set a New Password: Press the ‘B’ key, confirm the current password by pressing ‘A’, and enter the new password.
- Persistent Storage: Passwords are saved in the EEPROM, ensuring retention even after a power cycle.
Feedback Mechanisms
- LCD Display: Provides real-time feedback and instructions to the user.
- LED Strip: An Adafruit NeoPixel LED indicates system states with colours.
- Speaker: Emits audio tones for alerts and feedback.
- DFPlayer Mini: Plays audio files for states like “Door Unlocked,” “Wrong Password,” etc.
- Servo Motor: Operates the locking mechanism, moving to unlock or re-lock the door.
Error Handling
The system includes robust error-handling mechanisms, such as error messages for incorrect passwords, invalid operations, and a delete character function to correct input errors.
Password Management Function
To Unlock the Door: Enter the current password and press ‘A’ to unlock. The servo will move to the unlocked position for 5 seconds.
To Set a New Password:
- Press ‘B’ to enter the password-setting mode.
- Enter the current password and press ‘A’.
- Enter the new password and press ‘A’ to confirm.
Error Handling: If the wrong password is entered, the system will display an error, blink the LED in red, beep the buzzer, and play the “Wrong Password” audio.
Audio Feedback System
The DFPlayer Mini module is used in the system to provide real-time audio feedback, enhancing the user experience. Whenever a user action is taken such as entering the correct password, receiving an error message, or confirming a password change, the system will play corresponding voice alerts through a connected 4 ohm speaker. This ensures that users are always aware of their interactions with the door lock system, making it more intuitive and accessible, especially for those unfamiliar with the device.
Audio Files for Audio Feedback
File 1 (Wrong Password):
File 2 (Password Saved):
File 3 (Invalid Length):
File 4 (Door Unlocked):
File 5 (Door Re-Locking):
Copy these audio files into an SD card.
How to Handle Error and Security?
The system includes several error-handling features, such as the delete character function, allowing users to correct input mistakes during password entry. Additionally, the password confirmation process ensures that changes to the password are intentional and correct, preventing accidental updates or unauthorized access. If an incorrect password is entered multiple times, the system can be programmed to trigger an alert or lockout for a certain period to prevent brute-force attacks.
Coding Explanation
The code for the Smart Arduino Door Lock System is structured to manage user input, control hardware components, and provide audio feedback effectively. At its core, the system utilizes various libraries that facilitate interaction with components like the keypad, LCD, DFPlayer Mini, and servo motor.
Key Libraries Used
- Keypad Library: Used to decode the 4×4 keypad inputs, allowing user password entry and management.
- LiquidCrystal_I2C Library: Enables communication with the I2C LCD for displaying messages and statuses.
- Servo Library: Controls the servo motor for locking and unlocking the door.
- DFRobotDFPlayerMini Library: Manages audio playback from the DFPlayer Mini module, ensuring clear communication of states via audio prompts.
Source Code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
#include <Servo.h>
#include <EEPROM.h>
#include <Adafruit_NeoPixel.h>
#include <DFRobotDFPlayerMini.h>
#include <SoftwareSerial.h>
#define maxPasswordLength 4
#define buzzerPin 12
#define servoPin A1
#define ledPin 13 // Use A0 (D14) for LED strip output
#define numPixels 1
SoftwareSerial mySerial(10, 11); // RX, TX for DFPlayer Mini
DFRobotDFPlayerMini dfPlayer;
LiquidCrystal_I2C lcd(0x27, 20, 4);
Servo myServo;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(numPixels, ledPin, NEO_GRB + NEO_KHZ800);
// Keypad setup
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
byte rowPins[ROWS] = {9, 8, 7, 6}; // Connect to the row pinouts of the keypad
byte colPins[COLS] = {5, 4, 3, 2}; // Connect to the column pinouts of the keypad
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
String currentPassword = "1234";
String inputPassword = "";
boolean settingPassword = false;
boolean confirmingPassword = false;
void setup() {
pinMode(buzzerPin, OUTPUT);
pinMode(ledPin, OUTPUT); // Set A0 as an output pin
myServo.attach(servoPin);
strip.begin();
strip.show();
lcd.init();
lcd.backlight();
mySerial.begin(9600);
if (!dfPlayer.begin(mySerial)) {
lcd.setCursor(0, 0);
lcd.print("DFPlayer Error");
while (true);
}
dfPlayer.volume(30); // Set volume to a high level
loadPassword();
}
void loop() {
char key = keypad.getKey(); // Get the key pressed on the keypad
if (key == 'B' && !settingPassword && !confirmingPassword) { // Press 'B' to set a new password
settingPassword = true;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Enter Old Pass:");
inputPassword = "";
return;
}
if (settingPassword) {
if (key == 'A') { // Press 'A' to confirm old password
if (inputPassword == currentPassword) {
confirmingPassword = true;
settingPassword = false;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Enter New Pass:");
inputPassword = "";
} else {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Wrong Old Pass");
blinkLED(255, 0, 0, 3, 200);
beepBuzzer(3, 200);
playAudio(1); // Play "Wrong Password" audio
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Enter Old Pass:");
inputPassword = "";
}
return;
}
if (key == 'C') { // Press 'C' to clear input
inputPassword = "";
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Enter Old Pass:");
} else if (key == 'D') { // Press 'D' to delete the last character
if (inputPassword.length() > 0) {
inputPassword.remove(inputPassword.length() - 1);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Enter Old Pass:");
lcd.setCursor(0, 1);
lcd.print(inputPassword);
}
} else if (key != NO_KEY) { // Entering the old password
if (inputPassword.length() < maxPasswordLength) {
inputPassword += key;
lcd.setCursor(0, 1);
lcd.print(inputPassword);
}
}
return;
}
if (confirmingPassword) {
if (key == 'A') { // Press 'A' to confirm the new password
if (inputPassword.length() == maxPasswordLength) {
savePassword(inputPassword);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Password Saved");
blinkLED(0, 255, 0, 3, 200);
beepBuzzer(3, 200);
playAudio(2); // Play "Password Saved" audio
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Enter Password:");
confirmingPassword = false;
} else {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Invalid Length");
blinkLED(255, 0, 0, 3, 200);
beepBuzzer(3, 200);
playAudio(3); // Play "Invalid Length" audio
delay(1000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Enter New Pass:");
lcd.setCursor(0, 1);
lcd.print(inputPassword);
}
return;
}
if (key == 'C') { // Press 'C' to clear the new password input
inputPassword = "";
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Enter New Pass:");
} else if (key == 'D') { // Press 'D' to delete the last character of the new password
if (inputPassword.length() > 0) {
inputPassword.remove(inputPassword.length() - 1);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Enter New Pass:");
lcd.setCursor(0, 1);
lcd.print(inputPassword);
}
} else if (key != NO_KEY) { // Entering the new password
if (inputPassword.length() < maxPasswordLength) {
inputPassword += key;
lcd.setCursor(0, 1);
lcd.print(inputPassword);
}
}
return;
}
// Handle normal password entry
if (key == 'A') { // Press 'A' to confirm the password
checkPassword();
} else if (key == 'C') { // Press 'C' to clear the input
inputPassword = "";
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Enter Password:");
} else if (key == 'D') { // Press 'D' to delete the last character
if (inputPassword.length() > 0) {
inputPassword.remove(inputPassword.length() - 1);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Enter Password:");
lcd.setCursor(0, 1);
lcd.print(inputPassword);
}
} else if (key != NO_KEY) { // Entering the password
if (inputPassword.length() < maxPasswordLength) {
inputPassword += key;
lcd.setCursor(0, 1);
lcd.print(inputPassword);
}
}
}
void checkPassword() {
if (inputPassword == currentPassword) {
myServo.write(90); // Unlock position
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Door Unlocked");
blinkLED(0, 255, 0, 3, 200);
beepBuzzer(3, 200);
playAudio(4); // Play "Door Unlocked" audio
delay(5000); // Keep the door unlocked for 5 seconds
myServo.write(0); // Lock position
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Re-Locked");
playAudio(5); // Play "Re-Locked" audio
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Enter Password:");
} else {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Wrong Password");
blinkLED(255, 0, 0, 3, 200);
beepBuzzer(3, 200);
playAudio(1); // Play "Wrong Password" audio
delay(1000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Enter Password:");
}
inputPassword = ""; // Clear the input after checking
}
void loadPassword() {
char pwd[maxPasswordLength + 1];
for (int i = 0; i < maxPasswordLength; i++) {
pwd[i] = EEPROM.read(i);
}
pwd[maxPasswordLength] = '
