

Thermocouple hat
A twin cylinder head temperature (CHT) gauge running on a Banana Pi M4 Zero, displayed on a 1.3" round SPI LCD. Designed to look like a dark-themed aircraft avionics instrument — two filled-arc gauges side by side, one…
- Size
- 65 × 30 mm
- Copper layers
- 4
- Thickness
- 1.6 mm
- Parts
- 53
- Nets
- 52
- Pads
- 229
- Tracks, vias
- 586, 63
- Pours
- 2
- Routed
- Yes
- KiCad
- KiCad 10.0 (file 20260206)
- Created
- 13 Jun 2026
- Updated
- 8 Jul 2026
Overview
Thermocouple hat is an open-source printed circuit board by hwpaige, from the hwpaige/gauge repository on GitHub. It is a 4-layer board of 65 × 30 mm with 53 parts on 52 nets, routed with 586 tracks and 63 vias.
It is built around the MAX31856, CAT24C256LI and DS3231MZ/V+, with the PRTR5V0U2X and TC1 among its other parts. Its parts include 17 resistors, 14 capacitors, 6 ICs, 6 connectors and 5 diodes.
Main components
5MAX31856
UncategorisedMaxim Integrated (Analog Devices)CAT24C256LI
PDIP-81,000,000 cycles 1.8V~5.5V 100 Years 256Kbit 400kHz 5ms Hardware write protection function、Noise suppression function、Built-in power-on reset (POR) I2C PDIP-8 EEPROM ROHSonsemiEEPROMDS3231MZ/V+
SOIC-8-40℃~+85℃ 2.3V~5.5V Built-in I2C Temperature compensation、Backup power management and battery charging、Alarm function、Locking and tamper-proof、Periodic interrupt output SOIC-8 Real Time Clocks ROHSMaxim Integrated (Analog Devices)Real Time ClocksPRTR5V0U2X
SOT-143-55℃~+125℃ 0.3pF、0.8pF 100W 10V、15V 5V 6.5V 6A 80nA ESD IEC 61000-4-2、IEC 61000-4-5、IEC 61000-4-4 Three channels Unidirectional SOT-143 ESD and Surge Protection (TVS/ESD) ROHSTECH PUBLICESD And Surge Protection (TVS/ESD)TC1
-- Toggle Switches ROHSC&KPre-Ordered Products
README
readme.mdCHT Gauge
A twin cylinder head temperature (CHT) gauge running on a Banana Pi M4 Zero, displayed on a 1.3" round SPI LCD. Designed to look like a dark-themed aircraft avionics instrument — two filled-arc gauges side by side, one per cylinder, with colour-coded temperature zones and a D-DIN digital readout.
Hardware
| Component | Part |
|---|---|
| SBC | Banana Pi M4 Zero (Allwinner H618, quad-core A53) |
| Display | Pimoroni 1.3" Round SPI Colour LCD (ST7789, 240×240) — PIM570 |
| Thermocouple | MAX31855 or MAX6675 breakout (×2, one per cylinder) |
| OS | Armbian Debian Trixie Minimal |
Important: The kernel must provide /dev/fb0 for the ST7789 (see "Kernel framebuffer driver" below). The Python app no longer drives the display directly.
Wiring
Display → BPI M4 Zero 40-pin header
The kernel framebuffer overlay (not the Python app) owns the pins. Example mapping used by current overlays/driver code (confirm against your .dts):
| Display Pin | Signal | BPI Header Pin | Notes (Allwinner) |
|---|---|---|---|
| VCC | 3.3V | Pin 1 | |
| GND | GND | Pin 6 | |
| CS | SPI1 CS0 (PH5) | Pin 24 | |
| SCK | SPI1 SCLK (PH6) | Pin 23 | |
| MOSI | SPI1 MOSI (PH7) | Pin 19 | |
| DC | PI16 | Pin 18 | (offset 272) |
| RST | PC2 | Pin 22 | (offset 66) |
| (BL) | (backlight) | (Pin 35) | Tie to 3.3V (Pin 1) if not software-controlled |
Backlight: tie BL directly to 3.3V for always-on (recommended for gauge). The kernel panel driver typically handles reset/DC in its DT.
Thermocouple (MAX31855 / MAX6675) — to be wired
Thermocouples share the SPI bus with the display using separate CS pins. Wiring and sensor code will be added in a future update.
Project Structure
cht-gauge/
├── setup.sh # One-shot bootstrap — run on fresh Armbian flash
├── gauge.py # Main application (uses kernel /dev/fb0)
├── run.sh # Launch script
├── test_display.py # Legacy userspace test (may fail once kernel owns display)
├── pin_test.py # Dev tool for probing GPIOs/SPI (kernel pins will be busy)
├── driver.py # Legacy userspace ST7789 driver (kept for reference)
├── .gitignore
└── fonts/
└── README.md # Fonts are downloaded by setup.sh, not committed to repoFresh Install Instructions
1. Flash Armbian
Download Armbian Debian Trixie Minimal for BPI M4 Zero:
https://dl.armbian.com/bananapim4zero/Trixie_current_minimalFlash with Armbian Imager or Balena Etcher. Pre-configure WiFi credentials in the imager before flashing.
2. SSH in
Find the device IP via your router's DHCP client list, then:
ssh root@<ip-address>
# Default password: 1234 (you'll be prompted to change it)3. Run setup
wget https://raw.githubusercontent.com/hwpaige/gauge/master/setup.sh
bash setup.shThe script will:
- Set the hostname to
moto(SSH viaroot@moto.localafter reboot) - Enable SPI in
/boot/armbianEnv.txt - Install all system and Python dependencies
- Clone this repo to
/root/gauge - Download the D-DIN font
- Create a Python virtual environment and install packages
- Prompt to reboot
After reboot, SSH back in with:
ssh root@moto.local4. Test the display
Once the kernel framebuffer driver is active (see below), the display is the system primary framebuffer. A basic test that the fb is working:
cat /dev/urandom > /dev/fb0 # noise on screen; Ctrl-C to stopOr (inside venv):
cd /root/gauge
source venv/bin/activate
python3 -c "
import pygame, os
os.environ['SDL_VIDEODRIVER']='fbcon'; os.environ['SDL_FBDEV']='/dev/fb0'
pygame.init()
s = pygame.display.set_mode((240,280))
s.fill((255,0,0)); pygame.display.flip()
input('red fb - press enter'); pygame.quit()
"(If the legacy test_display.py using the Python st7789 package fails with EBUSY, that is expected once the kernel driver owns the pins — it is no longer needed.)
See "Kernel framebuffer driver" section for how the display becomes /dev/fb0.
5. Run the gauge
/root/gauge/run.sh(Or manually: cd /root/gauge && source venv/bin/activate && python3 gauge.py)
Important: Because the kernel is now driving the round display as the primary framebuffer/console, you must run the gauge while on the actual Linux console that the display is attached to (not over SSH in most cases).
- Easiest for testing: Plug a USB keyboard into the Banana Pi. The round display should be showing the login prompt. Login directly there as root and run the command on that console.
- SSH sessions often produce
pygame.error: fbcon not availablebecause the SDL fbcon driver needs a real virtual terminal context. - For production (recommended): use the included
gauge.serviceso it starts automatically on boot and takes over the round display console. No keyboard or SSH run needed after setup.
Auto-start via systemd (recommended)
From SSH on the Pi:
cd /root/gauge
git pull # get the latest gauge.service if you haven't already
sudo cp gauge.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now gauge.service
# Optional: stop the default getty so the gauge owns the console cleanly
# (the service tries to chvt to tty1)
sudo systemctl stop getty@tty1.service
sudo systemctl disable getty@tty1.serviceCheck status:
systemctl status gauge.service
journalctl -u gauge.service -fTo stop it temporarily and get a console back:
sudo systemctl stop gauge.service
sudo chvt 1
# or rebootThe service is configured to restart on failure and attaches to the framebuffer console.
See the on-screen error message in the new gauge.py for more details and a quick kernel-fb test command that does work over SSH.
Application
gauge.py renders two CHT gauges using pygame directed at the Linux framebuffer (/dev/fb0) via SDL fbcon — no desktop environment required.
The kernel (via a DT overlay for the ST7789 panel, typically exposing fb_st7789v or equivalent) must own the display and expose /dev/fb0 (240×280 logical with the round 240×240 visible area at y=40). The Python code now renders offscreen and writes raw RGB565 frames directly to /dev/fb0. This completely avoids SDL's fbcon video driver (which is frequently missing/broken in packaged SDL2 on Armbian) while still benefiting from the kernel's smooth panel handling.
The old userspace Python ST7789 + gpiod + spidev driver path has been removed from the main app (it conflicts with "Device or resource busy" once the kernel claims the pins).
Gauge design
- Black background with slight blue tint
- 270° filled arc sweep per gauge
- Colour zones:
- Green — 0–60% of range (normal)
- Amber — 60–85% (caution)
- Red — 85–100% (danger)
- Tick marks — major at 0%, 50%, 100%; minor every 10%
- Digital readout in the arc colour at the gauge centre
- D-DIN font throughout — industrial/avionics aesthetic
- Centre divider with "CYLINDER HEAD TEMP" header
Temperature ranges
Min/max values are set per-gauge in gauge.py:
draw_gauge(screen, LEFT_CENTER, cht1, 0, 300, "CYL 1", font, small_font)
draw_gauge(screen, RIGHT_CENTER, cht2, 0, 300, "CYL 2", font, small_font)Change 0 and 300 to match your engine's actual operating range.
Sensor reads
The read_cht(channel) function in gauge.py currently returns simulated sine-wave values for testing. Replace it with real MAX31855/MAX6675 SPI reads when the thermocouple hardware is wired up.
Dependencies
System packages
Installed by setup.sh:
gcc,build-essential— for compiling Python C extensionspython3-venv,python3-dev,python3-pipgit,wget,unzipavahi-daemon— enables.localmDNS hostname resolutionlibsdl2-dev,libsdl2-image-dev,libsdl2-ttf-dev— pygame display
Python packages (runtime)
Installed into /root/gauge/venv:
pygame— rendering engine (fbcon targeting kernel/dev/fb0)
st7789, pillow, spidev, gpiod, numpy are also pulled in for the legacy test scripts only.
Kernel framebuffer driver (required)
After the initial setup.sh (which only enables spidev), you must make the ST7789 the kernel's primary framebuffer (/dev/fb0) so that:
- The kernel owns DC, RST, and the SPI pins (your app will no longer get "Device or resource busy").
- Updates are smooth / tear-free (as you observed after the reboot that made the round display primary).
Typical steps (edit as root):
-
Create a device-tree overlay (example name
st7789-fb.dts) in/boot/overlay-user/(or/boot/dtb/overlay/depending on Armbian version). A minimal overlay declares the spi bus + panel compatible (sitronix,st7789v or fbtft), with the correct GPIOs for your board (DC=PI16/272 on pin 18, RST=PC2/66 on pin 22, SPI1 on PH5-8), width/height, and any rotation/x/y offsets the round visible area needs (the gauge code assumes a 240×280 fb with visible content at y=40). -
Compile it:
text armbian-add-overlay /boot/overlay-user/st7789-fb.dts(or
dtc -@ -I dts -O dtb -o /boot/dtb/allwinner/overlay/st7789-fb.dtbo ...and add to user_overlays). -
Edit
/boot/armbianEnv.txt:text overlays=... spi-spidev # or remove spidev if the panel driver claims the bus exclusively user_overlays=st7789-fb # extraargs or param_ lines as required by your overlay (bus num, speed, etc.) -
Reboot.
-
Verify:
text ls -l /dev/fb0 fbset # or cat /sys/class/graphics/fb0/virtual_size (expect something like 240x280)
Once /dev/fb0 is the round display, python3 gauge.py (or run.sh) will use it directly and be super smooth.
If you have a working overlay .dts that matches the Pimoroni 1.3" + BPI M4 Zero pinout (SPI1, offsets 272/66, y_off=40), contribute it!
The gauge code hard-codes the 240×280 / y=40 layout that the kernel driver must expose for the round 240×240 visible panel.
Roadmap
- Wire and integrate MAX31855 thermocouple reads
- Add configurable temperature range and alarm thresholds
- Auto-launch gauge on boot via systemd service
- Add EGT (exhaust gas temperature) display mode
Parts
53| Qty | Value | Footprint | References |
|---|---|---|---|
| 14 | 100n | Capacitor_SMD:C_0402_1005Metric | C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 |
| 8 | 100 | Resistor_SMD:R_0402_1005Metric | R5, R6, R7, R8, R9, R10, R11, R12 |
| 4 | 10k | Resistor_SMD:R_0402_1005Metric | R13, R14, R15, R16 |
| 4 | MAX31856 | Package_SO:TSSOP-14_4.4x5mm_P0.65mm | U2, U3, U4, U5 |
| 4 | MountingHole_2.7mm_M2.5 | MountingHole:MountingHole_2.7mm_M2.5 | MH1, MH2, MH3, MH4 |
| 4 | PRTR5V0U2X | Package_TO_SOT_SMD:SOT-143 | D1, D2, D3, D4 |
| 2 | 3.9k | Resistor_SMD:R_0402_1005Metric | R1, R2 |
| 2 | 4.7k | Resistor_SMD:R_0402_1005Metric | R24, R25 |
| 1 | 330 | Resistor_SMD:R_0402_1005Metric | R23 |
| 1 | CAT24C256 | Package_SO:SOIC-8_3.9x4.9mm_P1.27mm | U1 |
| 1 | DS3231MZ | Package_SO:SOIC-8_3.9x4.9mm_P1.27mm | U6 |
| 1 | GPIO | Connector_PinSocket_2.54mm:PinSocket_2x20_P2.54mm_Vertical | J1 |
| 1 | ID_WP | Jumper:SolderJumper-2_P1.3mm_Open_Pad1.0x1.5mm | JP1 |
| 1 | LED_GREEN | LED_SMD:LED_0603_1608Metric | LED5 |
| 1 | TC1 | TerminalBlock_Phoenix_MPT-0,5-2-2.54_1x02_P2.54mm_Horizontal | J3 |
| 1 | TC2 | TerminalBlock_Phoenix_MPT-0,5-2-2.54_1x02_P2.54mm_Horizontal | J4 |
| 1 | TC3 | TerminalBlock_Phoenix_MPT-0,5-2-2.54_1x02_P2.54mm_Horizontal | J5 |
| 1 | TC4 | TerminalBlock_Phoenix_MPT-0,5-2-2.54_1x02_P2.54mm_Horizontal | J6 |
| 1 | Waveshare_1.28in_Touch | Connector_JST:JST_GH_BM13B-GHS-TBT_1x13-1MP_P1.25mm_Vertical | J2 |
Similar boards
- 4 layers187 × 103 mm

- 2 layers138 × 90.6 mm

- 4 layers99 × 99 mm

PrntrBoardV1
ghent360/PrntrBoard
3D Printer controller board using STM32 NUCLEO-F446 kit TMC2130/2660/2209 drivers
238 parts24 - 2 layers31 × 26.4 mm

- 2 layers72 × 72 mm

- 2 layers260 × 80 mm

- 2 layers38.8 × 49.6 mm

- 2 layers92 × 92 mm

Preheater
hetii/preheater
The controller supports multiple heating zones, thermocouple monitoring, fan control, and a modern web-based interface for managing the entire process directly from a browser.
158 parts
Questions
How big is the Thermocouple hat PCB?
It measures 65 × 30 mm and has 4 copper layers, 1.6 mm thick.
What parts does the Thermocouple hat use?
53 parts, built around the MAX31856, CAT24C256LI, DS3231MZ/V+ and PRTR5V0U2X. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
Where can I download the Thermocouple hat KiCad files?
From the hwpaige/gauge repository on GitHub, at the commit this page was made from: the board is thermocouple_hat/thermocouple_hat.kicad_pcb and its schematic thermocouple_hat/.history/thermocouple_hat.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Can I use the Thermocouple hat design in my own project?
Its repository states no licence, so its author keeps all rights: ask hwpaige before reusing the design.