# bbz-aifs51/lf7-projekt_gas architecture

> Architecture diagram of the GitHub repository bbz-aifs51/lf7-projekt_gas, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bbz-aifs51/lf7-projekt_gas
- Repository: https://github.com/bbz-aifs51/lf7-projekt_gas

## Overview

This repository is a small Arduino alarm-system project with a companion interactive 3D build viewer. The physical workflow is: enter a PIN or present a stored RFID card to arm/disarm; after the exit delay, motion or repeated invalid credentials can trigger the alarm, which is shown and sounded on the device. The browser viewer presents the same states and timings interactively and includes the printed enclosure. Firmware internals and viewer wiring are not sampled here, so the graph uses README-documented relationships and omits unverified calls.

Main entry points: [`Code/alarm_system/alarm_system.ino`](https://github.com/bbz-aifs51/lf7-projekt_gas/blob/main/Code/alarm_system/alarm_system.ino) (Alarm state machine), [`docs/viewer/index.html`](https://github.com/bbz-aifs51/lf7-projekt_gas/blob/main/docs/viewer/index.html) (Interactive model), [`Gehaeuse/stl`](https://github.com/bbz-aifs51/lf7-projekt_gas/tree/main/Gehaeuse/stl) (Printed parts), [`Gehaeuse/gehaeuse.scad`](https://github.com/bbz-aifs51/lf7-projekt_gas/blob/main/Gehaeuse/gehaeuse.scad) (Enclosure design)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_firmware["Alarm firmware"]
  node_firmware["Alarm state machine<br/>[alarm_system.ino]"]
  node_credentials["PIN and RFID<br/>[alarm_system.ino]"]
  node_admin["Card administration<br/>[alarm_system.ino]"]
end

subgraph group_physical["Physical device"]
  node_credential_io["Keypad and reader"]
  node_motion["Motion sensor"]
  node_feedback["OLED and buzzer"]
  node_eeprom[("Card storage")]
end

subgraph group_viewer["3D viewer"]
  node_viewer["Interactive model<br/>[index.html]"]
  node_viewer_enclosure["Enclosure geometry data<br/>[enclosure.js]"]
end

subgraph group_enclosure["Printed enclosure"]
  node_cad["Enclosure design<br/>[gehaeuse.scad]"]
  node_stls["Printed parts"]
end

node_user(("Occupant"))
node_browser_user(("Viewer user"))

node_user -->|"enters credentials"| node_credential_io
node_credential_io -->|"supplies credentials"| node_credentials
node_credentials -->|"arms or disarms"| node_firmware
node_motion -->|"triggers when armed"| node_firmware
node_firmware -->|"signals state and alarm"| node_feedback
node_firmware -->|"reads and writes cards"| node_eeprom
node_admin -->|"manages stored cards"| node_eeprom
node_user -->|"opens menu"| node_admin
node_browser_user -->|"interacts with"| node_viewer
node_viewer -->|"shows enclosure data"| node_viewer_enclosure
node_viewer -->|"reuses logic"| node_firmware
node_viewer -->|"models real parts"| node_stls
node_cad -.->|"defines printed parts"| node_stls

click node_firmware "https://github.com/bbz-aifs51/lf7-projekt_gas/blob/main/Code/alarm_system/alarm_system.ino"
click node_credentials "https://github.com/bbz-aifs51/lf7-projekt_gas/blob/main/Code/alarm_system/alarm_system.ino"
click node_admin "https://github.com/bbz-aifs51/lf7-projekt_gas/blob/main/Code/alarm_system/alarm_system.ino"
click node_viewer "https://github.com/bbz-aifs51/lf7-projekt_gas/blob/main/docs/viewer/index.html"
click node_viewer_enclosure "https://github.com/bbz-aifs51/lf7-projekt_gas/blob/main/docs/viewer/enclosure.js"
click node_cad "https://github.com/bbz-aifs51/lf7-projekt_gas/blob/main/Gehaeuse/gehaeuse.scad"
click node_stls "https://github.com/bbz-aifs51/lf7-projekt_gas/tree/main/Gehaeuse/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_firmware,node_credentials,node_admin,node_browser_user toneBlue
class node_credential_io,node_motion,node_feedback,node_eeprom toneAmber
class node_viewer,node_viewer_enclosure toneMint
class node_cad,node_stls toneRose
class node_user toneIndigo
```

## Components

### Alarm firmware

- [Alarm state machine](https://github.com/bbz-aifs51/lf7-projekt_gas/blob/main/Code/alarm_system/alarm_system.ino): `Code/alarm_system/alarm_system.ino`
- [PIN and RFID](https://github.com/bbz-aifs51/lf7-projekt_gas/blob/main/Code/alarm_system/alarm_system.ino): `Code/alarm_system/alarm_system.ino`
- [Card administration](https://github.com/bbz-aifs51/lf7-projekt_gas/blob/main/Code/alarm_system/alarm_system.ino): `Code/alarm_system/alarm_system.ino`

### Physical device

- **Keypad and reader**
- **Motion sensor**
- **OLED and buzzer**
- **Card storage**

### 3D viewer

- [Interactive model](https://github.com/bbz-aifs51/lf7-projekt_gas/blob/main/docs/viewer/index.html): `docs/viewer/index.html`
- [Enclosure geometry data](https://github.com/bbz-aifs51/lf7-projekt_gas/blob/main/docs/viewer/enclosure.js): `docs/viewer/enclosure.js`

### Printed enclosure

- [Enclosure design](https://github.com/bbz-aifs51/lf7-projekt_gas/blob/main/Gehaeuse/gehaeuse.scad): `Gehaeuse/gehaeuse.scad`
- [Printed parts](https://github.com/bbz-aifs51/lf7-projekt_gas/tree/main/Gehaeuse/stl): `Gehaeuse/stl`

### Other components

- **Occupant**
- **Viewer user**

## Connections

- Occupant → Keypad and reader: enters credentials (evidence: `README.md`)
- Keypad and reader → PIN and RFID: supplies credentials (evidence: `README.md`)
- PIN and RFID → Alarm state machine: arms or disarms (evidence: `README.md`)
- Motion sensor → Alarm state machine: triggers when armed (evidence: `README.md`)
- Alarm state machine → OLED and buzzer: signals state and alarm (evidence: `README.md`)
- Alarm state machine → Card storage: reads and writes cards (evidence: `README.md`)
- Card administration → Card storage: manages stored cards (evidence: `README.md`)
- Occupant → Card administration: opens menu (evidence: `README.md`)
- Viewer user → Interactive model: interacts with (evidence: `README.md`)
- Interactive model → Enclosure geometry data: shows enclosure data (evidence: `README.md`)
- Interactive model → Alarm state machine: reuses logic (evidence: `README.md`)
- Interactive model → Printed parts: models real parts (evidence: `README.md`)
- Enclosure design → Printed parts: defines printed parts
