# SandTable Controller v0.3 (custom PCB) ![render](renders/render-iso.png) A 2-layer, 80 × 63 mm board that replaces the Arduino Uno + CNC shield in the sand table. It uses the **same 4 mounting holes as an Uno**, so it fits the deck standoffs. **Status: designed and checked in KiCad, with order files ready for PCBWay. It has not been built or tested yet.** - **MCU:** ESP32-WROOM-32E (Wi-Fi), running FluidNC. USB-C programming through a CH340C with auto-reset, so no buttons need pressing. - **Motors:** 2× DRV8825 StepStick sockets, with 100 µF bulk capacitors. The board fixes the drivers at 1/32 microstepping and keeps them awake: M0–M2, RESET and SLEEP are all tied to 3.3 V. A4988 drivers also fit and run at 1/16. - **Power:** 12 V barrel jack with a reverse-polarity diode → RECOM R-78E 5 V switching regulator → AMS1117 3.3 V. USB 5 V and regulator 5 V are diode-ORed, so USB alone powers the logic for flashing. The motors need the 12 V supply. - **Connectors:** JST-XH to match the motor cable plugs: - 2× motor - home switch - hall sensor (5 V) - WS2812B LED data (buffered to 5 V) - 4-pin expansion header - **Copper:** ground pour on both layers. The ESP32 antenna sits over a copper-free area at the board edge. ## Changes in v0.3 - **No holes in solder pads.** PCBWay's review of v0.2 found vias inside pads, which they would only build reliably by filling them with resin, for extra cost. - The router now keeps every via at least 0.2 mm from every pad. In v0.2, 26 vias sat in or overlapped pads of small parts. - The ESP32's 12 ground-pad holes are replaced by one solid copper pad, with the same 9 solder windows. - PCBWay can now build it as drawn, with no via filling. - **Parts list:** exact part numbers for the 4-pin header (Sullins PRPC004SAAN-RC), the driver sockets (Sullins PPTC081LFBN-RC) and the 100 µF capacitors (Panasonic EEE-FK1V101GP), as agreed with PCBWay. ## Changes in v0.2 - **Drivers:** DRV8825 instead of TMC2209 in UART mode. The serial line and its resistor are removed, so IO16/IO17 are now free. - **Holes:** the smallest hole is now 0.3 mm. The ESP32 footprint's 0.2 mm ground-pad vias were enlarged, because PCBWay charges extra for holes under 0.3 mm. - **Order files:** a PCBWay order folder (Gerbers, parts list, placement file, assembly drawing, order sheet) replaces the JLCPCB files. - **Silkscreen:** VMOT / EN / DIR are printed beside each driver socket. ## Checks (KiCad 9.0.7, `kicad-cli`) | Check | Result | |---|---| | ERC (schematic) | 0 violations | | DRC (board, all severities) against PCBWay's standard limits: 6/6 mil trace/space, 0.3 mm hole, 0.15 mm ring | 0 violations, 0 unconnected | | Schematic ↔ PCB parity | 0 differences | | Vias within 0.2 mm of a pad, holes inside a pad (checked from the board file) | 0 | ## Ordering from PCBWay Everything for the order is in [`pcbway-order/`](pcbway-order/). [`ORDER.md`](pcbway-order/ORDER.md) there lists the exact settings to enter, which file goes in which upload box, and a note to paste for PCBWay. | File | What | |---|---| | `1-gerbers-…zip` | Board files: Gerbers plus separate plated and non-plated drill files | | `2-bom-…csv` | Parts list for turnkey assembly, with manufacturer part numbers | | `3-centroid-…csv` | Part positions in mm, origin at the board's bottom-left corner | | `assembly-top-…pdf`, `schematic-…pdf` | For PCBWay's engineers if they ask | The DRV8825 modules are not on the order; you plug in your own. The back of the board has PCBWay's "WayWayWay" marker, so their order number prints there instead of on the front. ## Before first power-up 1. **Driver direction.** Line up the module's VMOT, EN and DIR pins with the VMOT / EN / DIR labels on the board. A driver plugged in backwards is destroyed. 2. **Driver current.** On a DRV8825, current limit = 2 × Vref (with the usual 0.1 Ω sense resistors). - Start at about 70 % of the motor's rated current. For example, a 1.0 A motor needs Vref ≈ 0.35 V. - Measure Vref between the trim pot and GND with the 12 V supply connected. - Never plug or unplug a motor while the power is on. 3. **Home switch wiring.** Connect the switch's COM to HOME pin 3 (GND) and its NO contact to pin 2. 4. **Firmware.** - Flash FluidNC over USB with the FluidNC web installer. - Upload `fluidnc/config.yaml` as `config.yaml`. - In the config, X is theta in degrees and Y is rho in mm. `$H` homes rho. - If an axis turns the wrong way, add `:low` to its direction pin. ## ESP32 pin map | Function | GPIO | |---|---| | Theta (spin) STEP / DIR | IO18 / IO19 | | Rho (arm) STEP / DIR | IO27 / IO14 | | Driver enable (shared, low = on, pulled up so the drivers are off at boot) | IO13 | | Rho home switch | IO34 | | Theta hall sensor | IO35 | | LED strip data (through a 74AHCT1G125 buffer) | IO33 | | Status LED | IO2 | | Expansion header | IO32, IO25 | | Free, not connected | IO16, IO17 | ## Files | Path | What | |---|---| | `kicad/` | KiCad 9 project: schematic, board, and project-local symbol and footprint tables | | `sandtable-controller-schematic.pdf` | Schematic | | `pcbway-order/` | Everything to upload to PCBWay, plus `ORDER.md` with the settings | | `renders/` | 3D renders | | `sandtable-controller.step` | 3D model. The copy placed in `sand-table-v2.solidcraft` is v0.1, which has the same outline and holes. | | `fluidnc/config.yaml` | FluidNC machine config (a starting point, not yet run on hardware) | | `tools/` | Python generator: `design.py` (parts, placement, nets, sourcing) → `route.py` (router, ground pour, board file), `sch.py` (schematic), `fab.py` (PCBWay order folder, renders, copy into this folder) | To regenerate everything, run `python3 tools/route.py && python3 tools/sch.py && python3 tools/fab.py`. The KiCad files are built in `~/kicad/sandtable-controller` because the KiCad snap can't read inside `~/snap/`. ## Notes - **5 V budget:** the 5 V regulator supplies 0.5 A. That covers the ESP32 plus a short LED strip (about 10 LEDs at full white). Use a separate 5 V supply for longer strips. - **Noise:** DRV8825s are louder than TMC2209s; expect some motor whine. TMC2209 modules in standalone mode might work in these sockets, but their pin layouts vary by brand, so check before trying one. - **LED strip:** FluidNC doesn't drive the WS2812B header. It's there for other firmware or an add-on later.