# drmakerr/diy-smart-door-lock architecture

> Architecture diagram of the GitHub repository drmakerr/diy-smart-door-lock, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/drmakerr/diy-smart-door-lock
- Repository: https://github.com/drmakerr/diy-smart-door-lock

## Overview

This is a DIY smart-lock controller: a phone uses a local Open/Close page to command an ESP32, which moves a servo to turn the existing indoor lock. The README documents AP and home-Wi-Fi station modes, plus printable case and mount parts. Source excerpts were unavailable, so the diagram follows documented behavior and does not infer internal code structure.

Main entry points: [`DIY_Door_Opener_Code.ino`](https://github.com/drmakerr/diy-smart-door-lock/blob/main/DIY_Door_Opener_Code.ino) (ESP32 controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_network["Web and Wi-Fi"]
  node_web["Open/Close page"]
  node_esp["ESP32 controller"]
  node_ap["Access Point mode"]
  node_sta["Station mode"]
end

subgraph group_actuation["Lock actuation"]
  node_servo["MG995 servo"]
  node_lock["Existing indoor lock"]
end

subgraph group_printed["Printed hardware"]
  node_case["Lock case<br/>[DoorLockCase.stl]"]
  node_spacer["Door spacer<br/>[DoorSpacer.stl]"]
  node_rotator["Key rotator<br/>[KeyRotator.stl]"]
end

node_phone(("Phone user"))
node_homewifi["Home Wi-Fi"]

node_phone -->|"uses controls"| node_web
node_web -->|"sends commands"| node_esp
node_esp -->|"positions"| node_servo
node_servo -->|"rotates"| node_lock
node_esp -->|"creates network"| node_ap
node_phone -->|"connects to"| node_ap
node_esp -->|"connects as"| node_sta
node_sta -->|"joins"| node_homewifi

click node_web "https://github.com/drmakerr/diy-smart-door-lock/blob/main/DIY_Door_Opener_Code.ino"
click node_esp "https://github.com/drmakerr/diy-smart-door-lock/blob/main/DIY_Door_Opener_Code.ino"
click node_ap "https://github.com/drmakerr/diy-smart-door-lock/blob/main/DIY_Door_Opener_Code.ino"
click node_sta "https://github.com/drmakerr/diy-smart-door-lock/blob/main/DIY_Door_Opener_Code.ino"
click node_case "https://github.com/drmakerr/diy-smart-door-lock/blob/main/DoorLockCase.stl"
click node_spacer "https://github.com/drmakerr/diy-smart-door-lock/blob/main/DoorSpacer.stl"
click node_rotator "https://github.com/drmakerr/diy-smart-door-lock/blob/main/KeyRotator.stl"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web,node_esp,node_ap,node_sta,node_phone toneBlue
class node_servo,node_lock toneAmber
class node_case,node_spacer,node_rotator toneMint
class node_homewifi toneIndigo
```

## Components

### Web and Wi-Fi

- [Open/Close page](https://github.com/drmakerr/diy-smart-door-lock/blob/main/DIY_Door_Opener_Code.ino): `DIY_Door_Opener_Code.ino`
- [ESP32 controller](https://github.com/drmakerr/diy-smart-door-lock/blob/main/DIY_Door_Opener_Code.ino): `DIY_Door_Opener_Code.ino`
- [Access Point mode](https://github.com/drmakerr/diy-smart-door-lock/blob/main/DIY_Door_Opener_Code.ino): `DIY_Door_Opener_Code.ino`
- [Station mode](https://github.com/drmakerr/diy-smart-door-lock/blob/main/DIY_Door_Opener_Code.ino): `DIY_Door_Opener_Code.ino`

### Lock actuation

- **MG995 servo**
- **Existing indoor lock**

### Printed hardware

- [Lock case](https://github.com/drmakerr/diy-smart-door-lock/blob/main/DoorLockCase.stl): `DoorLockCase.stl`
- [Door spacer](https://github.com/drmakerr/diy-smart-door-lock/blob/main/DoorSpacer.stl): `DoorSpacer.stl`
- [Key rotator](https://github.com/drmakerr/diy-smart-door-lock/blob/main/KeyRotator.stl): `KeyRotator.stl`

### Other components

- **Phone user**
- **Home Wi-Fi**

## Connections

- Phone user → Open/Close page: uses controls
- Open/Close page → ESP32 controller: sends commands
- ESP32 controller → MG995 servo: positions
- MG995 servo → Existing indoor lock: rotates
- ESP32 controller → Access Point mode: creates network
- Phone user → Access Point mode: connects to
- ESP32 controller → Station mode: connects as
- Station mode → Home Wi-Fi: joins
