Australia/Sydney
--:--:--
Projects

Smart Door Lock, a Voice-Controlled IoT Project

image
August 1, 2022
The Smart Door Lock was a home-made IoT door lock I built in high school. It combined voice recognition with smartphone control so a spoken passphrase or a tap on my phone could release the lock. I don't use it these days, but it was one of the first projects where I had to make hardware, software and security decisions all fit together, and I learnt a lot from it.
The idea was to replace a key with something more convenient without pretending convenience and security are the same thing. I designed the physical locking side as well as the software that sat behind it.
  • Voice access. The lock listened for a spoken passphrase and released when it heard the right one
  • Smartphone control. I could lock and unlock it from my phone
  • Status and logging. It kept track of the lock state and recorded access attempts

A Raspberry Pi was the brain of the system. It handled the audio input, ran the passphrase check and switched the lock through a GPIO relay. Running the speech side locally on the Pi kept the important decisions on the device instead of depending on a remote server. A microphone captured audio for the voice side, and the relay meant the Pi only ever switched a signal rather than powering the lock directly. I also planned for the obvious failure cases, like keeping a physical key as a manual override in case the power or the Pi went down. The core logic was written in Python, using speech recognition libraries to turn audio into text and then compare it against the stored passphrase. Getting a recent enough Python onto the Pi meant compiling 3.11 from source, which I wrote up in Compiling Python 3.11 from Source on a Raspberry Pi. The service ran headless under tmux so it kept going after SSH disconnected, and a cron job started it again on boot. Small Bash scripts handled routine maintenance.
A door lock is security-critical by definition, so a lot of the project was spent thinking about how it could be attacked rather than just how it should work.
  • Voice is a weak secret on its own. A spoken passphrase can be overheard or recorded, so I treated voice as a convenience layer rather than strong authentication
  • Network exposure. Anything reachable from a phone is reachable from somewhere else too, which pushed me to think about keeping control traffic on the local network where possible
  • Failure modes. Power cuts, a crashed script or a dead SD card all need a sensible answer, and for a door the answer has to include a manual way in
  • Logging. Recording access attempts made it much easier to see what the system was actually doing
Working through these properly is a big part of why I ended up studying security engineering.
  • Looked at how existing smart locks approached the problem
  • Worked through a basic threat model before choosing components
  • Prototyped the hardware and proved the relay and lock worked before adding voice control
  • Tuned the voice recognition and the smartphone control, then tested the whole system together

Hardware
  • Raspberry Pi
  • GPIO relay driving the lock
  • Microphone for voice input
Software
  • Python for the core logic
  • Speech recognition libraries
  • tmux, cron and Bash for running the service headless

The lock worked well enough to prove the idea, and building it taught me far more than reading about IoT security would have.
  • Hardware and software integration, from GPIO wiring through to the service running on the Pi
  • How quickly convenience features turn into attack surface
  • Practical Linux skills on constrained hardware, including compiling Python from source and keeping a headless service alive
  • Why physical fallbacks matter for anything that controls access
It's retired now, but a lot of what I do in my home lab and at university traces back to this project.