# kaveenamarasekara/secure_vault_iot architecture

> Architecture diagram of the GitHub repository kaveenamarasekara/secure_vault_iot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kaveenamarasekara/secure_vault_iot
- Repository: https://github.com/kaveenamarasekara/secure_vault_iot

## Overview

This PoC detects a physical access attempt, gives the user a 15-second window to authenticate, then grants access or raises a local and remote alert. The README describes an ESP32 finite-state workflow with sensor inputs, LCD feedback, buzzer/LED outputs, and MQTT logging. The only source file is `iot_vault.ino`, but no source excerpt was available, so the relationships below reflect documented behavior rather than inspected implementation details.

Main entry points: [`iot_vault.ino`](https://github.com/kaveenamarasekara/secure_vault_iot/blob/main/iot_vault.ino) (ESP32 state machine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensing["Access sensing"]
  node_ldr["Door light sensor<br/>[iot_vault.ino]"]
  node_dial["Code dial<br/>[iot_vault.ino]"]
  node_button["Confirm switch<br/>[iot_vault.ino]"]
end

subgraph group_control["Vault control"]
  node_controller["ESP32 state machine<br/>[iot_vault.ino]"]
  node_timer["15-second window<br/>[iot_vault.ino]"]
  node_lcd["LCD prompts<br/>[iot_vault.ino]"]
end

subgraph group_reporting["Alerts and logging"]
  node_alarm["Buzzer and LED<br/>[iot_vault.ino]"]
  node_mqtt["MQTT logging<br/>[iot_vault.ino]"]
end

node_user(("User"))
node_broker(("HiveMQ broker"))

node_user -->|"opens door"| node_ldr
node_user -->|"sets code"| node_dial
node_user -->|"confirms code"| node_button
node_ldr -->|"signals access"| node_controller
node_dial -->|"provides value"| node_controller
node_button -->|"confirms entry"| node_controller
node_controller -->|"starts window"| node_timer
node_controller -->|"shows prompt"| node_lcd
node_controller -->|"triggers on breach"| node_alarm
node_controller -->|"publishes events"| node_mqtt
node_mqtt -->|"sends logs"| node_broker

click node_ldr "https://github.com/kaveenamarasekara/secure_vault_iot/blob/main/iot_vault.ino"
click node_dial "https://github.com/kaveenamarasekara/secure_vault_iot/blob/main/iot_vault.ino"
click node_button "https://github.com/kaveenamarasekara/secure_vault_iot/blob/main/iot_vault.ino"
click node_controller "https://github.com/kaveenamarasekara/secure_vault_iot/blob/main/iot_vault.ino"
click node_timer "https://github.com/kaveenamarasekara/secure_vault_iot/blob/main/iot_vault.ino"
click node_lcd "https://github.com/kaveenamarasekara/secure_vault_iot/blob/main/iot_vault.ino"
click node_alarm "https://github.com/kaveenamarasekara/secure_vault_iot/blob/main/iot_vault.ino"
click node_mqtt "https://github.com/kaveenamarasekara/secure_vault_iot/blob/main/iot_vault.ino"

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_ldr,node_dial,node_button,node_user toneBlue
class node_controller,node_timer,node_lcd toneAmber
class node_alarm,node_mqtt toneMint
class node_broker toneIndigo
```

## Components

### Access sensing

- [Door light sensor](https://github.com/kaveenamarasekara/secure_vault_iot/blob/main/iot_vault.ino): `iot_vault.ino`
- [Code dial](https://github.com/kaveenamarasekara/secure_vault_iot/blob/main/iot_vault.ino): `iot_vault.ino`
- [Confirm switch](https://github.com/kaveenamarasekara/secure_vault_iot/blob/main/iot_vault.ino): `iot_vault.ino`

### Vault control

- [ESP32 state machine](https://github.com/kaveenamarasekara/secure_vault_iot/blob/main/iot_vault.ino): `iot_vault.ino`
- [15-second window](https://github.com/kaveenamarasekara/secure_vault_iot/blob/main/iot_vault.ino): `iot_vault.ino`
- [LCD prompts](https://github.com/kaveenamarasekara/secure_vault_iot/blob/main/iot_vault.ino): `iot_vault.ino`

### Alerts and logging

- [Buzzer and LED](https://github.com/kaveenamarasekara/secure_vault_iot/blob/main/iot_vault.ino): `iot_vault.ino`
- [MQTT logging](https://github.com/kaveenamarasekara/secure_vault_iot/blob/main/iot_vault.ino): `iot_vault.ino`

### Other components

- **User**
- **HiveMQ broker**

## Connections

- User → Door light sensor: opens door (evidence: `README.md`)
- User → Code dial: sets code (evidence: `README.md`)
- User → Confirm switch: confirms code (evidence: `README.md`)
- Door light sensor → ESP32 state machine: signals access (evidence: `README.md`)
- Code dial → ESP32 state machine: provides value (evidence: `README.md`)
- Confirm switch → ESP32 state machine: confirms entry (evidence: `README.md`)
- ESP32 state machine → 15-second window: starts window (evidence: `README.md`)
- ESP32 state machine → LCD prompts: shows prompt (evidence: `README.md`)
- ESP32 state machine → Buzzer and LED: triggers on breach (evidence: `README.md`)
- ESP32 state machine → MQTT logging: publishes events (evidence: `README.md`)
- MQTT logging → HiveMQ broker: sends logs (evidence: `README.md`)
