Hardware & firmware

An Arduino on the SRM-20's internal SPI bus gives a live position readout, electrical touch sensing, bed probing, click-to-jog, zero Z and the fiducial finder.

Optional, and Windows-only

Everything else — traces, drilling, cut-out, panels, double-sided registration, rework, the checks and every export — runs on a stock SRM-20 through VPanel with nothing fitted. Without the link the machine bar says so and stays out of the way. Bed levelling without the Arduino works by measuring the grid by hand.

Install (one-time)

  1. Fit the Arduino Behind the SRM-20's back panel, wired to the controller's SPI header. Full wiring: docs/2026-06-25-srm20-spi-and-bed-leveling.md in the repo.
  2. Flash python scripts/flash_firmware.py syncs the bundled library, compiles, uploads and verifies the board came back as v3. Needs an arduino-cli; the Arduino IDE bundles one. 115200 baud.
  3. Close the Serial Monitor The app cannot open the port while the IDE holds it.
Do not flash from the Arduino IDE

The sketch includes the library with angle brackets, so the IDE resolves it from Documents\Arduino\libraries, not from this repo. A stale copy builds cleanly and quietly lacks commands. flash_firmware.py syncs first, every time.

Probe wiring (every session)

One clip: red (D7) → the copper. The tool is grounded through the collet. Isolate the board from the bed with paper or tape, spindle off. Touch the clip to the bit: the touch chip on the machine bar reads Touching.

How a touch is measured

  • Debounced — three consecutive reads; stepper noise cannot fake a touch.
  • Two-stage verified — a coarse descent to the surface, a lift, then a fine re-touch that must agree within 60 µm or the point reads unstable.
  • Fast above known copper — once the surface is known the descent is coarse until just above it, then fine.

Safety limits (in firmware)

GuardValuePrevents
Drop floor6 mm below safe ZEndless descent on dead wiring
Runaway guard1.2 mm past known copperDrilling into the bed when a point misses copper
Abort everywhereSTOP is honoured between every Z step
Hole-test cap0.2 mm past the surfaceThe fiducial finder plunging into a hole
STOP does not lift the tool

Motion and the spindle stop; the bit stays where it is. Raise it with Page Up before the next move. The retract in the firmware is cancelled by its own abort flag; the fix waits for a moment when the machine is idle to re-flash.

Serial protocol (bench reference)

115200 baud, newline-terminated, microns. The app speaks it for you.

CmdMeaning
D / P id x y / BSet datum / probe a point relative to it / re-touch the reference
T / WTouch-off / touch-off and zero the work-origin Z
H x yHole test at absolute (x, y): copper or hole
J x y / LJog (lifts first) / lift to safe Z
Q / G / VPosition and touch / work origin / version and features
X / S rpmStatus word / spindle on-off (the rpm value is ignored by the machine)
~ ^ % KPause / resume / stop the move / cancel the job
Y / N dx dy dz sMove to the view position / timed relative move
!Abort: stop the spindle and the move in flight