Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions docs/elements/copperpour.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ without changing the mesh spacing.
| `traceMargin` | Minimum distance from traces on other nets. Overrides `clearance`. | `"0.1mm"` |
| `boardEdgeMargin` | Minimum distance from the board edge. Overrides `clearance`. | `"2mm"` |
| `cutoutMargin` | Minimum distance from board cutouts. Overrides `clearance`. | `"0.1mm"` |
| `unbroken` | Reserve the pour region during autorouting so other nets' traces can't split it. Same-net pads then connect to the pour with a via instead of traces. See [Keeping a pour unbroken](#keeping-a-pour-unbroken). | `true` |
| `useThermalReliefs` | Connect same-net plated holes through four thermal spokes instead of solid copper. | `true` |
| `outline` | Optional polygon describing a custom pour boundary. | `[{ x: -10, y: -8 }, { x: 10, y: -8 }, ...]` |

Expand Down Expand Up @@ -185,6 +186,50 @@ explicit pours with a fanout routing phase:
See [`<autoroutingphase />`](./autoroutingphase.mdx#terminate-power-connections-on-copper-planes)
for details.

## Keeping a Pour Unbroken

By default the autorouter treats a pour's layer like any other, so it can
connect same-net pads with traces and run other signals across the pour area.
Set `unbroken` to reserve the pour region instead. The autorouter keeps other
nets out of it, and each pad on the pour's net connects with a short trace and
a via down to the pour.

<CircuitPreview
defaultView="pcb"
hide3DTab
code={`
export default () => (
<board width="20mm" height="14mm">
<pinheader name="J1" pinCount={2} pitch="2.54mm" pinLabels={["VCC", "GND"]} pcbX={-7} pcbRotation={90} />
<chip
name="U1"
footprint="soic8"
pinLabels={{ pin1: "GND", pin2: "IN", pin3: "OUT", pin4: "EN", pin5: "NC1", pin6: "NC2", pin7: "NC3", pin8: "VCC" }}
pcbX={3}
/>
<capacitor name="C1" capacitance="100nF" footprint="0402" pcbX={7.5} pcbY={2} pcbRotation={90} />
<resistor name="R1" resistance="10k" footprint="0402" pcbX={-2} pcbY={-3} pcbRotation={90} />

<trace from="J1.VCC" to="net.VCC" />
<trace from="U1.VCC" to="net.VCC" />
<trace from="C1.pin1" to="net.VCC" />
<trace from="U1.EN" to="R1.pin1" />
<trace from="R1.pin2" to="net.VCC" />

<trace from="J1.GND" to="net.GND" />
<trace from="U1.GND" to="net.GND" />
<trace from="C1.pin2" to="net.GND" />

<copperpour connectsTo="net.GND" layer="bottom" unbroken />
</board>
)
`}
/>

Here U1's and C1's ground pads each get their own via, and no signal crosses
the bottom layer. Without `unbroken`, the same board joins the ground pads
with traces on the top layer instead.

## Tips for Effective Groundplanes

- Keep sensitive signal traces short and route them over solid groundplane
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
---
title: Placing Components for Autorouting
description: >-
Get cleaner autorouted boards by placing parts in the right order, pointing
connected pins at each other, and fixing placement instead of fighting
routing.
---

import CircuitPreview from "@site/src/components/CircuitPreview"

The autorouter can only route the placement you give it. When a board comes out
with long detours, extra vias or failed connections, the cause is usually where
the parts sit, not the router. Move or rotate parts, rebuild, and check again.

## A Placement-First Workflow

Place a few parts, check how they route, and only then place more. Work from
the parts with the least freedom to the most:

1. **Fixed parts.** Connectors, buttons, LEDs, knobs and mounting holes are set
by the enclosure and the user. Place them first.
2. **Critical circuits.** High-current paths, switching regulators, decoupling
capacitors, crystals and sensitive analog parts. Keep these loops small and
place them before anything else crowds them out.
3. **Everything else, in functional groups.** Keep each block (power,
microcontroller, sensor, outputs) together, and arrange the blocks so
signals flow in one direction across the board. A
[`<group />`](./using-groups-for-pcb-layout.mdx) lets you move a block as one
unit.
4. **Route, check, adjust.** Build, look at the result, and go back to
placement whenever a connection is forced to be ugly.

## Point Connected Pins at Each Other

Rotate parts so that pins connected to each other face each other, and keep
the same pin order on both ends of a bus. A reversed order makes every
connection cross every other one.

In this board, J2 is rotated so its pin order runs opposite to J1's. The
autorouter needs vias and a second layer to untangle the crossing:

<CircuitPreview
defaultView="pcb"
hide3DTab
hideSchematicTab
code={`
export default () => (
<board width="24mm" height="14mm">
<pinheader name="J1" pinCount={4} pitch="2.54mm" pcbX={-8} pcbRotation={90} />
<pinheader name="J2" pinCount={4} pitch="2.54mm" pcbX={8} pcbRotation={-90} />
<trace from="J1.pin1" to="J2.pin1" />
<trace from="J1.pin2" to="J2.pin2" />
<trace from="J1.pin3" to="J2.pin3" />
<trace from="J1.pin4" to="J2.pin4" />
</board>
)
`}
/>

Rotating J2 to match J1 gives four straight traces on one layer, with no vias:

<CircuitPreview
defaultView="pcb"
hide3DTab
hideSchematicTab
code={`
export default () => (
<board width="24mm" height="14mm">
<pinheader name="J1" pinCount={4} pitch="2.54mm" pcbX={-8} pcbRotation={90} />
<pinheader name="J2" pinCount={4} pitch="2.54mm" pcbX={8} pcbRotation={90} />
<trace from="J1.pin1" to="J2.pin1" />
<trace from="J1.pin2" to="J2.pin2" />
<trace from="J1.pin3" to="J2.pin3" />
<trace from="J1.pin4" to="J2.pin4" />
</board>
)
`}
/>

The same applies to chips. If a chip's output pin faces away from the part it
drives, try rotating the chip by 180° and moving its passive parts to the other
side.

## Place Decoupling Capacitors and Ground First

Put each decoupling capacitor right next to the power pin it serves, before
placing other parts around the chip. For ground, a solid pour on one layer
with [`unbroken`](../../elements/copperpour.mdx#keeping-a-pour-unbroken)
lets every ground pin connect with a short via instead of long traces, and
keeps other signals from cutting the plane apart.

<CircuitPreview
defaultView="pcb"
hide3DTab
hideSchematicTab
code={`
export default () => (
<board width="20mm" height="14mm">
<pinheader name="J1" pinCount={2} pitch="2.54mm" pinLabels={["VCC", "GND"]} pcbX={-7} pcbRotation={90} />
<chip
name="U1"
footprint="soic8"
pinLabels={{ pin1: "GND", pin2: "IN", pin3: "OUT", pin4: "EN", pin5: "NC1", pin6: "NC2", pin7: "NC3", pin8: "VCC" }}
pcbX={3}
/>
{/* decoupling capacitor next to the VCC pin */}
<capacitor name="C1" capacitance="100nF" footprint="0402" pcbX={7.5} pcbY={2} pcbRotation={90} />
<resistor name="R1" resistance="10k" footprint="0402" pcbX={-2} pcbY={-3} pcbRotation={90} />

<trace from="J1.VCC" to="net.VCC" />
<trace from="U1.VCC" to="net.VCC" />
<trace from="C1.pin1" to="net.VCC" />
<trace from="U1.EN" to="R1.pin1" />
<trace from="R1.pin2" to="net.VCC" />

<trace from="J1.GND" to="net.GND" />
<trace from="U1.GND" to="net.GND" />
<trace from="C1.pin2" to="net.GND" />

<copperpour connectsTo="net.GND" layer="bottom" unbroken />
</board>
)
`}
/>

## When to Move Parts Instead

Go back to placement when you see any of these:

- A connection detours around a large part of the board or needs several vias.
- The same two groups of connections keep crossing each other.
- A decoupling capacitor or high-current loop ended up far from its chip.
- Routing errors stay in the same area after small changes.

Small placement changes can change the routed result a lot, so it is worth
trying a few variants (a different rotation, a part moved by 0.5–1mm) and
keeping the one with the fewest errors and vias.

## Checking a Layout

Build a PCB image to look at the routing, then run the checks:

```bash
tsci build --pcb-png
tsci check placement
tsci check routing-difficulty
tsci check shorts
tsci check pcb-style
```

`routing-difficulty` points out congested areas before you spend time on them.
See [`tsci check`](../../command-line/tsci-check.md) for all checks. If the
autorouter itself fails on a reasonable placement, please
[report an autorouter bug](../../contributing/report-autorouter-bugs.md).