substrate module#

Scaffolding shared by the JLCPCB substrates.

A buildup in this package should be a declaration of its layers and its impedance numbers and nothing else. What lives here is everything that is not those numbers.

class JLCPCBSubstrate(*args, **kwargs)[source]#

Bases: Substrate

Base for the substrates in this package.

A subclass declares three things: its stackup, its constraints, and the via set for its layer count and material, mixed in from vias. None of the three is fixed here on purpose. JLCPCB’s fabrication minimums differ between a 2-layer process and a multilayer one, the extra-cost via tiers apply only to 6+ layer boards, and JLCPCB fills no via on a Rogers board (mix in UnfilledVias there, not StandardVias), so a base that supplied any of them would hand substrates capabilities they cannot order.

>>> class JLC02161_Example(JLCPCBSubstrate, StandardVias):
...     @inline
...     class stackup(Stackup):
...         layers = symmetric(...)
...     constraints = JLCPCBRules()
class Pair(trace_width, pair_spacing, clearance, uncoupled_clearance, velocity)[source]#

Bases: object

Differential pair geometry for one routing layer, in mm.

uncoupled_clearance applies where the pair separates and is routed as two single-ended traces; it is often tighter than the coupled clearance.

Parameters:
trace_width: float#
pair_spacing: float#
clearance: float#
uncoupled_clearance: float#
velocity: float#
SOLDERMASK = 0.01524#

Soldermask thickness in mm, JLCPCB’s 0.6 mil above-trace figure.

class Trace(trace_width, clearance, velocity)[source]#

Bases: object

Single-ended trace geometry for one routing layer, in mm.

Parameters:
trace_width: float#
clearance: float#
velocity: float#
differential(impedance, layers, *, insertion_loss)[source]#

A differential routing structure with its uncoupled region, mirrored onto the bottom half.

Parameters:
  • impedance (float) – Target differential impedance in ohms, also used to name the structure.

  • layers (Mapping[int, Pair]) – Geometry per routing layer, top half only, outermost is 0.

  • insertion_loss (float) – Loss tangent of the surrounding dielectric.

Return type:

DifferentialRoutingStructure

single_ended(impedance, layers, *, insertion_loss)[source]#

A single-ended routing structure, mirrored onto the bottom half.

Parameters:
  • impedance (float) – Target impedance in ohms, also used to name the structure.

  • layers (Mapping[int, Trace]) – Geometry per routing layer, top half only, outermost is 0.

  • insertion_loss (float) – Loss tangent of the surrounding dielectric.

Return type:

RoutingStructure

symmetric(*outer, centre)[source]#

Full layer list for a buildup that mirrors about a single centre layer.

A convenience over writing the list out, not the interface: a stackup takes the full list, since several of JLCPCB’s buildups have a centre of prepreg/core/prepreg or two prepregs, and at least one published row is not symmetric at all.

Parameters:
  • outer (Material) – The layers from the outside in, up to but excluding the centre.

  • centre (Material) – The unmirrored middle layer.

Return type:

list[Material]