- 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
7.4 KiB
Wiring
This document describes the wiring required for the current integrated system:
Arduino Mega 2560HV5812PVFD driver- 4-digit VFD tube with decimal point and alarm bell
- 3 stepper-driven gauges
- WS2812B LEDs
- ESP32 running
gauge.pyas the MQTT / Home Assistant bridge
It is intentionally based on the code that is in the repository now:
System Power
You effectively have three power domains:
5V logicfor the Arduino Mega logic, the HV5812 logic side, and usually the step/dir logic inputshigh voltage for the VFDforHV5812P VPPand the VFD segment/grid drivemotor / actuator powerfor the stepper gauges and their driver hardware
Minimum common rule:
- all logic grounds must be common
That means these must share GND:
- Arduino Mega
GND - ESP32
GND - HV5812P logic
GND - stepper driver logic
GND - WS2812B
GND
The VFD high-voltage supply still references the same ground, but its high-voltage nodes must never be connected directly to Arduino or ESP32 GPIO pins.
Arduino Mega 2560
Use the Mega as the central logic controller.
Power:
Mega 5V<- regulated5Vlogic supplyMega GND<- common logic ground
Serial bridge to ESP32:
Mega RX1pin19<-ESP32 TXGPIO17Mega TX1pin18-> voltage divider ->ESP32 RXGPIO16Mega GND<->ESP32 GND
This matches the current code:
- Arduino uses
Serial1in Gaugecontroller.ino - ESP32 uses
UART(1, tx=17, rx=16)in gauge.py
Because the Mega transmits 5V logic and the ESP32 expects 3.3V logic on RX, add a resistor divider on the Mega TX1 -> ESP32 RX line.
Suggested simple divider:
Mega TX1->1 kOhmresistor -> divider node- divider node ->
2 kOhmresistor ->GND - divider node ->
ESP32 GPIO16 (RX)
That scales the Mega's 5V TX signal to roughly 3.3V for the ESP32 RX input.
VFD Control: Mega -> HV5812P
These are the integrated pin assignments used by the merged controller:
| Mega Pin | HV5812P Signal | Purpose |
|---|---|---|
D46 |
DATA IN / DIN |
serial data into HV5812P |
D47 |
CLOCK / CLK |
shift clock |
D48 |
STROBE / LATCH |
latch transfer |
D49 |
BLANKING / OE |
output blanking |
5V |
VDD |
HV5812 logic supply |
GND |
GND |
common reference |
VFD HV+ |
VPP |
HV5812 high-voltage rail |
Important:
VDDis the low-voltage logic railVPPis the high-voltage output rail- do not connect Arduino
5VtoVPP
HV5812P -> VFD Tube
The current output map is:
| HV5812 Output | Tube Function |
|---|---|
HVOut1 |
segment A |
HVOut2 |
segment B |
HVOut3 |
segment C |
HVOut4 |
segment D |
HVOut5 |
segment E |
HVOut6 |
segment F |
HVOut7 |
segment G |
HVOut8 |
decimal point segment |
HVOut9 |
alarm bell segment |
HVOut10 |
digit grid 1 |
HVOut11 |
digit grid 2 |
HVOut12 |
digit grid 3 |
HVOut13 |
digit grid 4 |
HVOut14 |
indicator grid between digits 2 and 3 |
Logical segment layout:
---A---
| |
F B
|---G---|
E C
| |
---D---
Additional VFD wiring notes:
- the VFD filament/heater wiring is separate from the HV5812 outputs
- the exact filament supply depends on your tube
- the HV5812 only drives the segments and grids
Gauge Control Pins
The current sketch drives three gauges.
Each gauge needs a driver or actuator input that accepts:
DIRSTEP- optionally
ENABLEif you later add one in code
Current assignments:
| Gauge | Mega DIR | Mega STEP |
|---|---|---|
Gauge 0 |
D50 |
D51 |
Gauge 1 |
D8 |
D9 |
Gauge 2 |
D52 |
D53 |
Connect each pair to the matching stepper driver inputs.
Example:
Mega D50-> Gauge 0 driverDIRMega D51-> Gauge 0 driverSTEPMega D8-> Gauge 1 driverDIRMega D9-> Gauge 1 driverSTEPMega D52-> Gauge 2 driverDIRMega D53-> Gauge 2 driverSTEP
Also connect:
Mega GND-> each driver logic ground
If your driver boards need separate motor power, supply that from the proper motor supply. Do not power motors from the Mega 5V pin.
WS2812 LED Strips
The current sketch expects two LED data chains. Backlight and status LEDs stay on the main strip; the red/green dial indicator LEDs are on their own strip.
| Mega Pin | LED Strip |
|---|---|
D22 |
main backlight/status DIN |
D36 |
indicator DIN |
5V |
both strips 5V |
GND |
both strips GND |
Notes:
- the command protocol still exposes
7 LEDs per gauge - logical indices
0-2are backlight,3-4are indicators, and5-6are status - use a proper 5V supply sized for the LED current
- keep LED ground common with the Mega
If the strip is powered from a separate 5V supply:
- connect external
5V-> LED5V - connect external
GND-> LEDGND - connect that same
GNDtoMega GND
ESP32 Bridge
The ESP32 runs gauge.py and talks to the Mega over UART and to Home Assistant over MQTT/Wi-Fi.
ESP32 to Mega:
| ESP32 Pin | Mega Pin | Purpose |
|---|---|---|
GPIO17 |
RX1 pin 19 |
ESP32 TX -> Mega RX |
GPIO16 |
TX1 pin 18 |
ESP32 RX <- Mega TX |
GND |
GND |
common ground |
ESP32 power:
- power the ESP32 from a proper
3.3Vor board-supported USB/5V input, depending on your board - do not feed raw
5Vinto a bare3.3VESP32 module unless the board has its own regulator
One-Page Wiring Summary
Power
5V logic supply-> Mega5V5V logic supply-> HV5812VDD5V logic supply-> WS2812B5Vmotor supply-> gauge driver motor power inputsVFD high-voltage supply-> HV5812VPP- all grounds common
Mega to ESP32
Mega 19 (RX1)<-ESP32 GPIO17 (TX)Mega 18 (TX1)-> resistor divider ->ESP32 GPIO16 (RX)Mega GND<->ESP32 GND
Resistor divider on Mega TX1:
Mega TX1->1 kOhm-> divider node- divider node ->
ESP32 GPIO16 - divider node ->
2 kOhm->GND
Mega to HV5812
D46->DIND47->CLKD48->STROBED49->BLANKING5V->VDDGND->GNDVFD HV+->VPP
HV5812 to Tube
HVOut1..7-> segmentsA..GHVOut8-> decimal pointHVOut9-> alarm bellHVOut10..13-> digit grids1..4HVOut14-> indicator grid
Mega to Gauges
D50/D51-> gauge 0DIR/STEPD8/D9-> gauge 1DIR/STEPD52/D53-> gauge 2DIR/STEP
Mega to LEDs
D22-> WS2812BDIN5V-> WS2812B5VGND-> WS2812BGND
Sanity Checklist Before Power-On
- Mega, ESP32, HV5812 logic, LED strip, and driver logic grounds are all common
- Mega
D46-D49go to the HV5812, not to the gauge drivers - Mega
D50-D53andD8-D9go only to the gauge drivers - HV5812
VDDis5V - HV5812
VPPis the VFD high-voltage rail, not5V - ESP32 UART is crossed correctly: TX -> RX, RX -> TX
- WS2812B has its own adequate 5V supply if current draw is significant
- motor power is not coming from the Mega
What This Does Not Define
This document does not define:
- the exact VFD filament supply voltage/current
- the exact motor driver board power pins, because that depends on the driver hardware you are using
- the physical PDIP package pin numbers of the HV5812P