Files
arduino_gauge_controller/Rewire_checklist.md
Adrian A. Baumann 8bdae1da9b Update docs and firmware for ESPHome bridge migration
- Replace gauge.py (MicroPython) references with gaugecontroller.yaml (ESPHome)
- Update CLAUDE.md and README.md to document ESPHome-native API integration
- Update LED wiring docs for separate main/indicator strips (D22/D36)
- Refactor Arduino firmware to drive two WS2812 strips independently
- Add per-gauge physical offset caching for main and indicator LEDs
- Frame-limit breathe effect (16ms) to reduce unnecessary strip refreshes
2026-04-29 19:03:22 +02:00

324 lines
7.1 KiB
Markdown

# Rewire Checklist
This is a practical rebuild checklist for the current integrated setup:
- `Arduino Mega 2560`
- `ESP32` running `gauge.py`
- `HV5812P`
- 4-digit VFD with decimal point and alarm bell
- 3 gauge drivers
- WS2812B LED chain
Use this to rebuild the bench wiring from scratch.
## 1. Power Off Everything
- disconnect all power supplies
- disconnect USB power if it is currently feeding any board
- do not move wires while the VFD high-voltage supply is live
## 2. Place The Main Parts
- place the `Arduino Mega 2560`
- place the `ESP32`
- place the `HV5812P`
- place the 3 gauge driver boards
- place the WS2812B strip connection point
- place the VFD tube connection point
## 3. Establish A Common Ground First
Before anything else, create one common logic ground network.
Connect:
- `Mega GND` -> ground rail
- `ESP32 GND` -> same ground rail
- `HV5812P GND` -> same ground rail
- `Gauge driver 0 logic GND` -> same ground rail
- `Gauge driver 1 logic GND` -> same ground rail
- `Gauge driver 2 logic GND` -> same ground rail
- `WS2812B GND` -> same ground rail
If your VFD high-voltage supply has a ground/reference return:
- `VFD HV supply return` -> same common ground rail
Do not continue until this common ground is in place.
## 4. Wire The Arduino Mega Power
Connect:
- regulated `5V logic supply` -> `Mega 5V`
- ground rail -> `Mega GND`
Do not use the Mega to power motors.
## 5. Wire The ESP32 Power
Power the ESP32 in the way your board expects.
Typical options:
- via board USB
- via board `5V/VIN` if your ESP32 board has its own regulator
- via regulated `3.3V` if it is a bare module that requires that
Also connect:
- `ESP32 GND` -> common ground rail
Do not feed raw `5V` into a bare `3.3V-only` ESP32 module.
## 6. Wire The ESP32 UART To The Mega
Connect:
- `ESP32 GPIO17 (TX)` -> `Mega pin 19 (RX1)`
- `ESP32 GPIO16 (RX)` <- `Mega pin 18 (TX1)`
- `ESP32 GND` -> `Mega GND`
This UART link is used by `gauge.py`.
## 7. Wire The HV5812P Logic Side
Connect:
- `Mega D46` -> `HV5812P DATA IN / DIN`
- `Mega D47` -> `HV5812P CLOCK / CLK`
- `Mega D48` -> `HV5812P STROBE / LATCH`
- `Mega D49` -> `HV5812P BLANKING / OE`
- `Mega 5V` -> `HV5812P VDD`
- `Mega GND` -> `HV5812P GND`
Do not connect:
- `Mega 5V` -> `HV5812P VPP`
## 8. Wire The HV5812P High-Voltage Side
Connect:
- `VFD high-voltage positive supply` -> `HV5812P VPP`
- `VFD high-voltage supply return / reference` -> common ground rail
At this stage:
- `VDD` must be `5V`
- `VPP` must be your VFD high-voltage rail
## 9. Wire The HV5812P Outputs To The VFD
Connect these one by one:
- `HVOut1` -> VFD segment `A`
- `HVOut2` -> VFD segment `B`
- `HVOut3` -> VFD segment `C`
- `HVOut4` -> VFD segment `D`
- `HVOut5` -> VFD segment `E`
- `HVOut6` -> VFD segment `F`
- `HVOut7` -> VFD segment `G`
- `HVOut8` -> VFD decimal point segment
- `HVOut9` -> VFD alarm bell segment
- `HVOut10` -> VFD digit 1 grid
- `HVOut11` -> VFD digit 2 grid
- `HVOut12` -> VFD digit 3 grid
- `HVOut13` -> VFD digit 4 grid
- `HVOut14` -> VFD indicator grid between digits 2 and 3
## 10. Wire The VFD Filament
Wire the VFD filament/heater exactly as required by your tube.
This checklist cannot specify the exact filament supply because it depends on the actual tube.
Required reminder:
- do not power the filament from an Arduino GPIO
- use the correct filament supply for the tube
## 11. Wire Gauge Driver 0
Connect:
- `Mega D50` -> `Gauge driver 0 DIR`
- `Mega D51` -> `Gauge driver 0 STEP`
- `Mega GND` -> `Gauge driver 0 logic GND`
Then connect the motor side of that driver to:
- its motor power supply
- its gauge motor
according to the driver board you are using.
## 12. Wire Gauge Driver 1
Connect:
- `Mega D8` -> `Gauge driver 1 DIR`
- `Mega D9` -> `Gauge driver 1 STEP`
- `Mega GND` -> `Gauge driver 1 logic GND`
Then connect the motor side of that driver to:
- its motor power supply
- its gauge motor
according to the driver board you are using.
## 13. Wire Gauge Driver 2
Connect:
- `Mega D52` -> `Gauge driver 2 DIR`
- `Mega D53` -> `Gauge driver 2 STEP`
- `Mega GND` -> `Gauge driver 2 logic GND`
Then connect the motor side of that driver to:
- its motor power supply
- its gauge motor
according to the driver board you are using.
## 14. Wire The WS2812 LEDs
Connect:
- `Mega D22` -> main backlight/status strip `DIN`
- `Mega D36` -> indicator strip `DIN`
- `5V LED supply` -> both strip `5V` inputs
- both strip `GND` inputs -> common ground rail
If the LED chain is long or bright:
- do not power it from the Mega `5V`
- use a proper external `5V` supply
## 15. Verify The Pins That Changed For The Integrated VFD
The VFD is no longer on the old standalone pins.
Old standalone pins:
- `D51` -> DATA
- `D52` -> CLOCK
- `D53` -> STROBE
- `D49` -> BLANK
Current integrated pins:
- `D46` -> DATA
- `D47` -> CLOCK
- `D48` -> STROBE
- `D49` -> BLANK
So make sure:
- nothing VFD-related is still on `D51`
- nothing VFD-related is still on `D52`
- nothing VFD-related is still on `D53`
- only `BLANK/OE` remains on `D49`
## 16. Sanity Check Before Powering Logic
Check each item physically:
- `Mega D46` really goes to `HV5812 DATA`
- `Mega D47` really goes to `HV5812 CLOCK`
- `Mega D48` really goes to `HV5812 STROBE`
- `Mega D49` really goes to `HV5812 BLANKING`
- `Mega D50/D51` only go to gauge driver 0
- `Mega D8/D9` only go to gauge driver 1
- `Mega D52/D53` only go to gauge driver 2
- `Mega D22` only goes to WS2812B `DIN`
- `ESP32 GPIO17` goes to `Mega RX1`
- `ESP32 GPIO16` goes to `Mega TX1`
- all grounds are common
- `HV5812 VDD` is `5V`
- `HV5812 VPP` is high voltage, not `5V`
## 17. Power Logic Only First
Apply only logic power first:
- Mega power
- ESP32 power
- HV5812 `VDD`
- WS2812 `5V`
Leave motor supply and VFD high voltage off for the first check if possible.
Verify:
- Mega boots
- ESP32 boots
- UART communication works
## 18. Power The VFD High Voltage
Now apply the VFD high-voltage supply to `HV5812 VPP`.
Verify:
- `VDD` remains `5V`
- `VPP` is the expected high voltage
- no logic wire is heating
## 19. Power The Gauge Drivers
Now apply motor power to the gauge drivers.
Verify:
- no driver fault LEDs
- no motor heating or runaway movement immediately on power-up
## 20. First Functional Test
Test in this order:
1. confirm the ESP32 can talk to the Mega
2. send `VFD 8888`
3. send `VFD DEAD.!`
4. test one gauge movement from Home Assistant or MQTT
5. test one LED output
## 21. If Something Is Wrong
Use this triage order:
1. check grounds
2. check `VDD` and `VPP`
3. check Mega pin number mistakes
4. check crossed UART lines
5. check that the VFD is still on `46/47/48/49`, not `51/52/53/49`
## 22. Quick Reference
### Mega pins in use
- `D8` -> gauge 1 DIR
- `D9` -> gauge 1 STEP
- `D22` -> WS2812 DIN
- `D46` -> HV5812 DATA
- `D47` -> HV5812 CLOCK
- `D48` -> HV5812 STROBE
- `D49` -> HV5812 BLANKING
- `D50` -> gauge 0 DIR
- `D51` -> gauge 0 STEP
- `D52` -> gauge 2 DIR
- `D53` -> gauge 2 STEP
- `D18` -> UART TX1 to ESP32 RX
- `D19` -> UART RX1 from ESP32 TX
### VFD outputs
- `HVOut1..7` -> `A..G`
- `HVOut8` -> decimal point
- `HVOut9` -> alarm bell
- `HVOut10..13` -> digit grids 1..4
- `HVOut14` -> indicator grid