You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
2 months ago | |
|---|---|---|
| .. | ||
| .env.example | 2 months ago | |
| README.md | 2 months ago | |
| app.py | 2 months ago | |
| backend_client.py | 2 months ago | |
| config.py | 2 months ago | |
| requirements.txt | 2 months ago | |
| serial_bridge.spec | 2 months ago | |
| serial_reader.py | 2 months ago | |
| tray_icon.py | 2 months ago | |
README.md
Serial Bridge - COM Port Reader
This is the serial port reading application that runs as a system tray service.
Features
- ✅ Reads data from COM ports
- ✅ Runs in system tray (no console window)
- ✅ Automatically posts data to Django backend
- ✅ Retry logic for failed posts
- ✅ Backend health checks
- ✅ Configurable via environment variables
- ✅ Can be packaged as a Windows .exe
Setup
-
Install Python dependencies:
pip install -r requirements.txt -
Configure environment:
copy .env.example .env # Edit .env with your settings -
Run the application:
python app.py
Building as EXE
To create a standalone Windows executable:
pip install pyinstaller
pyinstaller serial_bridge.spec
The executable will be created in the dist\ScalesApp\ folder.
Configuration
Edit .env to configure:
COM_PORT: COM port to read from (default: COM1)BAUD_RATE: Serial port baud rate (default: 9600)BACKEND_URL: Django backend URL (default: http://localhost:8000)AUTO_CONNECT: Automatically connect on startup (default: True)DEBUG: Enable debug logging (default: False)
Architecture
COM Port → Serial Reader → Backend Client → Django API
↓
System Tray Icon
Logging
Logs are written to serial_bridge.log and console output.
Troubleshooting
- COM port not found: Check
COM_PORTsetting and device connection - Cannot connect to backend: Verify Django server is running on
BACKEND_URL - Data not posting: Check logs in
serial_bridge.log - Tray icon not appearing: Run as administrator, check Windows settings