▪ INDEXP/002
▪ TIMEFRAMEFeb 2026 — present
▪ CONTEXTPersonal project · home automation
▪ STATUS In progress · battery life testing

Smart electronic
door lock.

— THE IDEA
I wanted a smart lock I could actually trust — no cloud vendor, no mystery radios, no brick when the subscription lapses. So I designed one from bare metal up: battery-powered ESP32 + servo + LoRa on the door, a mains-powered LoRa⇄WiFi bridge on the wall, and a web app that talks to it through an MQTT broker I control.
▪ Photo needed · P-01

Hero shot of the assembled door unit installed on a real door — or a CAD render of the full enclosure with the latch mechanism visible. Landscape framing, 16:9 or wider.

Recommended: 2400 × 1350 px · .jpg or .png

~ 10 µA
deep-sleep current
~ 1 mA
avg idle (LoRa RX)
~ 100 d
est. battery (4×AA)
~ $62
total BOM
▪ CONTROL APP · WEB / PWA

The control surface is a web app I host myself.

Mobile-first HTML/CSS/JS that talks straight to my MQTT broker over WebSockets. No app store, no account, no vendor lock-in — pin it to the phone home screen and it behaves like a native app.

↳ mqtt.js over WSS · TLS · dm mono throughout

▪ Screenshot needed · APP-01

Screenshot of the actual web app on a phone (or in a narrow browser window). Show the locked state with the activity log visible. Dark theme, large lock button centered.

Phone-portrait: 750 × 1334 px PNG · status bar OK

§ 01
Context
Why build this at all
— THE BRIEF I GAVE MYSELF

Commercial smart locks have three problems: they phone home, they brick on low battery in a way that locks you out instead of leaving you a manual option, and their radios are mostly undocumented. I wanted the opposite — a lock that defaults to safe, that I can inspect, and that keeps working when the internet doesn’t.

Constraints were self-imposed:

  • Battery-powered door unit — no wires to route through a residential door.
  • Long-range radio — LoRa, not BLE. Works through walls, across the house, at milliwatts.
  • No vendor cloud — MQTT through a broker I control; the app is a hosted HTML file.
  • Mechanical override — the latch can still be turned by hand.
§ 02
System Architecture
Who talks to whom, and how
— THE SIGNAL CHAIN

Two physical devices, two radios, one broker. Command flows down; status flows up; everything else sleeps.

01
User / phone / browser
Opens the hosted web app. Tapping the big button publishes a command to the MQTT broker.
via HTTPS / WSS
02
HiveMQ Cloud · MQTT broker
Central pub/sub bus. Handles auth and persistence; totally vendor-swappable.
via WiFi
03
Wall unit · Heltec WiFi LoRa 32 V3
Always-on bridge. Plugged into a USB charger. Translates MQTT commands into LoRa packets and back.
via LoRa · SX1262
04
Door unit · ESP32 + SX1276
Battery-powered. Deep-sleeps until a packet arrives, then drives the servo through the limit switches.
via PWM + MOSFET gate
05
20 kg·cm servo → door latch
Turns the deadbolt. Limit switches confirm the end state. MOSFET kills servo power between moves.
PHYSICAL
§ 03
Design Decisions
Why each part earned its place
▪ Image needed · MECH-01

CAD screenshot of the door-unit mechanical assembly — servo, bevel-gear shaft, and the two limit switches positioned at the lock/unlock end-stops. Iso view, components visible, no enclosure or with enclosure cut away.

Export from Onshape/SolidWorks: 2000 × 1100 px PNG · isometric view

— POWER BUDGET
  • ESP32 spends >99% of its life in deep sleep (~10 µA), wakes on a GPIO interrupt from the LoRa module's DIO pin.
  • Servo is gated by a low-side N-channel MOSFET (IRLZ44N) — zero power between moves, no quiescent draw from a regulator.
  • The MOSFET is the definitive cutoff: independent of the servo library, independent of PWM state, immune to firmware bugs.
— RADIO CHOICE
  • BLE needs a phone in radio range; WiFi on the door means keeping the radio hot — not viable on batteries.
  • LoRa lets the door wake, receive, ACK, and sleep again inside a milliwatt-second budget.
  • Cross-chip link working: SX1262 (Heltec wall unit) ⇄ SX1276 (door unit) with matched syncword and modem params. RSSI ~−63 dBm at room scale.
— FAIL-SAFE BEHAVIOR
  • Firmware state — what the door thinks it did.
  • Limit-switch voltage — read after the servo finishes moving.
  • Round-trip ACK — door confirms back up the chain before the UI shows “locked”.
  • If any disagree, the UI goes yellow “unknown” and refuses to auto-lock.
  • Deadbolt is always hand-turnable — the servo is back-drivable at rest.
§ 04
Custom PCB
From perfboard to a board I can hand to JLCPCB
▪ Image needed · PCB-01

EasyEDA 3D-render screenshot of the door-unit PCB (top view, components placed). Black soldermask preferred for contrast on this page.

Export: 1600 × 1200 px PNG · white background OK

▪ Image needed · PCB-02

2D layout screenshot — top-layer signal traces visible, bottom-layer GND pour. Or a photo of the populated board once it ships from JLCPCB.

Export: 1600 × 900 px PNG

— WHY A PCB

Perfboard worked for the prototype but the door unit carries ten signal lines plus a power loop with servo current spikes. Trace placement matters — a noisy ground at the wrong moment resets the ESP32 mid-actuation. A real PCB collapses that whole class of bugs.

Designed in EasyEDA, fabricated through JLCPCB. Two-layer board, signal traces on top, solid GND pour on bottom.

▪ Layers2 (signal / GND pour)
▪ Power traces1–2 mm
▪ Signal traces0.25 mm
▪ Battery connJST-PH, keyed
▪ Servo conn3-pin 2.54 mm header
▪ Servo bulk cap1000 µF (absorbs inrush)
§ 05
Bill of Materials
Everything that goes into one
QTY PART ROLE EST. $
1 Heltec WiFi LoRa 32 V3ESP32-S3 · SX1262 · WALL UNIT Always-on MQTT⇄LoRa bridge $22.00
1 ESP32 DevKitCWROOM-32 · DOOR UNIT MCU Deep-sleep controller on the door $7.50
1 RFM95 / SX1276 module868/915 MHz LoRa · DOOR UNIT LoRa transceiver for door unit $9.00
1 20 kg·cm digital servoDS3225 / DS3218 class · METAL GEAR Turns the deadbolt latch $14.00
2 Roller-lever limit switchSPDT · 5 A · MICROSWITCH Confirms latch position $2.40
1 Logic-level N-ch MOSFETIRLZ44N · LOW-SIDE GATE Cuts servo power between moves $0.80
1 4×AA battery holderWITH ON/OFF SWITCH Door unit power $2.50
1 3D-printed housing · door + wallPETG · CUSTOM ENCLOSURE Everything mechanical ~$4.00
Screws, wires, headersM3 fasteners · jumper wire · misc Glue ~$2.00
TOTAL (± $5 depending on where you shop) ≈ $61.70
§ 06
Timeline & Status
Honest, with check-marks
Feb 2026
Mechanical prototype + power gatingServo drives the deadbolt; limit switches detect both end-states. MOSFET cutoff + deep-sleep verified: ~10 µA sleep, ~1 mA average with LoRa listening.
Mar 2026
Web app + MQTT over WebSocketsApp ↔ HiveMQ ↔ wall unit fully working. Auto-lock, activity log, settings panel, connection credentials all live.
Mar 2026
Cross-chip LoRa linkSX1262 (wall) ⇄ SX1276 (door) working end-to-end. Matched syncword + modem params. RSSI ~−63 dBm at room scale.
Mar 2026
Custom PCB — EasyEDA → JLCPCBTwo-layer board, signal on top, GND pour on bottom. JST-PH battery connector, 1000 µF bulk cap adjacent to the servo connector. Replaces the perfboard prototype.
Apr 2026 · NOW
Battery life evaluationOn the bench with a fresh set of AAs, logging average current draw over real lock/unlock cycles. Targeting confirmation of the ~100-day projection.
§ 07
Lessons & Next
What I’d do differently on v2
— IN HINDSIGHT

Pick both radios from the same silicon family up front. Heltec was convenient for the wall unit but the SX1262/SX1276 mismatch cost me a week of firmware debugging before the link came up.

Do the power measurements before the mechanical design. I moved the battery holder twice because my first sleep-current numbers were wrong by an order of magnitude.

Design the mechanical override first, before any electronics. A smart lock that can’t be opened by hand is just an expensive paperweight the first time firmware crashes.

← All projects Questions? → Get in touch