Top-Level Design Entity#

The Design type is the top-level entry for a printed circuit board design. This type serves two purposes:

  1. Holding container for the Board, Substrate, and the main Circuit entrypoint of the design, as well as others.

  2. A marker for finding available designs within a JITX Python project.

Required Design Elements#

Every Design must include three required elements:

Board#

The Board defines the physical outline and shape of your PCB. It specifies:

  • The outer boundary of the board

  • Any internal cutouts or slots

  • The signal area where components can be placed

from jitx import Board
from jitx.shapes import rectangle

class MyBoard(Board):
    shape = rectangle(100, 80)  # 100mm x 80mm rectangular board
    signal_area = rectangle(96, 76)  # Slightly smaller signal area

Substrate#

The Substrate defines the PCB stackup - the layers of copper and dielectric material:

  • Number of copper layers (2, 4, 6, etc.)

  • Layer thicknesses

  • Dielectric materials and properties

  • Via definitions

from jitx import Substrate

# Use a predefined 4-layer stackup
substrate = FourLayerSubstrate()

Circuit#

The Circuit is the root of your electrical design hierarchy. It contains:

  • All components and sub-circuits

  • All electrical connections (nets)

  • Pin assignments and constraints

See Design Hierarchy for details on building circuits.

Design Level Characteristics#

In addition to the required, Board, Substrate, and Circuit instance, you can also attach additional attributes to the Design object that control design wide features of a design. For example, we can control the default resistor query parameters:


class StepperMotorController(Design):
  substrate = SampleSubstrate()
  board = SampleBoard()
  circuit = StepperMotorCircuit()

  resistor_defaults = ResistorQuery(case="0402", tolerance=0.01)

This will cause all resistor selections queried from the parts database to add these parameters by default. These defaults can of course be overridden with arguments to the query request.

Building a Design#

For example, the following command can be used to find all Design objects within a project:

(.venv)  $>  python -m jitx find
designs:
  motor_controller.main.StepperMotorController
  motor_controller.main.ServoMotorController

Here the find command discovers two Design objects named StepperMotorController and ServoMotorController in the file main.py.

These named objects can then be used to build the design with the following command:

(.venv)  $>  python -m jitx build --port <PORT>  motor_controller.main.StepperMotorController 

Where <PORT> is the TCP/IP port for connecting to the JITX backend. Typically you would not need to invoke this command in the terminal because you could use the F5 key to launch the design from the IDE. The .vscode/launch.json file provides a way to customize this launch process. See VSCode’s documentation about launch.json for more info.

Complete Example#

Here’s a minimal but complete Design showing all required elements:

from jitx import Design, Board, Circuit, Component, Port
from jitx.shapes import rectangle
from jitx.common import Power

# Define a simple board shape
class SimpleBoard(Board):
    shape = rectangle(50, 50)  # 50mm x 50mm

# Define a simple circuit with one component
class BlinkCircuit(Circuit):
    power = Power()  # Power input port
    led = LEDComponent()
    resistor = ResistorComponent()

    def __init__(self):
        # Connect power through resistor to LED
        self.vcc_net = self.power.Vp + self.resistor.p[1]
        self.led_net = self.resistor.p[2] + self.led.anode
        self.gnd_net = self.led.cathode + self.power.Vn

# Bring it all together in a Design
class BlinkDesign(Design):
    board = SimpleBoard()
    substrate = TwoLayerSubstrate()  # Simple 2-layer board
    circuit = BlinkCircuit()

When you run this design, JITX will:

  1. Instantiate all components and circuits

  2. Resolve all net connections

  3. Perform pin assignment (if using require/provide)

  4. Generate schematic and board layout data

Next Steps#