← all projects

project

A touchscreen system monitor over UART

A Nextion 4.3-inch panel wired to a Pi showing live CPU, RAM, disk and network, with touch controls for refresh and safe shutdown.

Date
Oct 2023
Role
Solo build — HMI design, Pi service
Status
shipped
Built with
Python 3, Nextion HMI, pyserial, psutil, systemd

I wanted a dedicated physical display for Pi metrics — something on the desk that tells you what the system is doing without an SSH session or a browser tab. A Nextion 4.3-inch touchscreen wired to the Pi over UART: TX, RX, 5V, GND.

What I liked about it is how genuinely bidirectional it is. The Pi pushes metric updates using Nextion’s command protocol every 5 seconds; the display sends touch events back when someone presses refresh or shutdown. I designed the GUI in Nextion Editor and named every component to match its Python variable — tCpuTemp, tRamUsage — which kept the update loop readable without comments.

One detail caught me out: every Nextion command must terminate with exactly three 0xFF bytes. Miss one and the display fails silently, with no error. I wrapped the whole protocol in a single command function so no calling code touches the raw serial write.

What I took away

Hardware UART on a Pi isn’t ready out of the box. The serial console, UART overlay assignment and user permissions all need explicit configuration, and each step fails silently if skipped.

Timing delays between serial writes feel like a hack but are often correct embedded practice — the display has a fixed internal buffer and no flow control, so pacing is the sender’s responsibility.

GUI object naming conventions pay off immediately. Matching component names to variable names meant the update loop needed no explanation.

Embedded LinuxHardware