main
John Lauer A5: 6-layer stackup, MCU strip on the back face (front = pure LED canvas) 8a946a4

Tile generator engineering spec (hand this to the implementer)

Goal

Generate a complete KiCad 10 project for ONE LED-grid tile: tile.kicad_pcb (+ tile.kicad_pro, and a presentable hierarchical tile.kicad_sch), plus the two aiflow input files moves.json (placement) and route-plan.json (routing), all from one Python generator. Everything must be regenerable from source.

Hard geometry

  • Board: 160.0 x 160.0 mm. Origin (0,0) = top-left corner of the board outline; +x right, +y DOWN (KiCad pcb convention).
  • 4 layers: F.Cu (0), In1.Cu (1) = GND plane, In2.Cu (2) = V5 plane, B.Cu (31) = B.Cu signal/GND rails.
  • Stackup in the board file: 4 copper layers, 35um outer / 35um inner copper, 1.6mm total. JLC-style dielectric is fine.
  • Edge.Cuts rectangle (0,0)-(160,160). Edge clearance for copper: 0.5mm. Clearance 0.2mm. Track min 0.15mm; via 0.6/0.3mm (0.45/0.2 allowed where tight).
  • MCU strip: y in [144, 160] (bottom 16mm). LED field: y in [2.5, 142.5].

LED field

  • LED: Dialight 587-1024-147F, 2020 package. Footprint Dialight_587-1024-147F: 4 SMD pads 0.8x0.8mm at (+/-0.45, +/-0.45)mm; pin 1=DOUT, 2=VDD, 3=DIN, 4=GND (pad-to-corner assignment must match the published footprint file, parse it, do not hardcode corners). Courtyard 2.8x2.8mm.
  • Grid: 40 columns x 36 rows, pitch 4.0mm. x_i = 4.0 + i4.0 (i=0..39) -> 4.0..160-4.0. y_j = 2.5 + 2.0 + j4.0 (j=0..35) -> rows centered in field, exact margin computed by the generator (state it).
  • Refs: D1..D1440 numbered in CHAIN order (see below), so firmware index == ref order.
  • Chains: 4 chains x 360 LEDs. Chain c (0..3) covers rows 9c..9c+8, serpentine: even global row left->right, odd row right->left. So chain order within chain c: for local row r in 0..8, global row j=9c+r; if j even: i=0..39 ascending, else descending.
  • LED orientation: the generator chooses 0/90/180/270 rotation per LED to keep every DOUT->DIN link <= 3.2mm and inside the inter-cell gutters. All LEDs in the field MUST end up with the same visual orientation (lens/pin-1 mark facing the same way) UNLESS a wrap link forces otherwise; prefer uniform 0° with links in gutters; if the pad map makes that impossible, use per-row alternation but keep it consistent within a row and document the pattern.
  • Data links: DOUT(k) -> DIN(k+1), straight or single-L traces 0.25mm wide on F.Cu, in the horizontal or vertical gutters between cells. No vias on data links except the 4 chain-input feeds (from U4 outputs on B.Cu up to the first LED of each chain).
  • VDD distribution: one horizontal VDD rail per row on F.Cu, 0.9mm wide, running in the 2mm gutter between rows (exact y computed to clear pads by >=0.2mm). Each LED's VDD pad stubs to its row's rail (short vertical stub, part of the rail path or its own tiny path entry). Rails stitch to In2.Cu (V5) with a 0.6/0.3 via every 5th LED position (8 vias per row rail).
  • GND: each LED's GND pad gets a via-in-pad-adjacent 0.6/0.3 via to In1.Cu (GND) — one via per LED placed in the gutter 1.1mm clear of everything. If DRC fights this, switch to: GND rails on B.Cu between rows + via per LED to the B rail. Pick ONE scheme, verify with DRC, document it.
  • NO silkscreen ref text per LED (1440 labels = unreadable). Set reference hidden on LED footprints; keep a small row/column index silk every 4 rows/cols on F.SilkS if it fits without overlap (optional, else none).

MCU strip (y 144..160) — parts and fixed placement intent

Left to right: J1 USB-C (TYPE-C-31-M-12) at left edge x8 (connector overhangs board edge per its footprint), decoupling cluster, Y1 crystal near U1, U1 RP2040 (x55), U2 W25Q128FVSIG flash, U3 AP2112K-3.3 LDO, U4 SN74AHCT125PWR, MP1/MP2 MachineContactLarge (V5) and MP3/MP4 (GND) at right edge x~130/145. All on F.Cu side. Schematic connectivity (the MCU section):

  • USB-C: VBUS -> V5 net; GND -> GND; CC1/CC2 -> 5.6k to GND each (R); D+ -> 22R -> RP2040 USB_DP; D- -> 22R -> RP2040 USB_DM; shield -> GND via 1Meg || 100nF? NO — tie shield directly to GND (simple, internal fixture).
  • U3 AP2112K-3.3: IN=V5 (with 1uF + 10uF to GND), OUT=V3V3 (1uF + 10uF), GND=GND. (EN pin tied to IN per datasheet.)
  • RP2040: IOVDD pins -> V3V3 (100nF each to GND, placed adjacent); DVDD pins -> V1V1 (100nF each); VREG_IN -> V3V3; VREG_VOUT -> V1V1 with 1uF; USB_VDD -> V3V3; ADC_AVDD -> V3V3; GND pads + exposed pad -> GND; RUN -> 10k to V3V3 + test pad to GND; XIN/XOUT -> Y1 (12MHz, 2x 33pF to GND); QSPI_SD0..3/SCLK/SS -> U2 pins (SOIC-8: 1=CS#/QSPI_SS, 2=DO/SD1, 3=WP#/SD2, 4=GND, 5=DI/SD0, 6=CLK/SCLK, 7=HOLD#/SD3, 8=VCC->V3V3+100nF). SWDIO/SWCLK -> 2 test pads (bare pads are fine, no purchased part). GPIO0..GPIO3 -> U4 inputs 1A..4A; U4 outputs 1Y..4Y -> chain input nets DIN_C0..DIN_C3; U4 OE pins -> GND (always enabled); U4 VCC -> V5 (100nF), GND -> GND.
  • Bulk: 4x 47uF 0805 (CL21A476MQYNNNE) on V5 near the machine contacts.
  • Nets: V5, GND, V3V3, V1V1, USB_DP, USB_DM, XIN, XOUT, QSPI_*, DIN_C0..3, GPIO0..3 (net names A1..A4 side), plus DC{c}{k:03d} chain link nets (k=0..359 per chain: DC0_000 connects D(chain c, idx 0).DOUT? NO — DC{c}{k} is the net BETWEEN LED k's DOUT and LED k+1's DIN; the first LED's DIN is net DIN_C{c}. The last LED's DOUT is left unconnected (net DC{c}_0359 is just the last DOUT, fine).
  • RP2040 symbol pin mapping: READ parts/lib/rp2040.kicad_sym for the real pin numbers/names — do not invent. Same for all symbols.

Passives

Use Adom Basic Parts values only: 100nF 0402 (0402B104J160CT), 1uF 0402 (0402X105K250CT), 47uF 0805 (CL21A476MQYNNNE), 33pF 0402 C0G (0402N330J500CT), 22R 0402 (CR0402-FX-22R0GLF), 5.6k 0402 (CR0402-FX-5601GLF), 10k 0402 (CR0402-FX-1002GLF). KiCad stock Resistor_SMD:R_0402_1005Metric / Capacitor_SMD:C_0402_1005Metric / C_0805_2012Metric footprints and stock 3D models are acceptable for these (KiCad 10 ships them on the desktop at C:/Users/john/AppData/Local/Programs/KiCad/10.0/share/kicad). Symbols: stock Device:R / Device:C.

3D models

Every footprint needs a 3D binding: wiki STEP files live in parts/lib/*.step — copy them into the project at lib3d/ and reference with project-relative paths (${KIPRJMOD}/lib3d/...). For stock passives use the KiCad stock model paths (${KICAD10_3DMODEL_DIR}/...). The Dialight STEP comes from the component page being authored at parts/dialight-587-1024-147f/ (if not ready, generate a placeholder 2.0x2.0x0.9 box STEP and mark it for swap).

Outputs

  1. tile.kicad_pcb — all 1440 LEDs + ~35 MCU-strip parts, all pads net-assigned, parts initially PLACED AT FINAL POSITIONS except: ALSO emit tile-parked.kicad_pcb identical but with every footprint parked in a tidy holding cluster off the left of the board (x in [-60,-5]) — aiflow place land will move them in one at a time on camera.
  2. moves.json — {"D1": {"x":..., "y":..., "rotation":...}, ...} final position for every ref (aiflow place land --moves).
  3. route-plan.json — aiflow routing plan schema: [{"net": "...", "width": w, "viaSize": 0.6, "viaDrill": 0.3, "paths": <waypoints>}], waypoint = "REF.PAD" | [x,y] | {"x":..,"y":..,"layer":"B.Cu"} (layer objects are via/transition points). Every LED chain link, every rail (as a path along the rail with via waypoints to In2.Cu), every GND via (as a 2-point path pad->{x,y,layer}), and the whole MCU section, routed with Manhattan geometry, no crossings on a layer except where a via transition is explicitly written. Rails listed as their own paths on the V5/GND nets.
  4. tile.kicad_sch + chain.kicad_sch — root sheet (MCU section, full) + one chain subsheet (360 LED symbols, chained) instantiated 4x. Symbol placement in a readable serpentine grid. This must parse in KiCad (service-kicad sch erc). Consistent refs with the PCB.
  5. gen_tile.py — the single generator; everything above is regenerated by python3 gen_tile.py.

Validation gates (must all pass before reporting done)

  • service-kicad pcb drc (or the closest verb) on tile.kicad_pcb: parse OK, and 0 errors in the un-routed state except expected unconnected nets (no clearance violations from placement: courtyards may touch gutters but pads must not violate 0.2mm clearance).
  • Open the board on the desktop via the kicad bridge (adom-bridge --ai-thread "LED grid scaffold" kicad_open_board ... — read /home/adom/.kimi-code/skills/kicad-bridge/SKILL.md first) and screenshot it in the background: the grid and MCU strip must look right. Save PNG to clips/gen-board-check.png. Do NOT save the board from KiCad (file is generated).
  • Run a self-DRC after applying moves+routes LOCALLY (generate tile-routed.kicad_pcb with all tracks/vias written into the file directly — same geometry as route-plan.json): service-kicad DRC must be 0 violations (unconnected=0). This proves the plan is landable before we spend an hour landing it live.
  • Report: LED count, net count, via count, any clearance compromises, and the exact rail/via scheme chosen.

AMENDMENTS (2026-09-29) — these override anything above that conflicts

A1. Dialight footprint (use the PUBLISHED one, do not regenerate)

Use /home/adom/project/adom-led-grid/parts/lib/Dialight_587-1024-147F.kicad_mod verbatim — it is the published adom/587-1024-147f footprint: pads 0.9x0.9mm at (±0.85,±0.85), courtyard ±1.55mm, pad 1=DOUT top-left, 2=VDD top-right, 3=DIN bottom-right, 4=GND bottom-left (KiCad y-down). Symbol: parts/lib/587-1024-147f.kicad_sym. STEP/GLB: parts/lib/587-1024-147f.{step,glb}. At 4mm pitch: pad-edge gutter is 4.0-2*(0.85+0.45)=1.4mm horizontally and vertically; courtyard gutter is 0.9mm. Data links DOUT(top-left)→DIN(bottom-right) of the next LED are diagonal — choose LED orientation per row (0° vs 180°) to keep every link ≤3.0mm and inside pad gutters; keep orientation uniform within a row; document the pattern. Rails: VDD top-rail per row and GND bottom-rail per row may both be needed on F.Cu now that the GND-pad gutter is tight — if a rail does not fit the 1.4mm gutter at ≥0.2mm clearance, widen the pitch to 4.25mm for that axis (41→39 cols or 36→33 rows) and report the change, or move GND vias into the pad-gutter crossing points. DRC decides; report the final scheme.

  • Add 2x MachineContactMedium (parts: adom/machinecontactmedium — pull its kicad_sym/kicad_mod/step from the wiki the same way as the large ones; refs MC1 (SDA), MC2 (SCL)) in the MCU strip, wired to bus nets I2C_SDA / I2C_SCL.
  • RP2040 GPIO26 = I2C1 SDA, GPIO27 = I2C1 SCL (verify against ray/rp2040 pinout; use I2C1).
  • 4 address straps: GPIO4..GPIO7 each with a 10k pull-up to V3V3 and a 2-pad solder jumper to GND (bare 0402 pads, no purchased part; nets ADR0..ADR3).
  • 2x 22k pull-ups (0402, CR0402-FX-2232GLF if stocked else nearest basic 22k) SDA/SCL -> V3V3 on EVERY tile.
  • USB-C remains on every tile (one board design); only the master is cabled in the wall.
  • Keep the 4x MachineContactLarge power contacts.

A3. Scratch paths

Probe/scratch boards go to gen/scratch/ — NEVER into run/ (reserved for the aiflow run).

A4. Scaffold docking contacts (2026-09-29)

The tile docks to the base scaffold's 32mm large-contact grid (see docs/plan/SCAFFOLD.md):

  • Add 4x MachineContactLarge at tile-local (32,32), (128,32), (32,128), (128,128) mm: refs MP1..MP4; MP1/MP4 = V5, MP2/MP3 = GND (diagonal pairs). Nets wired to the V5/GND planes with via rings around each contact pad (4x 0.6/0.3 vias per contact).
  • OMIT the LED cell nearest each contact (4 omitted positions total): skip those grid points entirely — no footprint, no refs, chain numbering skips them (so 1436 LEDs: redistribute chain membership so each chain still serpentines its rows; document the final per-chain counts). Update moves.json/route-plan.json accordingly.
  • Keepout: no tracks/rails/vias within 2.6mm of a contact center except its own nets' ring vias; the contact's Ø4.40 ring + pincer clearance needs it.