jitxlib.jlcpcb package#

JLCPCB for JITX#

Everything a JITX design needs to be built and assembled by JLCPCB: the substrates they fabricate, the catalogue their assembly line is stocked from, and the file set their order forms take.

Substrates#

The published JLCPCB buildups, each with its stackup, impedance-controlled single-ended and differential routing structures, via set and fabrication rules already filled in. Put one on the design:

from jitxlib.jlcpcb import JLC04161H_1080

class Blinker(jitx.Design):

substrate = JLC04161H_1080()

JLC04161H_1080 and JLC04161H_7628 are the 4-layer 1.6 mm buildups, which differ in their prepreg and so in their impedance geometry; JLC06161H_7628 is the 6-layer one. Naming the substrate is also what makes 50, 90 and 100 ohm routing structures available to the design’s constraints.

JLC02051_RO4350B, JLC02076_RO4350B and JLC02152_RO4350B are JLCPCB’s 2-layer Rogers boards, on a 0.51, 0.76 or 1.52 mm RO4350B laminate, with Rogers fabrication rules and a 50 ohm grounded coplanar routing structure. The order sheet names the material to select; JLCPCB offers ENIG or OSP on these boards, not HASL, and does not fill or cap their vias, so their via set has no filled via.

Part sources#

jitxlib.jlcpcb.parts publishes two jitxlib-parts providers over the JLCPCB/LCSC catalogue, so a passive described by value resolves to a part JLCPCB stocks and carries its LCSC number into the BOM. Installing this package is enough; a project that configures nothing resolves through JLCPCBParts, which also serves the assembly library a part belongs to as an ordinary query attribute:

from jitxlib.parts import Resistor

class Divider(jitx.Circuit):
r = Resistor(

resistance=10 * kohm, tolerance=AtMost(1 * pct), library=”basic”

)

The tiers are “basic”, “preferred” and “extended”, cheapest to assemble first: JLCPCB charges a setup fee per distinct part number outside the basic library. The basic library is small, so filtering on it outright can find nothing; rank=Minimize(“library”) asks to prefer it without insisting. See jitxlib.jlcpcb.parts.library.

A part the catalogue cannot be asked for, an IC or a connector, names its LCSC number itself with LCSCPart, and can borrow the catalogue footprint for its landpattern with LCSCLandpattern rather than having it drawn by hand:

class Sensor(jitx.Component):

lcsc = LCSCPart(“C2874116”) SDA = Port() SCL = Port() landpattern = LCSCLandpattern(ports={“1”: SDA, “2”: SCL})

Fabrication packet#

The jlcpcb export plugin writes the whole order in one directory: the gerber archive, a BOM and a pick-and-place file in the column layout JLCPCB’s assembly intake expects, and an order sheet listing what to select on their web form.

jitx design export jlcpcb –output packet blinker.Blinker555

Placement rotations are corrected to the tape orientation of the part being ordered, so a part whose tape frame differs from its landpattern is not assembled turned. Pass –no-assembly for a bare-board order, which writes the gerbers and the order sheet and no assembly files.

The lock file#

What this package learns about a catalogue part from outside the design is recorded in lcsc.lock.json at the project root, keyed by LCSC number: the placement orientation measured for the pick-and-place file, and the catalogue footprint behind each LCSCLandpattern. It is read on every build, so a design whose parts are all in it never reaches the network, and what it holds is reviewable in a diff rather than fetched afresh and silently different.

It is a checked-in project file, not a cache. To ask the catalogue again, delete it, or delete just the entry for the part in question and keep the rest; the next build re-measures and re-fetches what is missing. Editing a value by hand works too, and is how to correct an orientation the measurement gets wrong: an entry already present always wins.

Gerbers on their own#

The packet’s gerbers come from jitxlib-gerber. This package registers JLCPCB’s recommended Protel-style filenames as a naming strategy there, so a plain gerber export can produce an archive their intake reads without going through the packet:

jitx design export gerber –names jlcpcb blinker.Blinker555

class LCSCPart(partnumber, footprint=None, orientation=None)[source]#

Bases: object

LCSC catalogue part for a component, for JLCPCB assembly.

Attach one to a component to name the part JLCPCB should place. The exporter finds it with decompose(component, LCSCPart), so it must be a field of the component itself.

>>> class Decoupler(jitx.Component):
...     lcsc = LCSCPart("C91183")

A part library may attach it on the user’s behalf; none does today, so it is written by hand.

Parameters:
  • partnumber (str) – the LCSC C-number, such as “C91183”.

  • footprint (str | None) – package code for the BOM, when the one derived from the landpattern is wrong or cannot be determined.

  • orientation (float | None) – rotation correction in degrees, counter-clockwise, added to the placement rotation in the pick-and-place file. Use it when the part’s tape orientation differs from the landpattern’s.

partnumber: str#
footprint: str | None = None#
orientation: float | None = None#
class LCSCLandpattern(ports=None, *, partnumber=None)[source]#

Bases: Container

The landpattern of the component’s LCSC part, from LCSC’s own data.

Holds a Landpattern built from the catalogue footprint and, when the ports are given, the PadMapping that binds them to it. Being a container, both are members of the component, exactly as if they had been written there.

Parameters:
  • ports (Mapping[str | int, Port] | None) –

    pad name to port. LCSC pad names are strings, and a name may appear on more than one pad; every pad with that name goes to the port named here. Giving the same port for more than one name works too and has the same effect, which is how a part with several pads on one pin is described.

    When it is omitted, no PadMapping is made and JITX’s default in-order mapping binds the component’s ports to the pads. That is only right when the pads are in pin order and there is exactly one of each, which is the common case; the exception is a footprint with repeated pad names, where the pads are grouped by name and mapped in order of first appearance.

  • partnumber (str | None) – the LCSC C-number to fetch, when the component’s own LCSCPart is not the part whose footprint is wanted.

Not memoized: what it builds depends on the component it is in rather than on its arguments, so two components must not share one.

package: str = ''#

EasyEDA’s name for the package, once the footprint has been read.

The exporter reads it for the BOM’s package column, which is otherwise the landpattern’s class name and would say nothing.

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

Bases: JLCPCBSubstrate, StandardVias

JLC04161H Stackup with 1080 Prepreg

stackup: Stackup = stackup()#
constraints: FabricationConstraints = <jitxlib.jlcpcb.rules.JLCPCBRules object>#
RS_50 = RoutingStructure(impedance=<Quantity(50, 'ohm')>, name='50 Ohm Routing Structure', layers={0: Layer(trace_width=0.1176, clearance=0.2, velocity=191335235228.99094, insertion_loss=0.0178), -1: Layer(trace_width=0.1176, clearance=0.2, velocity=191335235228.99094, insertion_loss=0.0178)._invert(Layer(trace_width=0.1176, clearance=0.2, velocity=191335235228.99094, insertion_loss=0.0178)._invert)})#
DRS_90 = DifferentialRoutingStructure(impedance=<Quantity(90, 'ohm')>, name='90 Ohm Differential Routing Structure', layers={0: Layer(trace_width=0.09, pair_spacing=0.09, clearance=0.2, velocity=191335235228.99094, insertion_loss=0.0178), -1: Layer(trace_width=0.09, pair_spacing=0.09, clearance=0.2, velocity=191335235228.99094, insertion_loss=0.0178)._invert(Layer(trace_width=0.09, pair_spacing=0.09, clearance=0.2, velocity=191335235228.99094, insertion_loss=0.0178)._invert)}, uncoupled_region=RoutingStructure(impedance=<Quantity(90, 'ohm')>, name='90 Ohm Differential Routing Structure, Uncoupled', layers={0: Layer(trace_width=0.09, clearance=0.2, velocity=191335235228.99094, insertion_loss=0.0178), -1: Layer(trace_width=0.09, clearance=0.2, velocity=191335235228.99094, insertion_loss=0.0178)._invert(Layer(trace_width=0.09, clearance=0.2, velocity=191335235228.99094, insertion_loss=0.0178)._invert)}))#
DRS_100 = DifferentialRoutingStructure(impedance=<Quantity(100, 'ohm')>, name='100 Ohm Differential Routing Structure', layers={0: Layer(trace_width=0.09, pair_spacing=0.137, clearance=0.2, velocity=191335235228.99094, insertion_loss=0.0178), -1: Layer(trace_width=0.09, pair_spacing=0.137, clearance=0.2, velocity=191335235228.99094, insertion_loss=0.0178)._invert(Layer(trace_width=0.09, pair_spacing=0.137, clearance=0.2, velocity=191335235228.99094, insertion_loss=0.0178)._invert)}, uncoupled_region=RoutingStructure(impedance=<Quantity(100, 'ohm')>, name='100 Ohm Differential Routing Structure, Uncoupled', layers={0: Layer(trace_width=0.09, clearance=0.2, velocity=191335235228.99094, insertion_loss=0.0178), -1: Layer(trace_width=0.09, clearance=0.2, velocity=191335235228.99094, insertion_loss=0.0178)._invert(Layer(trace_width=0.09, clearance=0.2, velocity=191335235228.99094, insertion_loss=0.0178)._invert)}))#
class JLC04161H_7628(*args, **kwargs)[source]#

Bases: JLCPCBSubstrate, StandardVias

JLC04161H Stackup with 7628 Prepreg

stackup: Stackup = stackup()#
constraints: FabricationConstraints = <jitxlib.jlcpcb.rules.JLCPCBRules object>#
RS_50 = RoutingStructure(impedance=<Quantity(50, 'ohm')>, name='50 Ohm Routing Structure', layers={0: Layer(trace_width=0.3244, clearance=0.3, velocity=182447879771.61652, insertion_loss=0.0168), -1: Layer(trace_width=0.3244, clearance=0.3, velocity=182447879771.61652, insertion_loss=0.0168)._invert(Layer(trace_width=0.3244, clearance=0.3, velocity=182447879771.61652, insertion_loss=0.0168)._invert)})#
DRS_90 = DifferentialRoutingStructure(impedance=<Quantity(90, 'ohm')>, name='90 Ohm Differential Routing Structure', layers={0: Layer(trace_width=0.2332, pair_spacing=0.15, clearance=0.3, velocity=182447879771.61652, insertion_loss=0.0168), -1: Layer(trace_width=0.2332, pair_spacing=0.15, clearance=0.3, velocity=182447879771.61652, insertion_loss=0.0168)._invert(Layer(trace_width=0.2332, pair_spacing=0.15, clearance=0.3, velocity=182447879771.61652, insertion_loss=0.0168)._invert)}, uncoupled_region=RoutingStructure(impedance=<Quantity(90, 'ohm')>, name='90 Ohm Differential Routing Structure, Uncoupled', layers={0: Layer(trace_width=0.2332, clearance=0.15, velocity=182447879771.61652, insertion_loss=0.0168), -1: Layer(trace_width=0.2332, clearance=0.15, velocity=182447879771.61652, insertion_loss=0.0168)._invert(Layer(trace_width=0.2332, clearance=0.15, velocity=182447879771.61652, insertion_loss=0.0168)._invert)}))#
DRS_100 = DifferentialRoutingStructure(impedance=<Quantity(100, 'ohm')>, name='100 Ohm Differential Routing Structure', layers={0: Layer(trace_width=0.1722, pair_spacing=0.15, clearance=0.3, velocity=182447879771.61652, insertion_loss=0.0168), -1: Layer(trace_width=0.1722, pair_spacing=0.15, clearance=0.3, velocity=182447879771.61652, insertion_loss=0.0168)._invert(Layer(trace_width=0.1722, pair_spacing=0.15, clearance=0.3, velocity=182447879771.61652, insertion_loss=0.0168)._invert)}, uncoupled_region=RoutingStructure(impedance=<Quantity(100, 'ohm')>, name='100 Ohm Differential Routing Structure, Uncoupled', layers={0: Layer(trace_width=0.1722, clearance=0.15, velocity=182447879771.61652, insertion_loss=0.0168), -1: Layer(trace_width=0.1722, clearance=0.15, velocity=182447879771.61652, insertion_loss=0.0168)._invert(Layer(trace_width=0.1722, clearance=0.15, velocity=182447879771.61652, insertion_loss=0.0168)._invert)}))#
class JLC06161H_7628(*args, **kwargs)[source]#

Bases: JLCPCBSubstrate, JLCPCBVias

JLC06161H Stackup with 7628 Prepreg

stackup: Stackup = stackup()#
constraints: FabricationConstraints = <jitxlib.jlcpcb.rules.JLCPCBRules object>#
RS_50 = RoutingStructure(impedance=<Quantity(50, 'ohm')>, name='50 Ohm Routing Structure', layers={0: Layer(trace_width=0.3421, clearance=0.5, velocity=182447879771.61652, insertion_loss=0.0168), 1: Layer(trace_width=0.223, clearance=0.3, velocity=143246377347.4908, insertion_loss=0.0168), -1: Layer(trace_width=0.3421, clearance=0.5, velocity=182447879771.61652, insertion_loss=0.0168)._invert(Layer(trace_width=0.3421, clearance=0.5, velocity=182447879771.61652, insertion_loss=0.0168)._invert), -2: Layer(trace_width=0.223, clearance=0.3, velocity=143246377347.4908, insertion_loss=0.0168)._invert(Layer(trace_width=0.223, clearance=0.3, velocity=143246377347.4908, insertion_loss=0.0168)._invert)})#
DRS_100 = DifferentialRoutingStructure(impedance=<Quantity(100, 'ohm')>, name='100 Ohm Differential Routing Structure', layers={0: Layer(trace_width=0.1722, pair_spacing=0.15, clearance=0.3, velocity=182447879771.61652, insertion_loss=0.0168), 1: Layer(trace_width=0.1298, pair_spacing=0.15, clearance=0.3, velocity=143246377347.4908, insertion_loss=0.0168), -1: Layer(trace_width=0.1722, pair_spacing=0.15, clearance=0.3, velocity=182447879771.61652, insertion_loss=0.0168)._invert(Layer(trace_width=0.1722, pair_spacing=0.15, clearance=0.3, velocity=182447879771.61652, insertion_loss=0.0168)._invert), -2: Layer(trace_width=0.1298, pair_spacing=0.15, clearance=0.3, velocity=143246377347.4908, insertion_loss=0.0168)._invert(Layer(trace_width=0.1298, pair_spacing=0.15, clearance=0.3, velocity=143246377347.4908, insertion_loss=0.0168)._invert)}, uncoupled_region=RoutingStructure(impedance=<Quantity(100, 'ohm')>, name='100 Ohm Differential Routing Structure, Uncoupled', layers={0: Layer(trace_width=0.1722, clearance=0.15, velocity=182447879771.61652, insertion_loss=0.0168), 1: Layer(trace_width=0.1298, clearance=0.15, velocity=143246377347.4908, insertion_loss=0.0168), -1: Layer(trace_width=0.1722, clearance=0.15, velocity=182447879771.61652, insertion_loss=0.0168)._invert(Layer(trace_width=0.1722, clearance=0.15, velocity=182447879771.61652, insertion_loss=0.0168)._invert), -2: Layer(trace_width=0.1298, clearance=0.15, velocity=143246377347.4908, insertion_loss=0.0168)._invert(Layer(trace_width=0.1298, clearance=0.15, velocity=143246377347.4908, insertion_loss=0.0168)._invert)}))#
class JLC02051_RO4350B(*args, **kwargs)[source]#

Bases: JLCPCBSubstrate, UnfilledVias

2-layer Rogers RO4350B, 0.508 mm laminate, 1 oz copper.

Ordered as base material Rogers, laminate RO4350B, PCB thickness 0.51 mm. JLCPCB gives the finished board as 0.65 mm. Surface finish is ENIG or OSP; HASL is not offered on Rogers.

stackup: Stackup = stackup()#
constraints: FabricationConstraints = <jitxlib.jlcpcb.rules.JLCPCBRogersRules object>#
RS_50 = RoutingStructure(impedance=<Quantity(50, 'ohm')>, name='50 Ohm Routing Structure', layers={0: Layer(trace_width=0.55, clearance=0.15, velocity=186210087538.79712, insertion_loss=0.0037), -1: Layer(trace_width=0.55, clearance=0.15, velocity=186210087538.79712, insertion_loss=0.0037)._invert(Layer(trace_width=0.55, clearance=0.15, velocity=186210087538.79712, insertion_loss=0.0037)._invert)})#
class JLC02076_RO4350B(*args, **kwargs)[source]#

Bases: JLCPCBSubstrate, UnfilledVias

2-layer Rogers RO4350B, 0.762 mm laminate, 1 oz copper.

Ordered as base material Rogers, laminate RO4350B, PCB thickness 0.76 mm. JLCPCB gives the finished board as 0.9 mm. Surface finish is ENIG or OSP; HASL is not offered on Rogers.

stackup: Stackup = stackup()#
constraints: FabricationConstraints = <jitxlib.jlcpcb.rules.JLCPCBRogersRules object>#
RS_50 = RoutingStructure(impedance=<Quantity(50, 'ohm')>, name='50 Ohm Routing Structure', layers={0: Layer(trace_width=0.57, clearance=0.13, velocity=187847850712.96988, insertion_loss=0.0037), -1: Layer(trace_width=0.57, clearance=0.13, velocity=187847850712.96988, insertion_loss=0.0037)._invert(Layer(trace_width=0.57, clearance=0.13, velocity=187847850712.96988, insertion_loss=0.0037)._invert)})#
class JLC02152_RO4350B(*args, **kwargs)[source]#

Bases: JLCPCBSubstrate, UnfilledVias

2-layer Rogers RO4350B, 1.524 mm laminate, 1 oz copper.

Ordered as base material Rogers, laminate RO4350B, PCB thickness 1.52 mm. JLCPCB gives the finished board as 1.65 mm. Surface finish is ENIG or OSP; HASL is not offered on Rogers.

stackup: Stackup = stackup()#
constraints: FabricationConstraints = <jitxlib.jlcpcb.rules.JLCPCBRogersRules object>#
RS_50 = RoutingStructure(impedance=<Quantity(50, 'ohm')>, name='50 Ohm Routing Structure', layers={0: Layer(trace_width=0.6, clearance=0.12, velocity=188964009380.861, insertion_loss=0.0037), -1: Layer(trace_width=0.6, clearance=0.12, velocity=188964009380.861, insertion_loss=0.0037)._invert(Layer(trace_width=0.6, clearance=0.12, velocity=188964009380.861, insertion_loss=0.0037)._invert)})#

Subpackages#

Submodules#