92 lines
2.3 KiB
Markdown
92 lines
2.3 KiB
Markdown
# arduino_gauge_controller
|
|
|
|
A dedicated gauge controller for Arduinos.
|
|
|
|
## Overview
|
|
|
|
This repository contains:
|
|
|
|
- `Gaugecontroller/Gaugecontroller.ino`: the Arduino Mega firmware for the stepper gauges, LEDs, and integrated HV5812-based VFD
|
|
- `gauge.py`: the ESP32 / MicroPython MQTT bridge that exposes the controller to Home Assistant
|
|
|
|
## VFD Support
|
|
|
|
The integrated gauge controller now includes a 4-digit VFD with:
|
|
|
|
- 4 alphanumeric digits
|
|
- decimal point indicator
|
|
- alarm bell indicator
|
|
|
|
On the merged Arduino firmware, the HV5812 control pins are:
|
|
|
|
- `D46` -> `DATA`
|
|
- `D47` -> `CLOCK`
|
|
- `D48` -> `STROBE`
|
|
- `D49` -> `BLANK/OE`
|
|
|
|
The standalone VFD sketch used `D51/D52/D53/D49`, but `51/52/53` conflict with the gauge stepper pins in the integrated controller.
|
|
|
|
## Arduino Serial Commands
|
|
|
|
The merged Arduino firmware accepts:
|
|
|
|
- `VFD`
|
|
clears the display and turns off decimal point and alarm bell
|
|
- `VFD 1234`
|
|
- `VFD 0123`
|
|
- `VFD DEAD`
|
|
- `VFD 8888.`
|
|
- `VFD BEEF!`
|
|
- `VFD 12AF.!`
|
|
|
|
Rules:
|
|
|
|
- up to 4 characters are displayed
|
|
- valid characters are `0-9`, `A-F`, and `-`
|
|
- `.` enables the decimal point
|
|
- `!` enables the alarm bell
|
|
- shorter values are right-aligned
|
|
- leading zeroes are preserved if they are part of the input
|
|
|
|
## Home Assistant Entities
|
|
|
|
The MQTT bridge publishes Home Assistant discovery entities for the VFD:
|
|
|
|
- `VFD Display`
|
|
text entity for the displayed value
|
|
- `VFD Decimal Point`
|
|
switch entity
|
|
- `VFD Alarm`
|
|
switch entity
|
|
|
|
The display is intentionally exposed as a text entity rather than a numeric entity so that:
|
|
|
|
- leading zeroes are preserved
|
|
- hexadecimal values like `DEAD` or `BEEF` work
|
|
- clearing the display is possible with an empty value
|
|
|
|
## MQTT Topics
|
|
|
|
Using the configured `mqtt_prefix` from `config.json`, the VFD topics are:
|
|
|
|
- `<prefix>/vfd/set`
|
|
- `<prefix>/vfd/state`
|
|
- `<prefix>/vfd/decimal_point/set`
|
|
- `<prefix>/vfd/decimal_point/state`
|
|
- `<prefix>/vfd/alarm/set`
|
|
- `<prefix>/vfd/alarm/state`
|
|
|
|
Example with the default prefix `gauges`:
|
|
|
|
- `gauges/vfd/set`
|
|
- `gauges/vfd/decimal_point/set`
|
|
- `gauges/vfd/alarm/set`
|
|
|
|
Example payloads:
|
|
|
|
- publish `0123` to `gauges/vfd/set`
|
|
- publish `ON` to `gauges/vfd/decimal_point/set`
|
|
- publish `OFF` to `gauges/vfd/alarm/set`
|
|
|
|
The MQTT bridge then converts that into the correct Arduino serial command such as `VFD 0123.`.
|