Collaborations

Wireless display for LinuxCNC

A round display that sits on the mill and shows live what LinuxCNC is doing: spindle RPM, feed, axis position, spindle and coolant. No cables to the cabinet and no touching the realtime part. I built it for my EMCO F1 CNC and released it as an open project.

Code and drawings on GitHubDesign document (PDF, 39 pages)Version 1.0.0

Subscribe to the channelNew chapters of the restoration and LinuxCNC projects
Goodbye, cables: an ESP32 display for LinuxCNC (and it’s FREE)
BoardWaveshare ESP32-S3-Touch-LCD-2.8C
DisplayRound 480 × 480 IPS (ST7701S), capacitive touch (GT911)
ProcessorDual-core ESP32-S3 at 240 MHz, 16 MB of flash and 8 MB of PSRAM
PC sideUserspace HAL component, Python 3 with no external libraries
FirmwareESP-IDF 5.3.2 and LVGL 8, in C
LinkUDP over Wi-Fi, 25 snapshots per second
RequirementsLinuxCNC 2.9 or later (uspace) with Wi-Fi on the PC
Battery3.7 V 3000 mAh LiPo, with on-board charger
Enclosure3D printed, 111 × 112 × 27 mm
LicenseMIT (software) and CC BY 4.0 (enclosure)
Version1.0.0, November 17, 2026

Three pages on a round screen

These images are not mock-ups: they are drawn by the firmware code itself, running on a PC with LVGL. You change page by tapping the logo at the top; the rest of the screen doesn't navigate, so an accidental touch does nothing.

Classic page: RPM needle with warning arc, feed in mm/min, machine X, Y and Z, spindle, coolant and battery
Classic page: RPM needle with warning arc, feed in mm/min, machine X, Y and Z, spindle, coolant and battery
DRO page: work or machine coordinates with three decimals, active G54 to G59.3 system and optional zeroing
DRO page: work or machine coordinates with three decimals, active G54 to G59.3 system and optional zeroing
Spindle page: speed slider, -100 and +100 buttons, start and stop (optional)
Spindle page: speed slider, -100 and +100 buttons, start and stop (optional)

Why I made it

From the mill I can't see the LinuxCNC monitor well, and while I work I mostly look at three things: how fast the spindle is turning, what feed the table is moving at and where the tool is. I wanted that data right in front of me, big, with a needle that moves like a real tachometer.

The conditions were clear: no new cables to the cabinet, no touching the realtime part or the link to the Mesa 7i76E, no Internet or servers, and on the PC only what LinuxCNC already ships with. Above all, by default it must not be able to change anything on the machine.

The display mounted on the EMCO F1 CNC
The display mounted on my EMCO F1 CNC.

How it is built

Two separate networks on the same PC: the Mesa's dedicated Ethernet stays exactly as it was, and the display only talks to the PC over the home Wi-Fi.

LinuxCNC PC Servo thread (realtime)hm2_eth · 1 kHz panel_wifi (userspace)Python 3 · loadusr · only reads HAL pins NML: linuxcnc.stat() · 40 msIP_PKTINFO → Wi-Fi Dedicated Ethernet10.10.10.0/24 Mesa 7i76EMachine: drives, spindle, coolant ✕ No display traffic ever goes this way Wi-Fi Home router2,4 GHz · DHCP ESP32-S3 display480 × 480, touch UDP · 25 snapshots/s · JSON ≤ 1200 B

The PC runs panel_wifi, a userspace HAL component that LinuxCNC loads with loadusr like any other. It only has input pins: it reads RPM, feed, X, Y and Z, spindle and coolant, and never writes anything to HAL. It doesn't run in the servo or base thread, so the network, with its unpredictable delays, can't affect axis control.

It reads work coordinates and interpreter state from LinuxCNC with linuxcnc.stat() every 40 ms, in a separate thread. With all that it builds a complete snapshot and sends it 25 times per second.

Display traffic is pinned to the Wi-Fi card with IP_PKTINFO: every packet leaves through that interface and with its address, even if the routing table changes, and anything that doesn't come in on the Wi-Fi is dropped. On top of that, the sender refuses to start if the Wi-Fi network overlaps the Mesa one. Not a single display packet ever goes down the Mesa cable.

No MQTT broker, no cloud, no fixed IP addresses: both ends can use DHCP and find each other.

From HAL pin to needle

The path of one value, with typical times. A change shows up on the display 10 to 60 ms later, more than enough for a smooth needle.

1. Readingpanel_wifi reads the HAL pins and the latest LinuxCNC snapshot: under 1 ms
2. MessageIt turns them into a compact JSON of about 400 bytes; never over 1200, so the packet isn't fragmented
3. SendingOne UDP datagram over Wi-Fi: 2 to 10 ms
4. ValidationThe display checks it whole or drops it whole: under 1 ms
5. DrawingEvery 40 ms only what changed is updated; moving the needle takes a few milliseconds

Every packet carries every value. If one is lost, the next arrives 40 ms later and replaces it; nothing is rebuilt from deltas. A missing value is sent empty and the screen shows dashes: “Z 0” and “no idea where Z is” are never confused.

They find each other

Once it joins the Wi-Fi, the display broadcasts a hello on its local network every second, with the machine name, its own MAC address and a random 64-bit number that identifies the session. The PC only answers the configured machine-display pair, and only if the hello arrives on the Wi-Fi, from that subnet and from the right port.

From then on the PC sends snapshots only to that display, and each one echoes the display's session number and a sequence counter. The display drops anything that isn't from its session or is older than the last thing it showed, so a late packet or one from another PC can't slip in.

And they recover on their own

If the display goes one second without valid data, it says so in big letters (NO DATA), makes up a new session number and looks for the PC again. If the PC goes three seconds without a hello, it stops sending but keeps listening forever: a display switched on an hour later connects straight away.

The PC checks its Wi-Fi interface every two seconds, and if the router gives it another address it rebuilds the link without restarting LinuxCNC. Switching the display off, rebooting the router or closing and reopening LinuxCNC needs nothing from you.

What the display taught me

The board draws from PSRAM shared by the processor, the display DMA and the Wi-Fi. That shaped almost every firmware decision.

With the settings from Waveshare's demo, as soon as there was Wi-Fi traffic the image drifted sideways and flickered, and the main task ran out of stack. The fix was lowering the pixel clock to 8 MHz (about 29 frames per second, plenty) and no longer redrawing the whole screen.

Now LVGL only draws the areas that changed, into a 20-line buffer in internal RAM, and copies them into a single 450 KiB framebuffer in PSRAM. A value is only rewritten if its text changed: 25 identical snapshots don't cause a single copied pixel.

Main loopJust one, every 5 ms: network, battery, updates and drawing
RefreshUp to 25 times per second, only what changes
Framebuffer480 × 480 × 2 bytes = 450 KiB in PSRAM
Draw buffer480 × 20 lines = 18.75 KiB in internal RAM
Task stack16 KiB (the default 3.5 KiB overflowed)
Dynamic memoryEverything is created at boot; nothing fragments over time

Read-only out of the box

As shipped, the display can't change anything on the machine. Control is optional and doesn't exist until you put the same 64-character private key on the PC and on the display.

With the key set, the display allows exactly four actions, and the PC turns them into fixed MDI blocks. There is no free G-code, no jogging, no homing, no program start and no E-stop reset: the values come from bounded fields (0 to 5000 RPM, work coordinate systems 1 to 9, axes X, Y, Z or all three), never from text received over the network.

SpeedS<rpm>, only if the spindle is already turning
StartS<rpm> M3
StopM5 S0
Work zeroG10 L20 P<wcs> X0 Y0 Z0, only the chosen axes

A command only runs with the machine idle in manual mode: powered on, no E-stop, no program or pause, axes homed and spindle override at 100 %. The PC checks this before switching to MDI and again right before sending the block; if anything changes in between, such as a cycle start or a switch from G54 to G55, the command is abandoned.

Every command and every answer is signed with HMAC-SHA256 and carries a permission token that expires in one second, so a captured command can't be replayed. A command with a bad signature doesn't even get an answer. And if the confirmation is lost, the display says so (NOT CONFIRMED) but never resends a start or a zero.

It is not a safety device. Safety is the machine's hard-wired E-stop, as always.

Updates over Wi-Fi

After the first USB flash, the firmware updates without a cable. The LinuxCNC PC itself serves the new image; nothing goes through the Internet. The update offer travels inside the data, signed with the key and with the current session number, so a captured offer is useless in another session.

The display only updates with the machine idle in manual mode. It writes the image to the free partition while computing its SHA-256, and only switches partition if it matches the signed one. The new image boots on trial and isn't accepted until it receives data from the PC; if it never gets that far, the bootloader goes back to the previous one by itself. A bad update can never leave the display unusable.

Battery

The board has a LiPo connector and charger, but it doesn't tell the ESP32 whether it is charging. The only thing that can be measured is the voltage, on GPIO4 through a 200k/100k divider. The firmware reads it once per second, filters it and turns it into a percentage with the typical curve of a 3.7 V LiPo.

The charging bolt is an inference: a 35 mV jump within 10 seconds when plugging in, a rising trend over 5 minutes, or more than 4.17 V. The documentation says it plainly: it's an estimate, not a fuel gauge.

Battery icon states

The enclosure

Designed in Fusion and 3D printed. It measures 111 × 112 × 27 mm assembled and has a knurled ring around the screen, a battery lid, a guided button for the board's switch and inlaid red lettering.

Display enclosure, front and back view
FilesFusion (.f3d), STEP, 3MF and one STL per part
PartsFront half, back half, ring, battery lid, button, 4 alignment pins and red lettering
LicenseCC BY 4.0

The parts are exported in their assembled position: lay them flat on the bed before slicing.

The display on the EMCO F1, showing the DRO page
The display on the EMCO F1, showing the DRO page
In the hand, with the spindle at 4400 rpm
In the hand, with the spindle at 4400 rpm
The printed enclosure, from the back
The printed enclosure, from the back
From the side, next to the mill's vise
From the side, next to the mill's vise

Also published on

Besides the repository, I've published it on sites where people share projects and parts to print. If you print it or build it, you can tell me there too.

Design decisions

Each one comes from a requirement or from something that went wrong on the machine. The design document has all fifteen, with the alternatives I rejected.

Userspace HAL componentThe network has unpredictable delays and has no business in the servo thread. A display needs 25 Hz, not 1 kHz.
UDP instead of TCP or MQTTWith live data only the latest value matters. TCP would resend stale values exactly when the Wi-Fi is struggling; MQTT needs a broker.
JSON instead of binaryYou can read it with tcpdump while debugging. At 25 Hz and 400 bytes it's 10 KB/s: size doesn't matter.
Broadcast helloFixed IPs break when the router changes, and mDNS doesn't work on every home router.
Full snapshotsWith deltas, one lost packet leaves the screen wrong until the value changes again.
HMAC with a shared keyThe data isn't secret, but commands have to be genuine. DTLS would be much more code for the same result.
Fixed MDI blocksLinuxCNC applies its own rules and refuses MDI while a program is running. The zero uses G10 L20 and LinuxCNC computes it.
A single loop on the displayLVGL isn't thread-safe; with a single loop there is nothing to lock.

How I tested it

Everything that can run on a PC is tested on every push to GitHub: 49 Python tests, C tests for the message parser, signatures, battery and updates, and a test that compiles the display pages with LVGL against an in-memory framebuffer, simulates touches and counts the redrawn pixels. The images on this page come from there.

Signatures are computed in Python and checked in C with the same mbedTLS library as the firmware, so the two sides can't disagree. Finally, continuous integration builds the complete firmware for the ESP32-S3.

And on the machine

What only shows on the hardware has its own manual test list: compare the values with the LinuxCNC GUI, switch off the display and the router, check with tcpdump that nothing goes down the Mesa cable, measure servo thread times with and without the component, test the control with a program running and paused, and hit the E-stop with the spindle started from the display.

There is a demo program that cuts air around the G54 zero: it moves X, Y and Z together, steps the spindle through 1000, 2500 and 5000 RPM and toggles the coolants, so you can see everything move.

Installing it on your machine

The full steps are in the repository documentation. In short:

1. FirmwareBuild it with ESP-IDF 5.3.2, flash it over USB and store your Wi-Fi in NVS. The password never goes into the firmware.
2. LinuxCNC PCClone the repository and write local/host.json with your Wi-Fi interface, the machine name, the display's MAC and the Mesa network.
3. Test without HALpython3 run_panel.py --demo --config local/host.json: the display shows DEMO and test data.
4. HALAdd panel_wifi.hal after your main HAL file in the INI. Removing it means deleting that line.

LinuxCNC setup · Firmware · UDP protocol · Control channel · Updates · Battery · Troubleshooting · Design documentation

The repository documentation is in English, the language of the LinuxCNC forum.

On the LinuxCNC forum

I presented it in the «Show Your Stuff» section of the official LinuxCNC forum. There I explain where it's heading: the next ideas are spindle load and the active tool number. If you fit one to your machine, it's the best place to tell us or ask.

The same video shows the conversational screens I use in Probe Basic, which are also published: PB_Conversational, thread milling, pockets and backlash for Probe Basic.

What's next comes out on YouTube

Every week: restoration progress, new parts and what goes wrong, told as it is.

Subscribe to DominicZe