## 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. 1. **Base** — mounts to door hardware, holds electronics 2. **Gear Motor** — gear interface between motor shaft and key 3. **Cage Motor** — retains N20 motor in position 4. **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
Category: Home Automation
| Qty | Part | Notes | |-----|------|-------| | 1 | - geared motor at 9V can close lock and open door | — | | 1 | - used Ultimaker 2 with black filament | — | | 1 | - ESP32's deep sleep current is very low (depending on the board) and it also has bluetooth. | — | | 1 | - 2*AA batteries ~= 3.2V for ESP32: alkaline < 5 Wh | — | | 1 | - 9V block battery for motor: alkaline < 3 Wh | — | | 1 | - step-up from 3.2V seems better since ESP is running more often than the motor and AA have higher capacity | — | | 1 | - then tried TB6612FNG Wemos I2C motor shield: works and specs are more than enough (two motors, 2.7-5.5V logic, <15V motor, 1.2A const./3.2A peak per channel) | — | | 1 | - seems unreliable and energy-intense - how long can the motor pull it open w/o damage? | — | | 1 | - ESP32 can stay in deep sleep and wake up from touch via one of its touch pins; metal on the inside is connected to the outside of the door | — | | 1 | - ESP32 as client: need some server running on the phone | — | | 1 | - ESP32 as server that phone connects to | — | | 1 | - yes if sequence: door sensor open/close, no motion, phone disconnected from WiFi for x min, phone connected to WiFi | — |