fd3fc380d89a164cca7aa35c9eb841c83adf9c1a
MQTT-DCC ESP32 PlatformIO Project
This project runs on an ESP32 (PlatformIO) and:
- Connects to WiFi and an MQTT broker
- Listens on the
dcc/commandtopic for JSON accessory commands - Generates a simplified DCC accessory packet and simulates sending it via a GPIO pin
- Publishes status/acknowledgements to
dcc/status
Setup:
- Edit
include/config.hand setWIFI_SSID,WIFI_PASSWORD,MQTT_SERVER, and other values. - Build and upload with PlatformIO.
Command format (JSON published to dcc/command):
{
"id": "optional-correlation-id",
"address": 123,
"state": true
}
Notes:
- The DCC packet generator here is a simplified representation. For NMRA-compliant output you will need a timing-accurate bitstream and the proper packet framing.
- Want me to add NMRA timing/pulse generation, OTA, or an example MQTT client for testing? Ask and I'll add it.
Languages
C++
94.1%
C
5.9%