A soft PLC written in Go that replaces proprietary industrial programming languages with modern development tools.
Industrial automation is stuck in the past. Proprietary IDEs, vendor lock-in, no real version control, and languages that don't transfer to any other domain. If you're going to learn something new anyway, why not use a real programming language with modern tooling? GoPLC lets you write control logic in native Go using VS Code, Git, and CI/CD pipelines instead of being locked into Ladder Logic or Structured Text. It's time to bring software development practices from the last two decades into industrial automation.
Requirements: Go 1.25 or newer, and Docker (for the Modbus simulator).
git clone https://github.com/aott33/GoPLC.git
cd GoPLC
# Start a Modbus TCP simulator on localhost:5020
docker compose up -d
# Build and run with the example configuration
make build
./go-plc -config configs/example.yamlGoPLC loads configs/example.yaml, validates it and logs each configured source as JSON. The runtime that polls sources is not implemented yet, so the program exits after startup.
Useful flags:
-config <path>: configuration file (defaultconfigs/example.yaml)-log-level <level>:debug,info,warnorerror; overrideslogLevelin the file
Development commands:
make test # go test -race ./...
make lint # golangci-lint run
make help # list all targetsStop the simulator with docker compose down. The simulator's seeded registers are listed in scripts/modbus-sim/server.py.
GoPLC is in early development.
| Feature | Status |
|---|---|
| YAML configuration and validation | Done |
| Modbus TCP source (client, polling, reconnect) | In progress |
| Modbus RTU | Planned |
| OPC UA server | Planned |
| GraphQL API | Planned |
| Zenoh pub/sub | Planned |
| Web UI | Planned |
Planning documents are in docs/planning/.
A traditional PLC is a specialized industrial computer that runs control logic for manufacturing equipment. A soft PLC does the same thing but runs on standard hardware—the control software without the proprietary box.
GoPLC communicates with industrial devices via standard protocols and exposes data through multiple interfaces:
Input/Output:
- Modbus TCP/RTU for sensors, actuators, and I/O modules
- Automatic reconnection with exponential backoff
SCADA Integration:
- OPC UA server for traditional industrial SCADA systems (Ignition, Kepware, etc.)
- GraphQL API for modern web/mobile integrations
- Optional Zenoh protocol for high-performance pub/sub (Phase 2)
Monitoring:
- Built-in WebUI for real-time monitoring and control
- System health, connection status, variable values, task execution
Variables are defined once in YAML and automatically exposed to all protocols. The runtime handles scheduling, scaling, and protocol translation.
Project Structure:
- Registry pattern for extensible protocol support
- Protocol implementations in
internal/source/<protocol>/ - Each protocol self-registers via
init()functions
Error Management:
- Use structured error format:
[Component] - [Description] (context: value, ...)- Example:
[config] - Unknown source type 'opcua' (source: plc1)
- Example:
- Each package contains an
errors.gofile with helper functions - Use
panic()only for programmer errors; returnerrorfor runtime errors
Testing:
- Unit tests use table-driven test pattern
- Test coverage required for all error paths
Contributions are welcome. If you find a bug or have a feature request, please open an issue. If you want to submit code, please open a pull request with a clear description of your changes.
O'Saasy License Agreement - MIT do-whatever-you-want license, but with the commercial rights for SaaS reserved for the copyright holder.