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
Project

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 UNO
- 4×4 Keypad
- LiquidCrystal I2C Display (20×4)
- Servo Motor
- WS2812B NeoPixel LED Strip (or a single NeoPixel LED)
- 4 ohm Speaker
- Buzzer
- DFPlayer Mini MP3 Player Module
- 1Kohm Resistors
- Connecting Wires
- 5 Volt Power Supply
- Breadboard
Circuit Connection
DFPlayer Mini (Audio Player):
- Arduino Pins:
Pin
D10 (SoftwareSerial RX) > DFPlayer Mini TXPin D
11 (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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | #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] = '\0'; currentPassword = String(pwd); lcd.clear(); lcd.setCursor(0, 0); lcd.print("Password Loaded"); delay(1000); lcd.clear(); lcd.setCursor(0, 0); lcd.print("Enter Password:"); } void savePassword(String newPassword) { for (int i = 0; i < maxPasswordLength; i++) { EEPROM.write(i, newPassword[i]); } currentPassword = newPassword; } void blinkLED(int red, int green, int blue, int times, int delayTime) { for (int i = 0; i < times; i++) { strip.setPixelColor(0, strip.Color(red, green, blue)); strip.show(); delay(delayTime); strip.setPixelColor(0, strip.Color(0, 0, 0)); strip.show(); delay(delayTime); } } void beepBuzzer(int times, int delayTime) { for (int i = 0; i < times; i++) { digitalWrite(buzzerPin, HIGH); delay(delayTime); digitalWrite(buzzerPin, LOW); delay(delayTime); } } void playAudio(int trackNumber) { dfPlayer.play(trackNumber); } |
Basic Structure of the Code
The code initializes the libraries and sets up the pins for various components. The setup()
function lays the groundwork by configuring the serial communication, initializing the components, and displaying a welcome message on the LCD.
The main loop continuously checks for user input from the keypad, processing commands such as unlocking the door and changing the password. Upon detecting a valid input, the system provides audio or visual feedback, indicating the result of the action taken by the user.
Testing and Calibration
Testing and calibration are crucial phases before the system can be deployed for actual use. This process includes:
- Servo Calibration: Adjust the angles and timing in the code to ensure the servo motor correctly aligns with the locking mechanism without jamming or hindering operation.
- Input Validation Testing: Attempt various correct and incorrect password inputs to verify that the system accurately recognizes and responds to each scenario.
- Audio Feedback Check: Ensure that all audio prompts are played correctly and clearly. Test the responsiveness of the DFPlayer Mini to guarantee that users are receiving prompt feedback when interacting with the system.
- User Interaction Simulation: Perform tests as an end user would, including entering passwords, setting new passwords, and triggering error conditions. This helps uncover any potential issues with user input handling or feedback communication.
By rigorously testing each feature and fine-tuning the system, you will enhance the overall reliability of the door lock system, providing a secure and user-friendly experience.
Video Output
Conclusion
The Smart Arduino Door Lock System demonstrates a perfect synergy of hardware and software to create a robust and user-friendly security solution. With the support of PCBWay for professional-grade PCBs and KiCad for circuit design, this project exemplifies how collaboration with leading platforms can drive innovation.
Whether you are a hobbyist or a professional programmer, this project enhances your technical skills and provides a practical application that can be used in real-world scenarios. Embracing this technology ensures that you remain ahead in the evolution of smart security systems, paving the way for more advanced, interconnected security solutions.