From 2e433fcd0d1afadd8ab786dd30d7d4546bdee43d Mon Sep 17 00:00:00 2001 From: Louis Date: Wed, 11 Nov 2026 10:08:41 +0100 Subject: hw-toolchain: placer, routers and KiCad helpers for agent-driven hardware work Rust placer (simulated annealing) and negotiated-congestion router for 2-layer KiCad boards, pnr.sh to place, route, DRC-check and install candidates, Python KiCad helpers, repo conventions (AGENTS.md) and the tool documentation under knowledge/. Konnect (KiCad MCP, AGPL) as a submodule. Co-Authored-By: Claude Opus 5.5 --- knowledge/topics/din-rail-format.md | 65 +++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 knowledge/topics/din-rail-format.md (limited to 'knowledge/topics/din-rail-format.md') diff --git a/knowledge/topics/din-rail-format.md b/knowledge/topics/din-rail-format.md new file mode 100644 index 0000000..e418ebc --- /dev/null +++ b/knowledge/topics/din-rail-format.md @@ -0,0 +1,65 @@ +# DIN-rail board format + +The board format that `tools/din_template.py`, `tools/height_check.py`, `tools/housing_inputs.py` and `tools/connector_tab.py` assume: one flat base PCB in a 3D-printed DIN-rail housing, with modules (KiCad design blocks) placed on it as tiles. The housing CAD model itself is not part of this repo. The tools need only its dimensions, which live in `dims()` in `tools/din_template.py`. + +## Layout + +- Height (perpendicular to the rail) is fixed. Width grows in TE steps. +- One shared base PCB lies flat at the lowest level of the housing. Modules are design blocks placed on it as tiles, not separate PCBs. +- Two rows of tiles, one along the top edge and one along the bottom edge, with a strip between them for power and the shared bus. A full-height tile at one end is allowed. +- Field connectors and jacks exit through the top or bottom shoulder of the housing, at the board edge. The side walls along the rail are covered by neighbouring devices and are never used. + +## Dimensions + +Commercial DIN housings are 17.5 mm per TE, 90 mm tall and 53–58 mm deep, with a raised front 45 mm wide. + +- **Housing outer:** width k × 18 − 0.5 mm (18 mm per TE as spaced in distribution boards, 0.5 mm play), height 90 mm, front 45 mm wide and centred, shoulders 22.5 mm each. +- **Walls:** 2.0 mm printed walls and a 0.5 mm PCB-to-wall gap give a PCB of k × 18 − 5.5 mm by 85.0 mm: + + | TE | PCB width | + | -- | --------- | + | 2 | 30.5 mm | + | 4 | 66.5 mm | + | 6 | 102.5 mm | + | 12 | 210.5 mm | +- **Height zones:** within the PCB height, the outer 20 mm at the top and bottom sit under the shoulders (low parts and edge connectors). The central 45 mm sits under the front (tall parts). +- **Tiles:** a top and a bottom row of about 38 mm each, plus a bus strip of about 9 mm. The corner posts take room that no tile can use. +- **Height limits** (checked by [Height check](../tooling/height-check.md)): + - top side: 31 mm, and 45 mm inside the front-cap box; + - outside the shoulder step lines (|y| > 33 mm): falling 1:1 from 19 mm to 9.5 mm at the PCB edge; + - bottom side: 3 mm for parts and clipped THT leads. + +## Edge connectors on a tab + +The PCB edge is 2.5 mm inside the outer wall face (0.5 mm gap + 2.0 mm wall). So where a connector sits, the PCB runs out as a 2.0 mm tab into the wall notch, and the connector's mating face or wire entry ends flush with the tab edge. + +- **Why 2.0 mm:** the face sits 0.5 mm behind the outer wall face. That is easy to reach with a plug, ferrule or screwdriver, guided by the notch, and never proud of the housing when print tolerances add up. The connector is fully supported, and the tab closes most of the opening under it. +- **Tab width** = the connector bodies (not their courtyards). Adjacent connectors share one tab and one notch. +- **Tools:** `tools/connector_tab.py` draws the tab. [Housing inputs](../tooling/housing-inputs.md) prints the numbers for the housing's notches. +- **The block keeps its edge:** pours, group bboxes and the router's area keep ending at the old edge; only the outline grows. + +## Mounting + +- **Screw stack:** a countersunk M3 from the back passes through the base plate, a spacer and the PCB into a heat-set insert in a shell post. +- **PCB holes:** NPTH 3.2 mm at ±(PCB width/2 − 4.5), ±28.5 mm from the board centre (+Y = top edge). Each hole has an Ø7 keep-out for parts. +- **Clips:** two rail clips per housing, so at least 4 TE while the screws sit at the corners. + +## KiCad templates + +`tools/din_template.py [k ...]` (KiCad's Python) writes, for each TE count k: + +- **`libraries/footprints/HW.pretty/DIN_Housing_TE.kicad_mod`**, origin at the board centre, marked "not in schematic" and excluded from BOM and position files. It has: + - the 4 NPTH holes; + - an F.CrtYd keyhole per hole (shell post Ø7 + 0.25 plus its rib to the side wall); + - a B.CrtYd per spacer (Ø6 + 0.25). DRC's courtyard checks then flag parts on posts, ribs and spacers; + - on Dwgs.User: the front-cap box, the shoulder step lines and height notes; + - the housing STEP `${HW_LIB}/3dmodels/HW.3dshapes/DIN_Housing_TE.step` as its 3D model at 35 % opacity, if you have one. +- **`libraries/templates/DIN_TE/`**, a KiCad project template: + - board outline k × 18 − 5.5 × 85 mm, centred at (150, 100) on A4; + - grid and origins at the board centre; + - design rules from `tools/din_base.kicad_pro`; + - net classes from [Net classes](netclasses.md). + +## Materials + +PETG or ASA, not PLA, which softens in warm cabinets. Printed parts are not V-0 like commercial housings, so keep mains out or use a flame-retardant material. -- cgit v1.3