An Electronic Door Lock System with Keypad and Servo

Engineering illustration: An Electronic Door Lock System with Keypad and Servo

An electronic door lock system combines a numeric keypad for verifying a passcode with a servo motor that carries out the actual lock/unlock motion — a well-rounded project that trains combining input, validation, and mechanical control into one system.

Components needed

An Arduino Uno R3 board, a 4x4 membrane keypad, a 16x2 LCD screen fitted with an I2C module, an SG90 servo motor representing the locking mechanism, and connecting wires.

Wiring it up

The keypad connects to eight digital pins via the Keypad library, the LCD connects through its I2C module via the SDA and SCL pins, and the servo motor connects to a digital pin that supports PWM.

How it works

The system asks the user to enter a four-digit code via the keypad, and the LCD shows an asterisk (*) in place of each digit entered to keep the code hidden while typing. The code converts each pressed digit to its numeric value, multiplies it by its appropriate place value (1000 for the first digit, 100 for the second, 10 for the third, 1 for the fourth), then sums the four results to form the complete entered code, comparing it against the correct code stored beforehand in the sketch. When the codes match, the screen shows a welcome message and the servo rotates to an "unlocked" angle for a set duration before automatically returning to a "locked" angle; if they don't match, the screen shows a rejection message and the lock stays in its locked position.

Safety note: This project is educational, meant for learning access-control principles, and doesn't provide adequate security to protect a real door on its own (no protection against brute-force attempts, and no code encryption). Don't rely on it as the sole security lock for real property.

You can find keypads and servo motors at Juthour Tech.

اترك تعليقا

*
*
يمكن للأعضاء المسجلين فقط ترك تعليقات.