5.1 KiB
Executable File
Genesis SLM MX 532 Laser Control Application
Overview
This application provides comprehensive control of the Genesis SLM MX 532 laser over serial port using the NXP I2C-over-serial protocol. It features a professional PyQt6 GUI with multiple tabs for basic controls, monitoring, advanced operations, and configuration.
Features
Tab 1: Basic Controls
- Current Control: Slider and numeric input for laser current (0-1023) with percentage display
- Power Control: Slider for power command setting
- Digital Controls: Toggle buttons for:
- Shutter (Open/Closed)
- Keyswitch (On/Off)
- Remote Enable (On/Off)
- Analog Input Enable (On/Off)
- Current Mode (On/Off)
- Emergency Stop: Red button that immediately closes shutter, sets current to 0, and disables keyswitch
Tab 2: Monitoring
- Real-time sensor readings with auto-refresh capability (configurable interval)
- Displays:
- Actual current reading from ADC
- Interlock status (visual color-coded indicator)
- LDD (Laser Diode Driver) enable status
- Power supply glue input/output status
- Head DIO status
- Laser information display (model and wavelength)
Tab 3: Advanced
- Raw I2C Packet Sender: Send custom I2C commands with hex input
- Packet Capture Log: Real-time log of all transmitted and received packets with timestamps
- Useful for debugging and development
Tab 4: Configuration
- Serial port selection with auto-detection
- Baud rate configuration (default: 9600)
- Connect/Disconnect control
- DTR/RTS control line settings
- About section with protocol information
Safety Features
- All controls disabled until connected - Prevents accidental commands
- Shutter confirmation dialog - Warns if opening shutter with current > 0
- Emergency stop - Always enabled, immediately enters safe state
- Auto-safe state on disconnect - Laser enters safe state when disconnecting
- Settings persistence - Window geometry and last settings are saved
Protocol Details
The application uses the NXP I2C-over-serial protocol with this packet format:
Write packet:
[0x53] [I2C_ADDR] [LENGTH] [COMMAND_BYTES] [DATA_BYTES] [0x50]
Read packet:
[0x53] [ADDR_WRITE] [CMD_LEN] [CMD] [0x53] [ADDR_READ] [DATA_LEN] [0x50]
I2C Devices
- X9119 (0x52/0x53) - Digital potentiometer for current control
- PCA9555 (various addresses) - I/O expanders for digital control
- ADS7828 (0x90/0x91) - ADC for sensor readings
- AD5254 (0x58) - Digital potentiometer for limits
- M24C64 (0xa4/0xa5) - EEPROM for configuration storage
Installation
-
Ensure dependencies are installed:
pip install -r requirements.txt -
Connect the laser to your computer via serial port (typically /dev/ttyUSB0 on Linux)
-
Run the application:
python genesis_laser_control.py
Usage
-
Launch the application
python genesis_laser_control.py -
Connect to the laser:
- Go to the "Configuration" tab
- Select the correct serial port from the dropdown
- Verify baud rate is set to 9600 (default)
- Click "Connect"
-
Basic operation:
- Enable remote control using the "Remote: DISABLED" button
- Enable keyswitch if required
- Adjust current using the slider
- Open shutter when ready (confirmation dialog will appear if current > 0)
-
Monitoring:
- Go to the "Monitoring" tab
- Enable "Auto-refresh" to continuously update readings
- Adjust refresh interval as needed (default: 500ms)
-
Emergency stop:
- Click the red "EMERGENCY STOP" button on any tab
- This immediately closes shutter, sets current to 0, and disables keyswitch
-
Disconnecting:
- Click "Disconnect" in the Configuration tab
- Laser will automatically enter safe state before disconnecting
Troubleshooting
Connection Issues
- Verify serial port permissions:
sudo usermod -a -G dialout $USER(logout and login) - Check cable connection and power
- Verify correct port in Configuration tab
- Try refreshing ports list
Communication Errors
- Check packet log in Advanced tab for detailed TX/RX
- Verify baud rate is 9600
- Ensure no other programs are using the serial port
- Try power cycling the laser
Interlock Faults
- Check physical interlock connections
- Verify interlock status in Monitoring tab
- Ensure all safety covers are in place
Code Structure
The application is organized into several classes:
- SerialComm: Low-level serial port communication
- I2CProtocol: NXP packet construction and parsing
- I2CDevices: I2C device-specific functions (PCA9555, X9119, ADS7828)
- LaserControl: High-level laser control operations
- MainWindow: PyQt6 GUI and user interaction
Development
To modify the application:
- Adding new I2C devices: Extend the
I2CDevicesclass - Adding new controls: Add methods to
LaserControland corresponding UI elements - Custom commands: Use the Raw I2C Packet Sender in the Advanced tab for testing
License
See LICENSE file for details.
Support
For issues or questions, please refer to the main project documentation.