
DIY SmartLock
✓ Links verified Jun 10, 2026
Sign up to InstallAbout this program
DIY SmartLock
A battery-powered 3D-printed smart lock powered by an ESP32 and driven by an N20 geared motor. Designed for residential door locks, it replaces the manual key turn with touch-triggered automation — touching the metal door knob from outside wakes the ESP32 from deep sleep and checks MQTT for authorization before unlocking.
How It Works
The ESP32 spends nearly all of its time in deep sleep (as low as 5.2 µA on bare ESP32), waking only when the capacitive touch sensor detects contact with the door knob. On wake it connects to WiFi, subscribes to an MQTT topic (door/auth), and drives the N20 motor clockwise or counter-clockwise to lock or unlock. The system integrates naturally with Node-RED, Home Assistant, or any MQTT-capable automation stack for presence-based auto-auth.
Important: The N20 motor must operate at 9 V — 3–6 V versions will not reliably actuate the door trap.
Specifications
| Property | Value |
|---|---|
| Controller | ESP32 (bare WROOM-32 or LOLIN D32) |
| Motor | N20 geared DC motor (9 V, ~40 mA no-load) |
| Motor Driver | TB6612FNG (direct GPIO control) |
| Power — Logic | 2x AA alkaline batteries (~3.2 V) |
| Power — Motor | 9 V block battery |
| Deep Sleep Current | ~5.2 µA (bare ESP32), 125 µA (LOLIN D32) |
| Wake Trigger | Capacitive touch sensor (ESP32 pin T2) |
| Connectivity | WiFi 802.11 b/g/n + MQTT |
| Printed Parts | 4 STLs (base, gear-motor, cage-motor, gear-key-knob) |
| Build Difficulty | Intermediate |
| Firmware | Arduino / PlatformIO |
Attribution
Designer: Florian Vogler (@vogler on GitHub) Source: https://github.com/vogler/SmartLock License: Source-available (no explicit open-source license — check repo for usage terms) 3D Model: https://a360.co/4lLHHwa (Fusion 360, downloadable in multiple formats) Build Album: https://photos.app.goo.gl/bewiZ1qH8sHnJjmg7
Printing
Print one of each of the four parts: 1-base (the mounting base), 2-gear-motor (motor drive gear), 3-cage-motor (motor cage/housing), and 4-gear-key-knob (the key knob gear). Together these make one complete SmartLock mechanism.
Note: the upstream source also includes a file named 0-SmartLock-assembled, which is a fully assembled preview model of the whole lock — it is a visual reference for how the parts fit together, not a printable part. It has been excluded from this Print All set so the list yields exactly the parts you need to build the lock.
🖨 Print Files (4)
1-base.stl
2-gear-motor.stl
3-cage-motor.stl
4-gear-key-knob.stl
Required Hardware
Parts
| Item | Qty | Notes | Source |
|---|---|---|---|
| ESP32 LOLIN D32 (recommended) or DevKit V1 | 1 | D32: 125 µA deep sleep vs ~10 mA on DOIT DevKit | Amazon |
| N20 geared DC motor, 9 V | 1 | Must be 9 V-rated; 3–6 V motors will not reliably actuate the door trap | Amazon |
| TB6612FNG motor driver breakout | 1 | Two-channel, handles up to 1.2 A | Amazon |
| 2×AA battery holder with switch | 1 | ~3.2 V logic rail for the ESP32 | Amazon |
| 9 V battery snap connector with leads | 1 | Motor rail from 9 V block battery | Amazon |
| AA alkaline batteries (8-pack) | 1 | Logic rail | Amazon |
| 9 V alkaline battery | 1 | Motor power | Amazon |
| Black PLA filament 1.75 mm, 1 kg | 1 | Base, gear-motor, cage-motor, gear-key-knob parts | Amazon |
| Dupont jumper wire kit | 1 | ESP32 GPIO ↔ TB6612FNG (BIN1, BIN2, STBY) | Amazon |
| Electrical insulating tape | 1 | Key-slot snug fit; insulates touch-pin contact | Amazon |
B