Files
arduino_gauge_controller/wiring.md

6.9 KiB

Wiring

This document describes the wiring required for the current integrated system:

  • Arduino Mega 2560
  • HV5812P VFD driver
  • 4-digit VFD tube with decimal point and alarm bell
  • 3 stepper-driven gauges
  • WS2812B LEDs
  • ESP32 running gauge.py as 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:

  1. 5V logic for the Arduino Mega logic, the HV5812 logic side, and usually the step/dir logic inputs
  2. high voltage for the VFD for HV5812P VPP and the VFD segment/grid drive
  3. motor / actuator power for 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 <- regulated 5V logic supply
  • Mega GND <- common logic ground

Serial bridge to ESP32:

  • Mega RX1 pin 19 <- ESP32 TX GPIO 17
  • Mega TX1 pin 18 -> ESP32 RX GPIO 16
  • Mega GND <-> ESP32 GND

This matches the current code:

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:

  • VDD is the low-voltage logic rail
  • VPP is the high-voltage output rail
  • do not connect Arduino 5V to VPP

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:

  • DIR
  • STEP
  • optionally ENABLE if 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 driver DIR
  • Mega D51 -> Gauge 0 driver STEP
  • Mega D8 -> Gauge 1 driver DIR
  • Mega D9 -> Gauge 1 driver STEP
  • Mega D52 -> Gauge 2 driver DIR
  • Mega D53 -> Gauge 2 driver STEP

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.

WS2812B LED Strip

The current sketch expects one shared WS2812B chain.

Mega Pin WS2812B
D22 DIN
5V 5V
GND GND

Notes:

  • the code expects 7 LEDs per gauge, so 21 LEDs total
  • 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 -> LED 5V
  • connect external GND -> LED GND
  • connect that same GND to Mega 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.3V or board-supported USB/5V input, depending on your board
  • do not feed raw 5V into a bare 3.3V ESP32 module unless the board has its own regulator

One-Page Wiring Summary

Power

  • 5V logic supply -> Mega 5V
  • 5V logic supply -> HV5812 VDD
  • 5V logic supply -> WS2812B 5V
  • motor supply -> gauge driver motor power inputs
  • VFD high-voltage supply -> HV5812 VPP
  • all grounds common

Mega to ESP32

  • Mega 19 (RX1) <- ESP32 GPIO17 (TX)
  • Mega 18 (TX1) -> ESP32 GPIO16 (RX)
  • Mega GND <-> ESP32 GND

Mega to HV5812

  • D46 -> DIN
  • D47 -> CLK
  • D48 -> STROBE
  • D49 -> BLANKING
  • 5V -> VDD
  • GND -> GND
  • VFD HV+ -> VPP

HV5812 to Tube

  • HVOut1..7 -> segments A..G
  • HVOut8 -> decimal point
  • HVOut9 -> alarm bell
  • HVOut10..13 -> digit grids 1..4
  • HVOut14 -> indicator grid

Mega to Gauges

  • D50/D51 -> gauge 0 DIR/STEP
  • D8/D9 -> gauge 1 DIR/STEP
  • D52/D53 -> gauge 2 DIR/STEP

Mega to LEDs

  • D22 -> WS2812B DIN
  • 5V -> WS2812B 5V
  • GND -> WS2812B GND

Sanity Checklist Before Power-On

  • Mega, ESP32, HV5812 logic, LED strip, and driver logic grounds are all common
  • Mega D46-D49 go to the HV5812, not to the gauge drivers
  • Mega D50-D53 and D8-D9 go only to the gauge drivers
  • HV5812 VDD is 5V
  • HV5812 VPP is the VFD high-voltage rail, not 5V
  • 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

If you want, the next useful step is a second document with a literal bench-build checklist:

  • wire 1 from Mega D46 to HV5812 pin ...
  • wire 2 from Mega D47 to HV5812 pin ...
  • wire 3 from ESP32 GPIO17 to Mega pin 19

That would be the most practical format for cleaning up the desk wiring.