# raniahaas/tobi architecture

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

- Interactive diagram: https://gitdiagram.com/raniahaas/tobi
- Repository: https://github.com/raniahaas/tobi

## Overview

TOBI is an ESP32-S3 rocket flight computer. Its intended workflow is startup checks, Wi-Fi arming, instrument sampling, flight-event detection and deployment, then live telemetry and post-flight CSV access. The sampled firmware shows IMU sampling and event/deployment logic, but the barometer task is currently a delay-only stub, and the excerpts do not establish a complete CSV-close workflow. README capabilities such as redundancy and a future pyrotechnic system are not represented as implemented runtime components.

Main entry points: [`tobiru/src/main.cpp`](https://github.com/raniahaas/tobi/blob/main/tobiru/src/main.cpp) (Firmware tasks), [`tobiru/src/wifiSetup.h`](https://github.com/raniahaas/tobi/blob/main/tobiru/src/wifiSetup.h) (Wi-Fi server), [`tobiru/src/fileLogging.cpp`](https://github.com/raniahaas/tobi/blob/main/tobiru/src/fileLogging.cpp) (CSV logger), [`tobiru/src/globals.cpp`](https://github.com/raniahaas/tobi/blob/main/tobiru/src/globals.cpp) (Shared flight state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Startup &amp; State"]
  node_firmware["Firmware tasks<br/>[main.cpp]"]
  node_startup["Startup sequence<br/>[startupSeq.cpp]"]
  node_imuinit["IMU setup<br/>[imu_init.cpp]"]
  node_state[("Shared flight state<br/>[globals.cpp]")]
end

subgraph group_flight["Flight Runtime"]
  node_sampling["IMU sampling task<br/>[main.cpp]"]
  node_baroread["Barometer task<br/>[main.cpp]"]
  node_detection["Event &amp; landing logic<br/>[main.cpp]"]
end

subgraph group_storage["Logging &amp; Data"]
  node_logger["CSV logger<br/>[fileLogging.cpp]"]
  node_filesystem[("LittleFS files")]
end

subgraph group_interface["Wi-Fi Interface"]
  node_wifi["Wi-Fi server<br/>[wifiSetup.h]"]
  node_dashboard["Telemetry dashboard<br/>[wifiSetup.h]"]
end

node_user(("Rocket operator"))
node_imu{{"IMU sensor"}}
node_barometer{{"Barometer"}}
node_battery{{"Battery monitor"}}
node_pyro{{"Deployment outputs"}}
node_browser(("Operator browser"))

node_firmware -->|"runs startup"| node_startup
node_startup -->|"checks voltage"| node_battery
node_startup -->|"initializes IMU"| node_imuinit
node_imuinit -->|"configures"| node_imu
node_firmware -->|"starts server"| node_wifi
node_firmware -->|"initializes logger"| node_logger
node_firmware -->|"creates task"| node_sampling
node_firmware -->|"creates task"| node_baroread
node_firmware -->|"creates task"| node_detection
node_sampling -->|"reads samples"| node_imu
node_sampling -->|"updates readings"| node_state
node_sampling -->|"logs samples"| node_logger
node_baroread -.->|"intended update"| node_state
node_detection -->|"reads readings"| node_state
node_detection -->|"records events"| node_logger
node_detection -->|"fires channels"| node_pyro
node_logger -->|"writes CSV"| node_filesystem
node_wifi -->|"reads and updates"| node_state
node_wifi -->|"arms logging"| node_logger
node_wifi -->|"serves CSV"| node_filesystem
node_browser -->|"opens dashboard"| node_dashboard
node_dashboard -->|"polls and controls"| node_wifi
node_wifi -->|"returns telemetry"| node_dashboard

click node_firmware "https://github.com/raniahaas/tobi/blob/main/tobiru/src/main.cpp"
click node_startup "https://github.com/raniahaas/tobi/blob/main/tobiru/src/startup/startupSeq.cpp"
click node_imuinit "https://github.com/raniahaas/tobi/blob/main/tobiru/src/startup/imu_init.cpp"
click node_state "https://github.com/raniahaas/tobi/blob/main/tobiru/src/globals.cpp"
click node_sampling "https://github.com/raniahaas/tobi/blob/main/tobiru/src/main.cpp"
click node_baroread "https://github.com/raniahaas/tobi/blob/main/tobiru/src/main.cpp"
click node_detection "https://github.com/raniahaas/tobi/blob/main/tobiru/src/main.cpp"
click node_logger "https://github.com/raniahaas/tobi/blob/main/tobiru/src/fileLogging.cpp"
click node_wifi "https://github.com/raniahaas/tobi/blob/main/tobiru/src/wifiSetup.h"
click node_dashboard "https://github.com/raniahaas/tobi/blob/main/tobiru/src/wifiSetup.h"

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_startup,node_imuinit,node_state,node_browser toneBlue
class node_sampling,node_baroread,node_detection toneAmber
class node_logger,node_filesystem toneMint
class node_wifi,node_dashboard toneRose
class node_user,node_imu,node_barometer,node_battery,node_pyro toneIndigo
```

## Components

### Startup & State

- [Firmware tasks](https://github.com/raniahaas/tobi/blob/main/tobiru/src/main.cpp): `tobiru/src/main.cpp`
- [Startup sequence](https://github.com/raniahaas/tobi/blob/main/tobiru/src/startup/startupSeq.cpp): `tobiru/src/startup/startupSeq.cpp`
- [IMU setup](https://github.com/raniahaas/tobi/blob/main/tobiru/src/startup/imu_init.cpp): `tobiru/src/startup/imu_init.cpp`
- [Shared flight state](https://github.com/raniahaas/tobi/blob/main/tobiru/src/globals.cpp): `tobiru/src/globals.cpp`

### Flight Runtime

- [IMU sampling task](https://github.com/raniahaas/tobi/blob/main/tobiru/src/main.cpp): `tobiru/src/main.cpp`
- [Barometer task](https://github.com/raniahaas/tobi/blob/main/tobiru/src/main.cpp): `tobiru/src/main.cpp`
- [Event & landing logic](https://github.com/raniahaas/tobi/blob/main/tobiru/src/main.cpp): `tobiru/src/main.cpp`

### Logging & Data

- [CSV logger](https://github.com/raniahaas/tobi/blob/main/tobiru/src/fileLogging.cpp): `tobiru/src/fileLogging.cpp`
- **LittleFS files**

### Wi-Fi Interface

- [Wi-Fi server](https://github.com/raniahaas/tobi/blob/main/tobiru/src/wifiSetup.h): `tobiru/src/wifiSetup.h`
- [Telemetry dashboard](https://github.com/raniahaas/tobi/blob/main/tobiru/src/wifiSetup.h): `tobiru/src/wifiSetup.h`

### Other components

- **Rocket operator**
- **IMU sensor**
- **Barometer**
- **Battery monitor**
- **Deployment outputs**
- **Operator browser**

## Connections

- Firmware tasks → Startup sequence: runs startup
- Startup sequence → Battery monitor: checks voltage
- Startup sequence → IMU setup: initializes IMU
- IMU setup → IMU sensor: configures
- Firmware tasks → Wi-Fi server: starts server
- Firmware tasks → CSV logger: initializes logger
- Firmware tasks → IMU sampling task: creates task
- Firmware tasks → Barometer task: creates task
- Firmware tasks → Event & landing logic: creates task
- IMU sampling task → IMU sensor: reads samples
- IMU sampling task → Shared flight state: updates readings
- IMU sampling task → CSV logger: logs samples
- Barometer task → Shared flight state: intended update
- Event & landing logic → Shared flight state: reads readings
- Event & landing logic → CSV logger: records events
- Event & landing logic → Deployment outputs: fires channels
- CSV logger → LittleFS files: writes CSV
- Wi-Fi server → Shared flight state: reads and updates
- Wi-Fi server → CSV logger: arms logging
- Wi-Fi server → LittleFS files: serves CSV
- Operator browser → Telemetry dashboard: opens dashboard
- Telemetry dashboard → Wi-Fi server: polls and controls
- Wi-Fi server → Telemetry dashboard: returns telemetry
