Loading files…
An ESP32-based hardware and firmware stack that bridges RS-485/Modbus field devices to modern network services such as MQTT, with a configuration-first UX for installers and maintainers.
Modbus-to-X combines a custom ESP32 carrier board with firmware that polls Modbus RTU devices over RS-485, persists telemetry locally, and republishes structured payloads to MQTT brokers. The firmware exposes an onboard web interface for Wi-Fi provisioning, Modbus configuration, live device statistics, and log retrieval so field technicians can deploy the gateway without recompiling binaries.
The project is split between dedicated hardware design files and a PlatformIO firmware project. Hardware-specific documentation lives in hardware/; firmware, tooling, and UI assets live in software/.
hardware/./conf/*.json on the dedicated config SPIFFS partition (cfg) and hot-reloaded without reflashing./conf/mqtt.json contains non-sensitive fields.Config.h.git toolchain. Required Python build dependencies are installed automatically by scripts/install_build_deps.py when PlatformIO runs.git clone https://github.com/joachimda/modbus-to-x.git
cd modbus-to-x/software/modbus-to-mqtt
platformio.ini:
mbx-custom-board-dev — development build, serial upload (default).mbx-custom-board-dev-ota — development build, OTA upload (configure upload_port for your device).mbx-custom-board-release — release build (used by the GitHub Actions workflow).mbx-custom-board-release-primer — primes a dev device to receive HTTP OTA updates.pio run
# Serial upload
pio run -e mbx-custom-board-dev -t upload
# OTA upload to a provisioned gateway
pio run -e mbx-custom-board-dev-ota -t upload
pio run -e mbx-custom-board-dev -t uploadfs
Pushing a v* tag triggers the GitHub Actions workflow in .github/workflows/main.yml to build firmware + filesystem images and create a GitHub Release with the assets:
modbus-to-x.bin (firmware)modbus-to-x.fs.bin (filesystem)modbus-to-x.notes.txt (release notes generated from the commit log since the previous tag)modbus-to-x.manifest.json (includes SHA-256 hashes and a signature generated from OTA_SIGNING_KEY_PEM and KID).The scripts/run_test_webserver.py helper serves the data/ directory with mocked API responses so you can iterate on the HTML/JS bundle without flashing the device:
cd software/modbus-to-mqtt
python scripts/run_test_webserver.py
# Visit http://127.0.0.1:8000
It injects correct MIME types, disables caching, and emulates /api/stats/system, /api/events, /api/logs, and /api/system/reboot for the SPA.
Config.h (MODBUS-MQTT-BRIDGE / you-shall-not-pass).http://192.168.4.1/./conf/config.json and can be applied live without rebooting.data/conf/schema.json (UI) and the example in docs/configuration_examples/modbus.json. Each datapoint specifies the function code, register address, data type, scale, and engineering units that will be published when polled.{
"devices": [
{
"name": "Boiler",
"slaveId": 10,
"mqttEnabled": true,
"homeassistantDiscoveryEnabled": true,
"dataPoints": [
{
"id": "temp",
"name": "Temperature",
"function": 4,
"address": 100,
"numOfRegisters": 1,
"dataType": "int16",
"scale": 0.1,
"unit": "C",
"topic": "plant/boiler/temp_c"
}
]
}
]
}
/conf/mqtt.json. The firmware automatically extracts hostnames from URLs and persists the MQTT password in NVS preferences.<root>/<device>/<datapointId> with slugified datapoint names as datapoint IDs..
├── hardware/ # Schematics, PCB layout, BOM assets, release notes
├── software/
│ └── modbus-to-mqtt/ # PlatformIO workspace with firmware, web UI, and tooling
└── README.md # This high-level overview
Detailed hardware notes, KiCad sources, datasheets, and per-revision release notes are kept in hardware/. Start with the latest folder under hardware/releases/ (for example, v0.2-alpha) for the current board spin and consult the KiCad project in hardware/kicad_files/ for schematics, layout, and fabrication outputs.
The firmware entry point, reusable libraries, and static assets live under software/modbus-to-mqtt/. Key references:
src/ – firmware modules for Modbus polling, MQTT connectivity, OTA, and the async web server.data/ – web UI bundle and config schema served by the device (config data lives in the /conf partition at runtime).docs/configuration_examples/ – JSON schemas and examples for Modbus and MQTT configuration.boards/ – custom PlatformIO board definition for the production hardware (ESP32, 16 MB flash).platformio.ini (ModbusMaster, PubSubClient, ArduinoJson, ESPAsyncWebServer).hardware/kicad_files/lib/ with accompanying license terms in hardware/kicad_files/lib/licenses.
No comments yet. Be the first to ask about this board.