# Sensor Signal Monitoring System

This project is composed of two main components:

### 1. Microcontroller Firmware (Arduino)
Located in the `firmware/` folder, this Arduino sketch handles:
- Sensor signal acquisition
- Optional filtering or preprocessing
- Sending data over serial (USB) to the host PC

### 2. Python HMI Application
Located in the `hmi/` folder, this is a PyQt-based GUI that:
- Connects to the serial port
- Parses and displays sensor data in real time
- Optionally logs or processes the incoming data

### Communication
The Arduino and the Python HMI communicate via a serial link (e.g., USB virtual COM port). Data is structured in a simple format such as CSV, JSON, or newline-delimited strings.


# 🔧 Leak Test HMI

A Python-based Human-Machine Interface (HMI) for monitoring and analyzing pressure data from an Arduino device via serial communication.

---

## 📌 Description

This application:
- Plots real-time pressure readings from an Arduino
- Allows setting test criteria (start/end pressure and time window)
- Performs leak test analysis
- Saves results, raw data, and screenshots

---

## 🖼️ Features

- **Live Pressure Plotting** using PyQt6 and pyqtgraph
- **Automatic Arduino Detection** (via USB serial)
- **Setpoint Configuration** (start/end thresholds)
- **Test Window Cursors** to select analysis interval (`dT`)
- **Automated Analysis** with pass/fail result based on drop rate
- **Marker Sampling** at regular time intervals
- **Data Export** (CSV summary + detailed data)
- **Screenshot Capture** upon analysis

---

## 🧪 UI Controls

| Control | Description |
|--------|-------------|
| **Setpoint Start [kPa]** | Target pressure before leak |
| **Setpoint End [kPa]** | Minimum pressure after test |
| **dT [sec]** | Duration between cursors for analysis |
| **Analyze** | Executes analysis, saves data & screenshot |
| **Stack No** | Test or batch identifier |
| **Comments** | Notes saved with test |
| **Sample Time [sec]** | Frequency of vertical markers |
| **Test Result** | Displays PASS/FAIL with drop rate |

---

## 💾 Output Files

- `leak_test_summary.csv`: Summary of test results
- `leak_test_data_ST<stack>_YYYY-MM-DD_HH-MM-SS.csv`: Marker-sampled pressure data
- `screenshot_<same_as_csv>.png`: Screenshot of graph + UI

---

## 📦 Requirements

Install dependencies with:

```bash
pip install pyqt6 pyqtgraph pandas pyserial
