Files
2026-02-10 12:12:11 +01:00

108 lines
5.8 KiB
Markdown

# Wiring Diagram
## LM18200 H-Bridge Connection
```
ESP32 D1 Mini LM18200 Track/Motor
GPIO 25 (PWM) ──────────────► PWM
GPIO 26 (DIR) ──────────────► DIR
GPIO 27 (BRAKE)──────────────► BRAKE
5V ──────────────► Vcc
GND ──────────────► GND
VS ◄───────── 12-18V Power Supply (+)
GND ◄───────── Power Supply GND
OUT1 ──────────► Track Rail 1
OUT2 ──────────► Track Rail 2
```
## DCC Signal Output (Optional Booster Required)
```
ESP32 D1 Mini DCC Booster Track
GPIO 32 (DCC_A) ────────────► Signal A
GPIO 33 (DCC_B) ────────────► Signal B
Power In ◄──── 12-18V Supply
Track A ──────────► Rail 1
Track B ──────────► Rail 2
```
## WS2812 LED Indicators
```
ESP32 D1 Mini WS2812 LEDs
GPIO 4 (LED_DATA) ──────────► DIN
5V ──────────► VCC
GND ──────────► GND
LED 0: Power Status
- Green: Power ON
- Red: Power OFF
LED 1: Mode Indicator
- Blue (pulsing): DCC mode
- Yellow (pulsing): Analog mode
```
## Complete System Diagram
```
┌─────────────────┐
│ Power Supply │
│ 12-18V DC │
└────────┬─────────┘
┌────────┴─────────┐
│ │
┌───────▼────────┐ ┌──────▼──────┐
│ LM18200 │ │ 5V Regulator│
│ H-Bridge │ │ (if needed) │
└───────┬────────┘ └──────┬───────┘
│ │
│ ┌────────▼────────┐
│ │ ESP32 D1 Mini │
│ │ │
│ │ GPIO 25 → PWM │───┐
│ │ GPIO 26 → DIR │───┤
│ │ GPIO 27 → BRAKE│───┤
│ │ │ │
│ │ GPIO 32 → DCC A│ │
│ │ GPIO 33 → DCC B│ │
│ │ │ │
│ │ GPIO 4 → LEDS │───┼──► WS2812 LEDs
│ │ │ │ (Power & Mode)
│ │ WiFi (Built-in)│ │
│ └─────────────────┘ │
│ │
└───────────────────────────────┘
┌───────▼────────┐
│ Track/Rails │
│ │
│ ┌──────────┐ │
│ │Locomotive│ │
│ └──────────┘ │
└────────────────┘
```
## Pin Summary Table
| Function | ESP32 Pin | Device Pin | Notes |
|----------|-----------|------------|-------|
| Motor PWM | GPIO 25 | LM18200 PWM | 20kHz PWM signal |
| Motor Direction | GPIO 26 | LM18200 DIR | High=Forward, Low=Reverse |
| Motor Brake | GPIO 27 | LM18200 BRAKE | Active LOW |
| DCC Signal A | GPIO 32 | DCC Booster A | Requires booster circuit |
| DCC Signal B | GPIO 33 | DCC Booster B | Inverted signal |
| LED Data | GPIO 4 | WS2812 DIN | 2 LEDs for status |
| LED Power | 5V | WS2812 VCC | LED strip power |
| Power (5V) | 5V | LM18200 Vcc | Logic power |
| Ground | GND | LM18200/LEDs GND | Common ground |