# froods/isous architecture

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

- Interactive diagram: https://gitdiagram.com/froods/isous
- Repository: https://github.com/froods/isous

## Overview

1. **Repository shape**
   - This is a two-part system: a **Python GUI** in `GUI/` and **embedded firmware** in `embedded/`.
   - The architecture is not a pure software service; it is a **host application + microcontroller firmware** setup with a hardware control loop on the embedded side.

2. **Top-level responsibility split**
   - The **GUI** is the operator-facing client: it starts the app, renders pages, and sends/receives control data.
   - The **embedded firmware** owns the real-time hardware side: sensor reading, actuator control, and local orchestration logic.

3. **GUI subsystem**
   - `GUI/main.py` is the entry point.
   - `GUI/pages.py` likely defines the screen/page structure of the interface.
   - `GUI/client.py` is the communication layer between the GUI and the embedded controller.
   - The GUI depends on Python packages from `requirements.txt`, and the README shows it is run with a local Python environment.

4. **Embedded application entry and orchestration**
   - `embedded/src/main.cpp` is the firmware entry point.
   - `embedded/src/ISOUScontroller.cpp` and `embedded/include/ISOUScontroller.h` appear to be the central orchestration layer, coordinating sensors, settings, and actuators.
   - This suggests a controller pattern where `ISOUScontroller` is the main application object rather than logic being spread across `main.cpp`.

5. **Hardware abstraction layer**
   - `embedded/src/I2C.cpp` plus `embedded/include/I2C.h` provide low-level bus access used by multiple peripherals.
   - `embedded/src/UARTinterface.cpp` plus `embedded/include/UARTinterface.h` provide the communication channel, likely used to talk to the Python GUI.
   - These are the key boundaries between application logic and hardware/protocol details.

6. **Sensors**
   - `SCD30` is a CO2 sensor driver.
   - `TSL2561` is a light sensor driver.
   - `lm75` is a temperature sensor driver.
   - These drivers likely feed the controller with environmental measurements used for automation and display in the GUI.

7. **Actuators / physical outputs**
   - `curtain_driver` and `window_driver` indicate the firmware can physically move curtains and windows.
   - That means the embedded side is not only monitoring; it also performs **actuation** based on sensor values and settings.
   - In the architecture diagram, these are downstream outputs from the controller.

8. **Settings and domain model**
   - `UserSettings` and `CO2Setting` show a dedicated settings layer separate from raw hardware drivers.
   - This layer likely stores thresholds, modes, or user preferences that influence controller behavior.
   - It is the main bridge between operator intent from the GUI and embedded control decisions.

9. **End-to-end data flow**
   - Sensor data comes from the hardware drivers into `ISOUScontroller`.
   - The controller evaluates settings and current readings, then drives windows/curtains as needed.
   - The GUI communicates with the embedded firmware through `client.py` / `UARTinterface`, likely to show status and change settings.
   - So the main loop is: **hardware → embedded controller → communication layer → GUI**, with commands flowing back in the opposite direction.

10. **Build/runtime boundaries**
   - The embedded side is a **PlatformIO** project (`embedded/platformio.ini`), which strongly suggests a microcontroller build and flash workflow.
   - The GUI side is a separate Python runtime with its own dependency management and startup path.
   - These are independent deployment targets, so the diagram should show them as two runtimes connected by a serial/UART link.

11. **Operational artifacts**
   - `isous.log` implies the system produces logs, likely from the GUI or integration runs.
   - `setup.sh` suggests there is a convenience bootstrap script for the development environment.

12. **Most important architectural takeaway**
   - The repo centers on a **closed-loop environmental control system**: the embedded controller reads physical sensors, decides on actions, and controls actuators, while the Python GUI acts as the human interface for monitoring and configuration.

Main entry points: [`embedded/src/ISOUScontroller.cpp`](https://github.com/froods/isous/blob/main/embedded/src/ISOUScontroller.cpp) (Controller), [`embedded/src/I2C.cpp`](https://github.com/froods/isous/blob/main/embedded/src/I2C.cpp) (I2C bus), [`GUI/main.py`](https://github.com/froods/isous/blob/main/GUI/main.py) (Main app), [`README.md`](https://github.com/froods/isous/blob/main/README.md) (README)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gui["Python GUI"]
  node_gui_main["Main app<br/>python entrypoint<br/>[main.py]"]
  node_gui_pages["Pages<br/>ui screens<br/>[pages.py]"]
  node_gui_client["Client<br/>gui comms<br/>[client.py]"]
  node_gui_reqs["Python deps<br/>runtime deps<br/>[requirements.txt]"]
end

subgraph group_firmware["Embedded firmware"]
  node_fw_main["Firmware main<br/>cpp entrypoint<br/>[main.cpp]"]
  node_fw_controller["Controller<br/>control core"]
  node_fw_settings["Settings<br/>domain config<br/>[UserSettings.cpp]"]
  node_platformio["PlatformIO<br/>build system<br/>[platformio.ini]"]
end

subgraph group_hal["Hardware access"]
  node_fw_uart["UART interface<br/>protocol layer<br/>[UARTinterface.cpp]"]
  node_fw_i2c["I2C bus<br/>bus layer<br/>[I2C.cpp]"]
end

subgraph group_devices["Devices"]
  node_sensor_co2(("SCD30<br/>co2 sensor<br/>[SCD30.cpp]"))
  node_sensor_light(("TSL2561<br/>light sensor<br/>[TSL2561.cpp]"))
  node_sensor_temp(("lm75<br/>temp sensor<br/>[lm75.cpp]"))
  node_act_curtain["Curtain driver<br/>actuator<br/>[curtain_driver.cpp]"]
  node_act_window["Window driver<br/>actuator<br/>[window_driver.cpp]"]
end

node_repo_readme["README<br/>docs<br/>[README.md]"]
node_setup_script["Setup script<br/>bootstrap<br/>[setup.sh]"]

node_gui_main -->|"renders"| node_gui_pages
node_gui_main -->|"uses"| node_gui_client
node_gui_main -.->|"depends on"| node_gui_reqs
node_gui_client -->|"serial link"| node_fw_uart
node_fw_main -->|"boots"| node_fw_controller
node_fw_controller -->|"reads"| node_fw_settings
node_fw_controller -->|"accesses"| node_fw_i2c
node_fw_controller -->|"publishes"| node_fw_uart
node_fw_i2c -->|"drives"| node_sensor_co2
node_fw_i2c -->|"drives"| node_sensor_light
node_fw_i2c -->|"drives"| node_sensor_temp
node_fw_controller -->|"controls"| node_act_curtain
node_fw_controller -->|"controls"| node_act_window
node_platformio -.->|"builds"| node_fw_main
node_repo_readme -.->|"documents"| node_gui_main
node_repo_readme -.->|"documents"| node_fw_controller
node_setup_script -.->|"installs"| node_gui_reqs

click node_gui_main "https://github.com/froods/isous/blob/main/GUI/main.py"
click node_gui_pages "https://github.com/froods/isous/blob/main/GUI/pages.py"
click node_gui_client "https://github.com/froods/isous/blob/main/GUI/client.py"
click node_gui_reqs "https://github.com/froods/isous/blob/main/requirements.txt"
click node_fw_main "https://github.com/froods/isous/blob/main/embedded/src/main.cpp"
click node_fw_controller "https://github.com/froods/isous/blob/main/embedded/src/ISOUScontroller.cpp"
click node_fw_settings "https://github.com/froods/isous/blob/main/embedded/src/UserSettings.cpp"
click node_fw_uart "https://github.com/froods/isous/blob/main/embedded/src/UARTinterface.cpp"
click node_fw_i2c "https://github.com/froods/isous/blob/main/embedded/src/I2C.cpp"
click node_sensor_co2 "https://github.com/froods/isous/blob/main/embedded/src/SCD30.cpp"
click node_sensor_light "https://github.com/froods/isous/blob/main/embedded/src/TSL2561.cpp"
click node_sensor_temp "https://github.com/froods/isous/blob/main/embedded/src/lm75.cpp"
click node_act_curtain "https://github.com/froods/isous/blob/main/embedded/src/curtain_driver.cpp"
click node_act_window "https://github.com/froods/isous/blob/main/embedded/src/window_driver.cpp"
click node_platformio "https://github.com/froods/isous/blob/main/embedded/platformio.ini"
click node_repo_readme "https://github.com/froods/isous/blob/main/README.md"
click node_setup_script "https://github.com/froods/isous/blob/main/setup.sh"

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_gui_main,node_gui_pages,node_gui_client,node_gui_reqs toneBlue
class node_fw_main,node_fw_controller,node_fw_settings,node_platformio toneAmber
class node_fw_uart,node_fw_i2c toneMint
class node_sensor_co2,node_sensor_light,node_sensor_temp,node_act_curtain,node_act_window toneRose
class node_repo_readme,node_setup_script toneNeutral
```

## Components

### Python GUI

Operator-facing desktop client runtime

- [Main app](https://github.com/froods/isous/blob/main/GUI/main.py): python entrypoint · Starts the GUI runtime and application flow · `GUI/main.py`
- [Pages](https://github.com/froods/isous/blob/main/GUI/pages.py): ui screens · Defines the page and screen structure of the interface · `GUI/pages.py`
- [Client](https://github.com/froods/isous/blob/main/GUI/client.py): gui comms · Handles communication between the GUI and the embedded controller · `GUI/client.py`
- [Python deps](https://github.com/froods/isous/blob/main/requirements.txt): runtime deps · Python package requirements for the GUI runtime · `requirements.txt`

### Embedded firmware

Microcontroller control runtime

- [Firmware main](https://github.com/froods/isous/blob/main/embedded/src/main.cpp): cpp entrypoint · Microcontroller entry point and startup wiring · `embedded/src/main.cpp`
- [Controller](https://github.com/froods/isous/blob/main/embedded/src/ISOUScontroller.cpp): control core · Central orchestration layer for readings, settings, and actuation · `embedded/src/ISOUScontroller.cpp`
- [Settings](https://github.com/froods/isous/blob/main/embedded/src/UserSettings.cpp): domain config · User and CO2 settings that guide controller behavior · `embedded/src/UserSettings.cpp`
- [PlatformIO](https://github.com/froods/isous/blob/main/embedded/platformio.ini): build system · Embedded build and flash environment · `embedded/platformio.ini`

### Hardware access

Low-level bus and protocol boundaries

- [UART interface](https://github.com/froods/isous/blob/main/embedded/src/UARTinterface.cpp): protocol layer · Serial communication boundary used to exchange data with the GUI · `embedded/src/UARTinterface.cpp`
- [I2C bus](https://github.com/froods/isous/blob/main/embedded/src/I2C.cpp): bus layer · Low-level I2C access shared by sensor peripherals · `embedded/src/I2C.cpp`

### Devices

Sensors and actuators on the embedded side

- [SCD30](https://github.com/froods/isous/blob/main/embedded/src/SCD30.cpp): co2 sensor · CO2 sensing driver · `embedded/src/SCD30.cpp`
- [TSL2561](https://github.com/froods/isous/blob/main/embedded/src/TSL2561.cpp): light sensor · Ambient light sensing driver · `embedded/src/TSL2561.cpp`
- [lm75](https://github.com/froods/isous/blob/main/embedded/src/lm75.cpp): temp sensor · Temperature sensing driver · `embedded/src/lm75.cpp`
- [Curtain driver](https://github.com/froods/isous/blob/main/embedded/src/curtain_driver.cpp): actuator · Controls curtain movement as a physical output · `embedded/src/curtain_driver.cpp`
- [Window driver](https://github.com/froods/isous/blob/main/embedded/src/window_driver.cpp): actuator · Controls window movement as a physical output · `embedded/src/window_driver.cpp`

### Other components

- [README](https://github.com/froods/isous/blob/main/README.md): docs · Top-level project overview and usage notes · `README.md`
- [Setup script](https://github.com/froods/isous/blob/main/setup.sh): bootstrap · Convenience script for local development setup · `setup.sh`

## Connections

- Main app → Pages: renders · Main app loads the page structure for the interface
- Main app → Client: uses · Main app delegates device communication to the client layer
- Main app → Python deps: depends on · GUI runtime relies on installed Python dependencies
- Client → UART interface: serial link · Client exchanges control and status data with firmware over UART
- Firmware main → Controller: boots · Firmware entry point initializes the central controller
- Controller → Settings: reads · Controller uses user and threshold settings for decisions
- Controller → I2C bus: accesses · Controller reaches sensors through the shared I2C boundary
- Controller → UART interface: publishes · Controller exposes status and accepts remote commands via UART
- I2C bus → SCD30: drives · I2C bus supports the CO2 sensor driver
- I2C bus → TSL2561: drives · I2C bus supports the light sensor driver
- I2C bus → lm75: drives · I2C bus supports the temperature sensor driver
- Controller → Curtain driver: controls · Controller commands curtain actuation
- Controller → Window driver: controls · Controller commands window actuation
- PlatformIO → Firmware main: builds · PlatformIO builds the embedded firmware
- README → Main app: documents · Project docs describe the GUI runtime
- README → Controller: documents · Project docs describe the embedded control loop
- Setup script → Python deps: installs · Setup bootstrap likely prepares the Python environment
