
About 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.
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 (base, gear-motor, cage-motor, gear-key-knob) |
| Build Difficulty | Intermediate |
| Firmware | Arduino / PlatformIO |
3D-Printed Parts (4 total)
All parts designed in Fusion 360. The full assembled model is also included for reference.
- Base — mounts to door hardware, holds electronics
- Gear Motor — gear interface between motor shaft and key
- Cage Motor — retains N20 motor in position
- Gear Key Knob — adapter that couples to existing door key
Bill of Materials (Estimated)
| Component | Notes |
|---|---|
| ESP32 bare / LOLIN D32 | LOLIN D32 recommended (125 µA deep sleep from battery) |
| N20 geared DC motor | Must operate at 9 V to actuate door trap reliably |
| TB6612FNG motor driver | Direct GPIO control; no I2C overhead |
| 2x AA battery holder | Powers ESP32 logic rail |
| 9 V battery + clip | Powers motor only |
| Jumper wires | 3 control pins: BIN1 (pin 27), BIN2 (pin 14), STBY (pin 26) |
| Metal screw or plate | Connected to touch pin T2 to sense door knob contact |
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
🖨 Print Files (5)
0-SmartLock-assembled.stl
1-base.stl
2-gear-motor.stl
3-cage-motor.stl
4-gear-key-knob.stl
Required Hardware
| Qty | Part | Notes |
|---|---|---|
| 1 | ESP32 DevKit V1 or LOLIN D32 | LOLIN D32 recommended — 125 µA deep sleep vs ~10 mA on DOIT DEVKIT |
| 1 | N20 Geared DC Motor, 9V | Must be rated 9V; 3–6V motors will not reliably actuate the door trap |
| 1 | TB6612FNG Motor Driver Breakout | Controls motor direction via GPIO; two-channel, handles up to 1.2A |
| 1 | 2×AA Battery Holder with Switch | Supplies ~3.2V logic rail for ESP32 |
| 1 | 9V Battery Snap Connector with Leads | Powers motor rail from 9V block battery |
| 1 | Energizer AA Alkaline Batteries (8-pack) | Powers logic rail; AA alkaline recommended for capacity |
| 1 | Energizer 9V Alkaline Battery (4-pack) | Powers motor; 9V block alkaline |
| 1 | Black PLA Filament 1.75mm 1kg | For printing base, gear-motor, cage-motor, gear-key-knob parts |
| 1 | Dupont Jumper Wire Kit | Connects ESP32 GPIO pins to TB6612FNG (BIN1, BIN2, STBY) |
| 1 | Electrical Insulating Tape | Wraps key slot for snug fit; insulates touch-pin metal contact |
B