23 lines
876 B
Markdown
23 lines
876 B
Markdown
# MQTT-DCC ESP32 PlatformIO Project
|
|
|
|
This project runs on an ESP32 (PlatformIO) and:
|
|
- Connects to WiFi and an MQTT broker
|
|
- Listens on the `dcc/command` topic 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:
|
|
1. Edit `include/config.h` and set `WIFI_SSID`, `WIFI_PASSWORD`, `MQTT_SERVER`, and other values.
|
|
2. 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.
|