Projects / Final-year project, KGiSL Institute of Technology
Voice-controlled door lock
A door lock that recognises who is speaking from MFCC voice features, and falls back to a 4-digit keypad PIN when the voice doesn't match.

My part. Two-person final-year project with Rishikesh H, supervised by Ms. Ambika B (ECE). Published in IJSREM in May 2025.
Why I built it
Keys get copied, PINs get shared, and most voice or face locks send your data to the cloud and stop working when the internet drops. We wanted a cheap lock that checks the speaker's voice locally, with a PIN as a backup.
What's in it
- Controller
- ESP32 dev board: dual-core 240 MHz, with an I2S port for the microphone
- Microphone
- INMP441 MEMS mic, 24-bit digital output over I2S (WS on GPIO25, SD on GPIO33, SCK on GPIO32)
- Keypad
- 4x4 matrix keypad on 8 GPIOs, scanned with the Keypad library
- Lock
- Servo or solenoid driven through a relay
- Voice matching
- Python on a laptop: librosa for MFCCs, NumPy for the distance check, pyserial to talk to the ESP32
How it works
- Enrolment: record the passphrase at 16 kHz and reduce its 13 MFCCs to one averaged vector, the speaker's voiceprint.
- Capture: the ESP32 reads 3 seconds of audio from the INMP441 over I2S and streams the 16-bit samples to the laptop over serial.
- Match: Python computes the same 13-value MFCC vector and its Euclidean distance from the voiceprint. Under the threshold means access.
- Fallback: the script sends '0' (granted) or '1' (failed) back to the ESP32. On '1' the ESP32 switches to keypad mode and asks for a 4-digit PIN.
- Unlock: a correct voice or PIN drives the relay and servo.
Code
distance = np.linalg.norm(reference_mfcc - new_mfcc)
print(f"Distance: {distance:.2f}")
if distance < threshold:
print("Password matched. Access granted.")
ser.write(b'0') # tell the ESP32 to skip the keypad
else:
print("Access denied. Launching keypad.")
ser.write(b'1') # ESP32 switches to PIN entryTesting
| Test | Input | Result |
|---|---|---|
| Speaker matches the stored voiceprint | Voice | Unlocked through relay and servo |
| Wrong or unrecognised speaker | Voice | Denied, switches to keypad |
| Correct PIN | Keypad | Unlocked through relay and servo |
| Wrong PIN, three times | Keypad | Denied, system resets |
| Power cut and restore | Reset | Returns to the ready state |
Result
The prototype passed all five test cases above. The work was published as "Password Protected Door Lock System using ESP32" in IJSREM, May 2025.
Next step
Run the MFCC extraction and matching on the ESP32 itself and keep voiceprints in its flash, so the lock works with no laptop attached.