Scale Daemon is a robust Windows Service designed to bridge the gap between industrial hardware scales and modern web applications. It reads weight data from serial ports (RS232) in real-time and broadcasts it via a high-performance WebSocket server, allowing any web client to display weight readings instantly.
It comes with a professional TUI (Text User Interface) Installer that simplifies deployment, management, and configuration.
The system follows a producer-consumer pattern where the service acts as a middleware between the hardware and the frontend.
graph LR
subgraph Hardware
Scale[⚖️ Industrial Scale]
end
subgraph "Windows Service (Go)"
SerialReader[🔌 Serial Reader]
Broadcaster[📡 WebSocket Broadcaster]
Config[⚙️ Config Manager]
end
subgraph Clients
Web[💻 Web Dashboard]
App[📱 Mobile App]
end
Scale -- RS232 (COM3) --> SerialReader
SerialReader -- Weight Data --> Broadcaster
Broadcaster -- WS (ws://*:8765) --> Web
Broadcaster -- WS (ws://*:8765) --> App
Config -. Hot Reload .-> SerialReader
- Real-time Broadcasting: Low-latency weight updates via WebSockets.
- Robust Serial Communication: Automatic reconnection, noise filtering, and timeout handling.
- Interactive Installer: A beautiful CLI tool to Install, Start, Stop, and Uninstall the service.
- Hot Configuration: Change serial ports or scale brands on the fly without restarting the service.
- Simulation Mode: Built-in test mode to simulate weight data for development without hardware.
- Multi-Environment: Separate configurations for Production and Test/Dev environments.
This project includes a self-contained installer.
- Download the latest release (
BasculaInstalador_prod.exe). - Run as Administrator (Required to install Windows Services).
- Use the arrow keys to select [+] Instalar Servicio.
- Once installed, select [>] Iniciar Servicio.
The service exposes a WebSocket endpoint at ws://localhost:8765 (or the server's IP).
Message Format (Server -> Client):
"12.50"The server sends the raw weight as a string.
Configuration (Client -> Server): You can send a JSON message to configure the service:
{
"tipo": "config",
"puerto": "COM1",
"marca": "Rhino",
"modoPrueba": false
}- Go 1.24+
- Task (Taskfile)
We use Taskfile to manage builds:
# Build for Production (Listens on 0.0.0.0)
task build:all
# Build for Test (Listens on localhost, enables file logging)
task build:test
# Build only the service
task service:build
# Build only the installer
task installer:build- Fork the repository.
- Create a feature branch (
git checkout -b feature/amazing-feature). - Commit your changes (
git commit -m 'Add amazing feature'). - Push to the branch (
git push origin feature/amazing-feature). - Open a Pull Request.
Distributed under the MIT License. See LICENSE for more information.