# zuhayrl/eee4022s_thesis architecture

> Architecture diagram of the GitHub repository zuhayrl/eee4022s_thesis, 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/zuhayrl/eee4022s_thesis
- Repository: https://github.com/zuhayrl/eee4022s_thesis

## Overview

This repository is a thesis project for a salinity-measurement system, with controller firmware, salinity calculations, probe/controller hardware designs, and related analysis notebooks and plotting. The intended user workflow is to measure a sample with the probe, acquire signals through the controller, and derive salinity. The supplied excerpts verify the voltage-to-salinity calculation pipeline and CSV voltage plotting; firmware-to-hardware and ML runtime connections are not shown, so those links are omitted. The top-level README provides no further capability or workflow detail.

Main entry points: [`Code/Salinity_Testing/salinity.cpp`](https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Salinity_Testing/salinity.cpp) (Voltage conversion), [`Code/Salinity_Controller/Salinity_Controller.ino`](https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Salinity_Controller/Salinity_Controller.ino) (Controller firmware), [`Code/Salinity_Testing/Salinity_Testing.ino`](https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Salinity_Testing/Salinity_Testing.ino) (Salinity test firmware), [`Code/Salinity_Testing/salinity.h`](https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Salinity_Testing/salinity.h) (Salinity API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_measurement["Measurement firmware"]
  node_controller_firmware["Controller firmware"]
  node_testing_firmware["Salinity test firmware"]
  node_calibration_firmware["Calibration test<br/>[main.c]"]
  node_adc_dac_test["ADC/DAC test<br/>[ADC_DAC_Test.ino]"]
  node_dac_serial_test["DAC serial test"]
end

subgraph group_calculation["Salinity calculation"]
  node_voltage_calc["Voltage conversion<br/>[salinity.cpp]"]
  node_conductivity_calc["Conductivity conversion<br/>[salinity.cpp]"]
  node_salinity_calc["PSS-78 salinity<br/>[salinity.cpp]"]
  node_salinity_api["Salinity API<br/>[salinity.h]"]
end

subgraph group_hardware["Measurement hardware"]
  node_probe_pcb["Probe PCB<br/>[probe.kicad_pcb]"]
  node_electrode_pcb["Electrode PCB"]
  node_controller_pcb["Controller PCB"]
end

subgraph group_analysis["Data analysis"]
  node_voltage_plotter["Voltage CSV plotter<br/>[voltage_plotter.py]"]
  node_salinity_ml["Salinity ML notebook<br/>[salinity_ml.ipynb]"]
  node_permittivity_ml["Permittivity notebook"]
end

node_operator(("Operator"))

node_operator -.->|"operates"| node_controller_firmware
node_controller_firmware -.->|"acquires from"| node_probe_pcb
node_controller_firmware -.->|"converts readings"| node_voltage_calc
node_testing_firmware -.->|"uses calculations"| node_voltage_calc
node_voltage_calc -->|"computes next"| node_conductivity_calc
node_conductivity_calc -->|"feeds conductivity"| node_salinity_calc
node_voltage_calc -->|"calls salinity pipeline"| node_salinity_calc
node_salinity_api -->|"declares interface"| node_voltage_calc
node_operator -->|"selects CSV"| node_voltage_plotter

click node_controller_firmware "https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Salinity_Controller/Salinity_Controller.ino"
click node_testing_firmware "https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Salinity_Testing/Salinity_Testing.ino"
click node_voltage_calc "https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Salinity_Testing/salinity.cpp"
click node_conductivity_calc "https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Salinity_Testing/salinity.cpp"
click node_salinity_calc "https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Salinity_Testing/salinity.cpp"
click node_salinity_api "https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Salinity_Testing/salinity.h"
click node_probe_pcb "https://github.com/zuhayrl/eee4022s_thesis/blob/main/PCB/Probe/probe_v5-0/probe.kicad_pcb"
click node_electrode_pcb "https://github.com/zuhayrl/eee4022s_thesis/blob/main/PCB/GoldElectrodes/GoldElectrode_v2-0/GoldElectrode.kicad_pcb"
click node_controller_pcb "https://github.com/zuhayrl/eee4022s_thesis/blob/main/PCB/Controller/controller_v2-0/controller.kicad_pcb"
click node_calibration_firmware "https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Tests/CalibrationTest-ESPIDF/src/main.c"
click node_adc_dac_test "https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Tests/ADC_DAC_Test/ADC_DAC_Test.ino"
click node_dac_serial_test "https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Tests/ESPS2_DAC_Test_serial/ESPS2_DAC_Test_serial.ino"
click node_voltage_plotter "https://github.com/zuhayrl/eee4022s_thesis/blob/main/Testing/AC_Plotting/voltage_plotter.py"
click node_salinity_ml "https://github.com/zuhayrl/eee4022s_thesis/blob/main/MachineLearning/Salinity_ML/salinity_ml.ipynb"
click node_permittivity_ml "https://github.com/zuhayrl/eee4022s_thesis/blob/main/MachineLearning/RC_ML/permittivity_test.ipynb"

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_controller_firmware,node_testing_firmware,node_calibration_firmware,node_adc_dac_test,node_dac_serial_test toneBlue
class node_voltage_calc,node_conductivity_calc,node_salinity_calc,node_salinity_api toneAmber
class node_probe_pcb,node_electrode_pcb,node_controller_pcb toneMint
class node_voltage_plotter,node_salinity_ml,node_permittivity_ml toneRose
class node_operator toneIndigo
```

## Components

### Measurement firmware

- [Controller firmware](https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Salinity_Controller/Salinity_Controller.ino): `Code/Salinity_Controller/Salinity_Controller.ino`
- [Salinity test firmware](https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Salinity_Testing/Salinity_Testing.ino): `Code/Salinity_Testing/Salinity_Testing.ino`
- [Calibration test](https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Tests/CalibrationTest-ESPIDF/src/main.c): `Code/Tests/CalibrationTest-ESPIDF/src/main.c`
- [ADC/DAC test](https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Tests/ADC_DAC_Test/ADC_DAC_Test.ino): `Code/Tests/ADC_DAC_Test/ADC_DAC_Test.ino`
- [DAC serial test](https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Tests/ESPS2_DAC_Test_serial/ESPS2_DAC_Test_serial.ino): `Code/Tests/ESPS2_DAC_Test_serial/ESPS2_DAC_Test_serial.ino`

### Salinity calculation

- [Voltage conversion](https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Salinity_Testing/salinity.cpp): `Code/Salinity_Testing/salinity.cpp`
- [Conductivity conversion](https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Salinity_Testing/salinity.cpp): `Code/Salinity_Testing/salinity.cpp`
- [PSS-78 salinity](https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Salinity_Testing/salinity.cpp): `Code/Salinity_Testing/salinity.cpp`
- [Salinity API](https://github.com/zuhayrl/eee4022s_thesis/blob/main/Code/Salinity_Testing/salinity.h): `Code/Salinity_Testing/salinity.h`

### Measurement hardware

- [Probe PCB](https://github.com/zuhayrl/eee4022s_thesis/blob/main/PCB/Probe/probe_v5-0/probe.kicad_pcb): `PCB/Probe/probe_v5-0/probe.kicad_pcb`
- [Electrode PCB](https://github.com/zuhayrl/eee4022s_thesis/blob/main/PCB/GoldElectrodes/GoldElectrode_v2-0/GoldElectrode.kicad_pcb): `PCB/GoldElectrodes/GoldElectrode_v2-0/GoldElectrode.kicad_pcb`
- [Controller PCB](https://github.com/zuhayrl/eee4022s_thesis/blob/main/PCB/Controller/controller_v2-0/controller.kicad_pcb): `PCB/Controller/controller_v2-0/controller.kicad_pcb`

### Data analysis

- [Voltage CSV plotter](https://github.com/zuhayrl/eee4022s_thesis/blob/main/Testing/AC_Plotting/voltage_plotter.py): `Testing/AC_Plotting/voltage_plotter.py`
- [Salinity ML notebook](https://github.com/zuhayrl/eee4022s_thesis/blob/main/MachineLearning/Salinity_ML/salinity_ml.ipynb): `MachineLearning/Salinity_ML/salinity_ml.ipynb`
- [Permittivity notebook](https://github.com/zuhayrl/eee4022s_thesis/blob/main/MachineLearning/RC_ML/permittivity_test.ipynb): `MachineLearning/RC_ML/permittivity_test.ipynb`

### Other components

- **Operator**

## Connections

- Operator → Controller firmware: operates
- Controller firmware → Probe PCB: acquires from
- Controller firmware → Voltage conversion: converts readings
- Salinity test firmware → Voltage conversion: uses calculations
- Voltage conversion → Conductivity conversion: computes next (evidence: `Code/Salinity_Testing/salinity.cpp`)
- Conductivity conversion → PSS-78 salinity: feeds conductivity (evidence: `Code/Salinity_Testing/salinity.cpp`)
- Voltage conversion → PSS-78 salinity: calls salinity pipeline (evidence: `Code/Salinity_Testing/salinity.cpp`)
- Salinity API → Voltage conversion: declares interface (evidence: `Code/Salinity_Testing/salinity.h`)
- Operator → Voltage CSV plotter: selects CSV (evidence: `Testing/AC_Plotting/voltage_plotter.py`)
