Version 1.0 - Automated Control System for Magnetron Sputtering
A complete hardware and software control system for DC/RF magnetron sputtering deposition, built on low-cost open-source platforms (Raspberry Pi 5 + Arduino Mega 2560 R3).
This project provides a modern replacement for aging LabVIEW-based vacuum sputter control systems. It delivers:
- Automated vacuum procedures (pump-down, venting, load-lock operation, sputtering)
- Real-time safety interlocks with configurable YAML-based safety rules
- Multi-level user authentication (Admin, Operator, Technician)
- Mass flow controller integration for process gas management (Alicat APEX)
- Live pressure monitoring with data logging and visualization
- Manual and override modes for maintenance and troubleshooting
- Touch-screen optimized GUI built with PyQt5
The system controls 23 relay outputs (pumps, valves, gas lines, shutters) and monitors 4 digital inputs (safety interlocks) and 4 analog inputs (pressure gauges, turbo spin speed).
- Host Computer: Raspberry Pi 5 (8GB RAM recommended)
- I/O Controller: Arduino Mega 2560 R3
- Communication: USB serial (9600 baud)
- Relay Interface: 16-channel relay modules (12V DC coil)
- Power: 12V/5V DC power supplies for relays and logic
- Main Chamber: High-vacuum chamber with turbomolecular pump and scroll pump
- Load-Lock: Secondary chamber for sample loading without breaking main vacuum
- Pressure Monitoring:
- 2Γ Pirani gauges (load-lock and chamber rough vacuum)
- 1Γ Ion gauge (high vacuum measurement)
- 1Γ Turbo spin speed monitor
- Safety Interlocks:
- Door closure switch (safety)
- Water flow switch (cooling verification)
- Load-lock rod home position switch
- Spare input (reserved)
- Mass Flow Controllers: Alicat APEX (RS-232 serial)
- Process Gases: Argon, Nitrogen, Oxygen (configurable)
- Flow Range: Typically 0-200 sccm per channel
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PyQt5 GUI (app.py) β
β Touch-optimized interface, automated procedures, plotting β
βββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββΌββββββββββββββββ¬ββββββββββββββββββ
β β β β
βββββΌβββββ ββββββββΌβββββββ ββββββΌββββββ ββββββββΌβββββββ
β Safety β β Arduino β β Gas β β Security β
β System β β Controller β β Control β β Manager β
ββββββββββ βββββββββββββββ ββββββββββββ βββββββββββββββ
β β β β
β ββββββββΌβββββββ β β
β β Serial β β β
β β 9600 baud β β β
β ββββββββ¬βββββββ β β
β β β β
β ββββββββΌβββββββββββ β β
β β Arduino Mega β β β
β β Relay Firmware β β β
β βββββββββββββββββββ β β
β β β
βββββββββββββββββββββββββββββββββ΄ββββββββββββββββββ
β
βββββββββββββΌββββββββββββ
β Configuration Files β
β (YAML-based rules) β
βββββββββββββββββββββββββ
1. Main Application (python/app.py)
- PyQt5 GUI with timer-based state monitoring (700ms refresh)
- Background procedure execution via QThreadPool
- Real-time pressure and sensor display
- Mode management (Normal/Manual/Override)
2. Arduino Controller (python/arduino_controller.py)
- Thread-safe serial communication
- Relay state management (23 relays)
- Digital input reading (4 interlocks)
- Analog input reading (4 pressure sensors)
- Automatic reconnection logic
3. Safety System (python/safety/)
safety_controller.py: Central safety evaluator- YAML-based condition evaluation (OR/AND logic)
- System state auto-detection (vented, rough pump, turbo pump, sputter)
- Button enable/disable logic
- Confirmation dialogs for risky operations
safety_conditions.yml: Safety rules database- Emergency stop conditions
- Pressure thresholds
- Relay dependency checks
- Interlock requirements
4. Automated Procedures (python/auto_procedures.py)
pump_down(): Multi-stage pump sequencevent_system(): Safe chamber ventingload_unload(): Load-lock sample transfersputter(): Sputtering mode activation- Real-time feedback and cancellation support
5. Gas Control (python/gas_control/)
subprocess_controller.py: MFC driver (subprocess-based for serial stability)recipes.py: Gas flow presetssafety_integration.py: Gas flow safety checksconfig.yml: MFC serial ports and gas types
6. Security (python/security/)
password_manager.py: bcrypt password hashinguser_account_manager.py: Role-based access controlreset_passwords.py: Emergency admin tools
7. UI Widgets (python/widgets/)
- Status indicators
- MFC setpoint dialog
- Mode selection dialog
- Real-time data plotter
- Password setup dialog
- Analog recorder (CSV data logging)
Responsibilities:
- Hardware-level relay control (pins 22-41, 44, 46, 48)
- Digital input monitoring with pull-ups (pins 45, 47, 49, 51)
- Analog input reading (A1-A4: Load-lock, Chamber, Ion gauge, Turbo)
- Serial protocol implementation
- Safety interlocks (hardware-enforced)
Command Protocol:
- Commands:
RELAY_X_ON,RELAY_X_OFF(X = 1-23) - Queries:
GET_RELAY_STATUS,GET_DIGITAL_INPUTS,GET_ANALOG_INPUTS - Responses:
OK,ERROR, data arrays
auto_control/
βββ python/ # Main application code
β βββ app.py # PyQt5 GUI application
β βββ main.py # Entry point
β βββ config.py # Configuration loader
β βββ arduino_controller.py # Serial communication
β βββ auto_procedures.py # Automated sequences
β βββ safety/ # Safety interlock system
β β βββ safety_controller.py # Safety logic engine
β β βββ safety_conditions.yml # Safety rules (YAML)
β βββ security/ # User authentication
β β βββ password_manager.py
β β βββ user_account_manager.py
β βββ gas_control/ # Mass flow controllers
β β βββ subprocess_controller.py
β β βββ recipes.py
β β βββ config.yml
β βββ widgets/ # PyQt5 UI components
β β βββ indicators.py
β β βββ mfc_dialog.py
β β βββ mode_dialog.py
β β βββ plotter_widget.py
β β βββ analog_recorder.py
β βββ tests/ # Unit tests
βββ relay_controller/ # Arduino firmware
β βββ relay_controller.ino # Arduino Mega sketch
βββ docs/ # Documentation
β βββ TECHNICAL_MANUAL.md # Hardware pin assignments
β βββ software_manual.md # Software architecture
β βββ SOP_new.md # Standard operating procedure
β βββ SECURITY_README.md # User account management
β βββ pics/ # Hardware photos
βββ sput.yml # Runtime configuration
βββ vacuum_system_gui.ui # Qt Designer UI file
βββ README.md # This file
gas_control_all/ # MFC development & testing
launcher/ # Desktop launcher scripts
relay_test_system/ # Hardware testing utilities
- Raspberry Pi 5 (or compatible Linux system)
- Python 3.10+
- Arduino Mega 2560 R3 with firmware uploaded
- PyQt5, pyserial, PyYAML, alicat, cryptography
-
Clone the repository
git clone https://github.com/HelloThereMatey/MAG_SPUTTER_TOOL.git cd MAG_SPUTTER_TOOL/auto_control -
Create conda environment (recommended)
conda env create -f sput.yml conda activate sput
-
Upload Arduino firmware
- Open
relay_controller/relay_controller.inoin Arduino IDE - Select board: Arduino Mega 2560
- Upload to Arduino
- Open
-
Configure system
- Edit
sput.ymlfor relay pin assignments - Edit
python/safety/safety_conditions.ymlfor safety rules - Edit
python/gas_control/config.ymlfor MFC serial ports
- Edit
-
Launch application
cd python python main.py
- Password Setup: On first launch, create admin password
- Mode Selection: Choose Normal/Manual/Override mode
- Port Configuration: Verify Arduino auto-detects on correct serial port
- Automated procedures only (PUMP, VENT, SPUTTER, etc.)
- Full safety checks enforced
- Manual controls disabled
- All buttons enabled (automated + manual)
- Full safety checks enforced
- Confirmation dialogs active
- All controls unrestricted
- ALL SAFETY CHECKS BYPASSED
- Use only for recovery/troubleshooting
- Requires admin authentication
- Pump-Down: Multi-stage vacuum sequence (rough β medium β high vacuum)
- Vent: Safe chamber venting with interlock verification
- Load/Unload: Automated load-lock sample transfer
- Sputter: Sputtering mode activation (ion gauge + gas flow)
- YAML-based safety rules (no code changes required)
- Real-time system state detection
- Pressure threshold monitoring
- Digital interlock verification (door, water, rod position)
- Automatic emergency shutdown
- Real-time pressure plotting
- CSV data export (analog recorder)
- Session logbook integration
- Timestamped event logging
- Multi-channel MFC control (Alicat APEX)
- Recipe-based flow presets
- Real-time flow monitoring
- Safety interlocks (pressure-dependent gas flow)
serial:
baud: 9600
preferred_ports: [/dev/ttyACM0, /dev/ttyUSB3]
relays:
btnPumpTurbo: 37
btnValveTurboGate: 27
btnValveRough: 25
btnIonGauge: 35
# ... (23 total relays)
analog_inputs:
A1: loadlock_pirani
A2: chamber_pirani
A3: ion_gauge
A4: turbo_spin_speed
pressure_thresholds:
high_vacuum: 1.0e-5
medium_vacuum: 1.0e-2
rough_vacuum: 1.0safety_conditions:
emergency_stop:
- condition: door_open
message: "Emergency: Chamber door opened!"
- condition: water_flow_stopped
message: "Emergency: Cooling water flow lost!"
button_conditions:
btnPumpTurbo:
enable_if:
- pressure < 1e-2 # Chamber must be rough pumped
- relay_rough_valve == ON- TECHNICAL_MANUAL.md: Hardware pin assignments, relay configuration
- software_manual.md: Software architecture, module details
- SOP_new.md: Standard operating procedure (user guide)
- SECURITY_README.md: User account management
cd relay_test_system/python
python platform_test.py # Verify relay control
python port_tester.py # Test serial communicationcd auto_control/python/tests
pytest test_arduino_relay.py
pytest test_mode_dialog.py| Pin Range | Function | Description |
|---|---|---|
| 22-41, 44, 46, 48 | Relay Outputs | 23 relay control pins |
| 45, 47, 49, 51 | Digital Inputs | Safety interlocks (pulled high, active low) |
| A1-A4 | Analog Inputs | Pressure sensors + turbo speed |
Critical Pins:
- Pin 22: Mains power safety relay (CRITICAL)
- Pin 37: Turbo pump control
- Pin 35: Ion gauge activation
- Pin 44: Scroll pump solid-state relay
This project is open-source. Contributions welcome for:
- Additional safety features
- UI improvements
- Documentation enhancements
- Bug fixes
MIT License - See LICENSE file for details
HelloThereMatey
For questions, issues, or feature requests, please open an issue on GitHub.
Built for the Materials Science research community as a modern, open-source alternative to proprietary vacuum control systems.
Technology Stack:
- Python 3.10
- PyQt5
- Arduino (C++)
- Raspberry Pi OS
- Alicat MFC Protocol
This system controls high-vacuum equipment, high-voltage power supplies, and pressurized gas systems. Improper use can cause equipment damage, personal injury, or death.
- Training required before operation
- Follow all safety protocols in SOP documentation
- Test safety interlocks regularly
- Never bypass safety systems except in documented emergency procedures
The authors assume no liability for damages resulting from use of this software.