tscircuit
website·Indexed 33 days ago
https://docs.tscircuit.comA hardware design tool that allows developers to design electronics using code. It features a CLI (tsci) for building, checking, and developing circuits, an NPM-based registry for components, and integration with KiCad and JLCPCB for footprint importing and fabrication file generation. The platform supports automatic PCB layout, custom autorouters, and AI-assisted design workflows.
What's inside tscircuit
- Simple Route JSON (SRJ) is a lightweight intermediary format used by tscircuit autorouters to describe PCB routing problems. It strips away complex PCB design details to provide only the essential information needed for routing algorithms: board boundaries, conductive layers, obstacles (keep-out areas), nets (connections), and minimum trace width constraints. It is often generated from Circuit JSON and is conceptually similar to the Specctra DSN format.
Overview of essential tscircuit elements
The following elements are fundamental for building most circuits in tscircuit:
<board />: The root element that defines board size and autorouting settings.<chip />: Represents packaged integrated circuits (ICs) and discrete components.<trace />: Represents electrical connections between chips.<led />: Light emitting diode for power or status indicators.<resistor />: Resists the flow of electrical current.<capacitor />: Stores electrical charge and smooths voltage fluctuations.<diode />: Ensures current flows in only one direction.
Overview of tscircuit fabrication files
Fabrication files are a set of files used to upload to a fabricator or turn-key manufacturer (e.g., JLCPCB, PCBWay) to manufacture a circuit board. A tscircuit fabrication zip file contains three primary components:
- Gerbers: Files representing each copper layer of the PCB, including drilling holes and board cutouts.
- Bill of Materials (BOM) CSV: A list of every component, including Manufacturer Part Numbers (MPN) and supplier part numbers.
- Pick'n'Place CSV: A list of every component and its specific position on the board.
Overview of tscircuit fabrication files
Fabrication files in tscircuit are a collection of files packaged in a
.ziparchive used to order circuit boards from fabricators or turn-key manufacturers (e.g., JLCPCB, PCBWay). The archive contains three primary components:- Gerbers: Files representing each copper layer of the PCB, including drilling holes and board cutouts.
- Bill of Materials (BOM) CSV: A list of every component, including its Manufacturer Part Number (MPN) and supplier part numbers.
- Pick'n'Place CSV: A list of every component and its precise position on the board for automated assembly.
Overview of the connector component
The<connector />component represents a physical connector on a PCB, such as a USB receptacle, wire terminal, or board-to-board header. It handles placement and footprints similarly to the<chip />component but includes specialized features for connectors, such as custom pin naming, internal shorting definitions, and standard connector hints for common families like USB-C and JST.Overview of tsci check command
tsci checkis used to partially build a circuit and validate specific output aspects. It is designed to catch issues early in the development process without the overhead of running a full build. The command requires a subcommand (netlist,placement, orrouting).tsci check <subcommand> [options]Overview of tscircuit project repositories
The tscircuit ecosystem consists of several specialized repositories. Key projects include:
- core: The core library that handles the conversion of React components into circuit boards.
- cli: The main development tool providing a local development server and package management.
- circuit-json: The underlying assembly language format representing tscircuit circuits.
- schematic-symbols: A library of schematic symbols used across the ecosystem.
- footprinter: Generates PCB footprints from string descriptions.
- circuit-to-svg: Converts Circuit JSON into SVG files.
- tscircuit.com: The main website and circuit board editor.
- runframe: A React component used to preview and run tscircuit circuits.
- pcb-viewer: A React component for viewing PCBs.
- 3d-viewer: A React component for viewing 3D previews.
- props: The specification for the definitions of every React component supported by tscircuit.
- easyeda-converter: A CLI utility for converting JLCPCB footprints to tscircuit.
Overview of the testpoint element
The<testpoint />element defines a designated location on a PCB used for testing, debugging, and measuring electrical signals. It provides a reliable connection point for equipment like oscilloscope probes and multimeter leads. It features a single connection pin (pin1), also aliased as 'tp' or 'test'.Overview of Simple Route JSON (SRJ)
Simple Route JSON (SRJ) is a lightweight intermediary format used bytscircuitautorouters to describe PCB routing problems. It strips away complex PCB design details to provide only the essential information needed for routing algorithms: board boundaries, conductive layers, obstacles (keep-out areas), electrical nets (connections), and minimum trace width constraints. It can be generated from Circuit JSON and is conceptually similar to the Specctra DSN format.Place images on PCB silkscreen using silkscreengraphic
The<silkscreengraphic />element allows you to place images on the PCB silkscreen layer. It is ideal for logos, icons, orientation marks, or custom artwork. SVG images are converted into silkscreen geometry; simple, single-color SVGs provide the cleanest output. PNG images are also supported.const thumbsUpSvgUrl = "data:image/svg+xml,..." export default () => ( <board width="14mm" height="12mm"> <silkscreengraphic imageUrl={thumbsUpSvgUrl} pcbX={0} pcbY={0} width="6mm" height="6mm" layer="top" /> </board> )Use the <jumper /> component to create multi-pin connectors
The<jumper />component represents a small multi-pin connector, such as a male or female header. It typically uses apinrowstyle footprint and can be placed flexibly on a board, similar to a<chip />component.export default () => ( <board width="10mm" height="10mm"> <jumper name="J1" footprint="pinrow4" /> </board> )Create electrical connections with the trace element
The<trace />element defines an electrical connection between two or more points in a circuit. It can connect component pins to other component pins or to named nets (like power and ground).export default () => ( <board width="10mm" height="10mm"> <resistor name="R1" resistance="1k" footprint="0402" pcbX={-2} schX={-2} /> <capacitor name="C1" capacitance="100nF" footprint="0402" pcbX={2} /> <trace from=".R1 > .pin1" to=".C1 > .pin1" /> </board> )