Homebrew Smart Door
Smart locks are now commonly available, but they are plagued by hardware and software vulnerabilities that make it trivial for attackers to unlock doors in-person and/or remotely. Smart doorbells bring a number of privacy concerns.
Plus, there's no fun in buying these problematic off-the-shelf products when you can build yourself something better!
The Smart Door is my custom-built integrated smart lock, doorbell, and security system.
The Smart Door is assembled with 3D printed cases and mechanical parts for exterior and interior components.
Inside, a housing is mounted on the door. A 3D printed cam bar replaces the thumbturn, allowing a servo to directly drive the standard deadbolt. The housing contains the servo and some electronics.
Outside, a larger case holds a number of visitor-facing components.
Everything is controlled with a Raspberry Pi running custom node.js software. There is also a separate internet-facing server hosted on my home network which coordinates with the door controller (and other home automation devices). The door controller is not directly exposed to the internet.
A servo motor is attached to the deadbolt to lock and unlock the door. A button allows users to unlock the door and a LED indicates status. A Hall effect sensor detects whether the door is open or closed.
Each of these components is controlled by GPIO on the Pi.
The box mounted on the apartment's exterior wall packs in several features.
- Button with RGB LED ring acts as a fancy doorbell. When pressed, a sound is played inside and a push notification sent to my phone.
- A small OLED screen shows status info.
- A wide-angle camera streams live video to my phone.
- Speaker and microphone for 2-way communication.
- NFC card reader
There are multiple ways to unlock the door.
Both the phone and watch apps can communicate over the internet or Bluetooth LE (BLE). Over the internet, an encrypted and signed unlock command is sent to a server hosted on my home network (no cloud services involved). The server authenticates commands and forwards them to the Pi.
When in physical proximity to the door, Bluetooth is automatically used for direct communication between the app and the Pi. The door issues a cryptographic challenge, which the app signs with a SHA256 HMAC, and sends a response back to the door when the user presses the app's unlock button.
Like BLE, a HMAC challenge/response is used over NFC. Both the phone and watch apps implement Android HCE, which allows a simple tap-and-unlock (without having to open the app).
The NFC reader also works with passive smartcards. A YubiKey can securely unlock the door.
Both Bluetooth LE and NFC allow door unlocks even if internet connectivity is unavailable.
Finally, limited-use keys can be generated and sent to guests. The key is a URL with a token that guests open in their browser, where they find a page with unlock buttons. Links automatically expire at a set time.