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.
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)
- 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.mdin the repo. - Flash
python scripts/flash_firmware.pysyncs the bundled library, compiles, uploads and verifies the board came back as v3. Needs anarduino-cli; the Arduino IDE bundles one. 115200 baud. - Close the Serial Monitor The app cannot open the port while the IDE holds it.
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)
| Guard | Value | Prevents |
|---|---|---|
| Drop floor | 6 mm below safe Z | Endless descent on dead wiring |
| Runaway guard | 1.2 mm past known copper | Drilling into the bed when a point misses copper |
| Abort everywhere | — | STOP is honoured between every Z step |
| Hole-test cap | 0.2 mm past the surface | The fiducial finder plunging into a hole |
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.
| Cmd | Meaning |
|---|---|
D / P id x y / B | Set datum / probe a point relative to it / re-touch the reference |
T / W | Touch-off / touch-off and zero the work-origin Z |
H x y | Hole test at absolute (x, y): copper or hole |
J x y / L | Jog (lifts first) / lift to safe Z |
Q / G / V | Position and touch / work origin / version and features |
X / S rpm | Status word / spindle on-off (the rpm value is ignored by the machine) |
~ ^ % K | Pause / resume / stop the move / cancel the job |
Y / N dx dy dz s | Move to the view position / timed relative move |
! | Abort: stop the spindle and the move in flight |