A professional desktop GUI application for real-time hardware signal analysis. Built with Python, PyQt5, and PyQtGraph.
- Real-time Signal Monitoring: Monitor voltage, current, frequency, and power signals in real-time
- Serial Port Communication: Read data from hardware devices via serial ports
- JSON Frame Parsing: Parse JSON-formatted data frames from hardware
- Live Visualization: Real-time plotting using PyQtGraph with professional dark theme
- Threshold Management: Configure min/max thresholds for each signal type
- Violation Detection: Automatic detection and logging of threshold violations
- Test Sessions: Start/stop test sessions with pass/fail status tracking
- SQLite Storage: Persistent storage of all readings, violations, and test sessions
- Report Export: Export test reports in both TXT and HTML formats
- Demo Mode: Built-in demo mode with mock data for testing without hardware
- Modular Architecture: Clean, well-documented code with separation of concerns
The application features a professional dark theme with real-time plots for all signals:
- Voltage Plot (green): Real-time voltage monitoring
- Current Plot (orange): Real-time current monitoring
- Frequency Plot (cyan): Real-time frequency monitoring
- Power Plot (magenta): Real-time power monitoring (calculated as V × I)
The interface includes:
- Connection controls for serial port configuration
- Test session management (Start/Stop/Pass/Fail)
- Tabbed interface for plots, thresholds, and violations
- Status bar with real-time statistics
- Export functionality for generating reports
- Python 3.7 or higher
- pip package manager
pip install -r requirements.txt- PyQt5 >= 5.15.0 - GUI framework
- pyqtgraph >= 0.13.0 - High-performance plotting library
- pyserial >= 3.5 - Serial port communication
The fastest way to see the application in action:
# Install dependencies
pip install -r requirements.txt
# Run the example demonstration (no GUI required)
python example.py
# Launch the GUI application
python main.py
# Click "Demo Mode" to see real-time visualization with simulated datapython main.py- Click "Refresh Ports" to scan for available serial ports
- Select your serial port from the dropdown
- Configure the baud rate (default: 9600)
- Click "Connect" to establish connection
To test the application without hardware:
- Click "Demo Mode" button
- The application will generate realistic mock data
- All features will work normally with the simulated data
- Click "Start Test" to begin a new test session
- All readings and violations will be recorded
- Click "Pass" or "Fail" to conclude the test with a result
- Or click "Stop Test" to end without a pass/fail result
- Navigate to the "Thresholds" tab
- Set minimum and maximum values for each signal type
- Use the checkboxes to enable/disable specific thresholds
- Violations are detected automatically when values exceed thresholds
- Navigate to the "Violations" tab
- All threshold violations are logged with timestamps
- Click "Clear Violations" to reset the violation list
- Click "Export Report" button
- Choose between TXT or HTML format
- Select save location
- Report includes session info, statistics, and violations
The application expects JSON frames via serial port in this format:
{
"voltage": 5.0,
"current": 1.2,
"frequency": 60.0
}Required Fields:
voltage(float): Voltage reading in Voltscurrent(float): Current reading in Amperesfrequency(float): Frequency reading in Hertz
Derived Metrics:
power(float): Automatically calculated as voltage × current
qt-signal-analyzer/
├── main.py # Main GUI application and entry point
├── models.py # Data models and business logic
├── database.py # SQLite database layer
├── serial_reader.py # Serial port communication
├── report_generator.py # Report export functionality
├── requirements.txt # Python dependencies
└── README.md # This file
SignalReading: Represents a single signal measurementThreshold: Defines min/max boundaries for signalsThresholdViolation: Records when thresholds are exceededTestSession: Manages test session lifecycle and metadata
Database: Handles all SQLite operations- Stores readings, violations, and session data
- Provides query methods for retrieving historical data
SerialReader: QThread for reading from serial portsMockSerialReader: Generates simulated data for testing- JSON frame parsing and validation
- Signal-based communication with GUI
ReportGenerator: Static methods for report generation- TXT format: Plain text with statistics and violations
- HTML format: Styled report with color-coded status
SignalAnalyzerMainWindow: Main application window- Real-time plotting with PyQtGraph
- Threshold violation detection
- Test session management
- Dark theme styling
test_sessions
id(INTEGER PRIMARY KEY)start_time(TEXT)end_time(TEXT)status(TEXT)total_readings(INTEGER)total_violations(INTEGER)notes(TEXT)
signal_readings
id(INTEGER PRIMARY KEY)session_id(INTEGER FOREIGN KEY)timestamp(TEXT)voltage(REAL)current(REAL)frequency(REAL)power(REAL)
threshold_violations
id(INTEGER PRIMARY KEY)session_id(INTEGER FOREIGN KEY)timestamp(TEXT)signal_type(TEXT)value(REAL)min_threshold(REAL)max_threshold(REAL)
- PEP 8 compliant
- Type hints where applicable
- Comprehensive docstrings
- Modular design with single responsibility principle
The modular architecture makes it easy to extend:
- New Signal Types: Add to
SignalTypeenum inmodels.py - New Report Formats: Add static methods to
ReportGenerator - New Data Sources: Subclass from
QThreadlikeSerialReader - New Visualizations: Add plot widgets in
main.py
- Ensure device is connected
- Check driver installation (especially for USB-to-serial adapters)
- Run application with appropriate permissions (may need sudo on Linux)
- Try clicking "Refresh Ports"
- Verify correct baud rate
- Check that port isn't already in use by another application
- Ensure device is sending data in expected JSON format
- Reduce
max_pointsinmain.pyif experiencing lag - Close other resource-intensive applications
- Consider reducing data transmission rate from hardware
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- BaseMax
- PyQt5 for the excellent GUI framework
- PyQtGraph for high-performance plotting
- Python community for amazing libraries
