This project provides a Tkinter-based GUI application to control a DFRobot 8-Channel USB Relay module over a serial (USB) connection.
It supports individual relay control, status indicators, relay descriptions, and persistent state storage.
- Control 8 relays individually (ON / OFF)
- ALL ON / ALL OFF buttons
- Visual status indicator
- Green = ON
- Red = OFF
- Editable description field per relay
- Save & load:
- Relay descriptions (
relay_descriptions.txt) - Relay ON/OFF states (
relay_states.txt)
- Relay descriptions (
- Automatic relay USB serial port detection
- Windows EXE build support using PyInstaller
- Windows
- Python 3.9 or newer
- Python packages:
- DFRobot 8-Channel USB Relay
- USB connection to the PC
On startup, the application:
- Detects the relay USB serial port
- Restores previous relay states
- Loads saved relay descriptions (if available)
Each relay row contains:
- Relay number label
- ON / OFF toggle button
- Status indicator (circle)
- Description input field
- Save and Clear buttons
| File Name | Description |
|---|---|
| relay_descriptions.txt | Stores relay descriptions |
| relay_states.txt | Stores relay ON/OFF states |
These files are created automatically in the same directory as the script or executable.
Use PyInstaller to generate a standalone EXE:
The executable will be created in:
- Ensure the relay is connected before launching the application
- The relay must appear as USB Serial Device in Windows Device Manager
- Baud rate used: 115200
- Only one relay device is expected to be connected at a time
This project is provided as-is for educational and internal tooling purposes.