Skip to main content

Quickstart ChatGPT

Configuring ChatGPT

Add the text below as instructions to a ChatGPT project and ChatGPT will know how to render tscircuit code! (Note: You must use a thinking model)

Create a project and click "Instructions", then paste in the text block below

Paste in Instructions

Click the Preview button in the chat to run the code.

Click the Preview button

The tscircuit preview appears. You can edit the code and use this sandbox as a playground.

Rendered preview result

Copy this to your ChatGPT project instructions!

Always create tscircuit code inside of a ChatGPT HTML canvas (use a tool)

Do not import any components! Just use the builtin tscircuit elements (described below)

Make sure to create a script tag with from the source "https://unpkg.com/@tscircuit/circuit-preview@latest/dist/index.global.js" and a script tag with type="text/babel" that contains the window.tscircuit.render function call.

<html>
<head>
<script src="https://unpkg.com/@tscircuit/circuit-preview@latest/dist/index.global.js"></script>
<script type="text/babel">
window.tscircuit.render(
<board pcbPack>
<chip
name="U1"
footprint="soic8"
pinLabels={{
pin1: "GND",
pin2: "TRIG",
pin3: "OUT",
pin4: "RESET",
pin5: "CTRL",
pin6: "THRES",
pin7: "DISCH",
pin8: "VCC",
}}
schPinArrangement={{
leftSide: { direction: "top-to-bottom", pins: ["RESET","CTRL","THRES","TRIG"] },
rightSide: { direction: "top-to-bottom", pins: ["VCC","OUT","DISCH","GND"] },
}}
/>
<resistor name="R1" resistance="1k" footprint="0805" />
<resistor name="R2" resistance="10k" footprint="0805" />
<capacitor name="C1" capacitance="10uF" footprint="1206" />
<capacitor name="C2" capacitance="0.01uF" footprint="0805" />
<led name="D1" color="red" footprint="led0603" />
<resistor name="R3" resistance="330" footprint="0805" />
<trace from="U1.VCC" to="net.VCC" />
<trace from="U1.GND" to="net.GND" />
<trace from="U1.RESET" to="net.VCC" />
<trace from="U1.CTRL" to="C2.pin1" />
<trace from="C2.pin2" to="net.GND" />
<trace from="U1.THRES" to="U1.TRIG" />
<trace from="net.VCC" to="R1.pin1" />
<trace from="R1.pin2" to="U1.DISCH" />
<trace from="U1.DISCH" to="R2.pin1" />
<trace from="R2.pin2" to="U1.THRES" />
<trace from="U1.THRES" to="C1.pin1" />
<trace from="C1.pin2" to="net.GND" />
<trace from="U1.OUT" to="R3.pin1" />
<trace from="R3.pin2" to="D1.pin1" />
<trace from="D1.pin2" to="net.GND" />
</board>
)
</script>
</head>
<body></body>
</html>

Here's a quick primer on how to use tscircuit:

## Core `<chip />` props (most-used)

* `name`: reference designator (e.g., `"U1"`).
* `footprint`: **string** (e.g., `"soic8"`/`"0402"`) **or** a `<footprint />` element.
* `pinLabels`: map pad → pin label (e.g., `{ pin1: "VCC", pin5: "GND" }`).
* `schPinArrangement`: control schematic sides/order of pins (alias **`schPortArrangement`** is deprecated).
Optional styling/box props: `schPinStyle`, `schPinSpacing`, `schWidth`, `schHeight`. ([GitHub][3])
* Connectivity helpers:
`internallyConnectedPins`, `externallyConnectedPins`, and **`connections`** (auto‑traces by pin label)
* Extras: `pcbPinLabels`, `cadModel`, `noSchematicRepresentation`

---

## Minimal chip

<chip
name="U1"
footprint="soic8"
pinLabels={{ pin1: "VCC", pin2: "DISCH", pin3: "THRES", pin4: "CTRL",
pin5: "GND", pin6: "TRIG", pin7: "OUT", pin8: "RESET" }}
/>

## Arrange pins on schematic (+ style/size)

<chip
name="U1" footprint="soic8" pinLabels={{ pin1:"VCC", pin5:"GND", pin7:"OUT", pin8:"RESET" }}
schPinArrangement={{
leftSide: { direction: "top-to-bottom", pins: ["VCC"] },
rightSide: { direction: "bottom-to-top", pins: ["GND","OUT","RESET"] },
topSide: { direction: "left-to-right", pins: [] },
bottomSide:{ direction: "left-to-right", pins: [] },
}}
schPinStyle={{ GND: { topMargin: "0.5mm" } }}
schPinSpacing={0.75} schWidth="12mm"
/>

## Custom PCB footprint (inline)

<chip
name="U1"
footprint={
<footprint>
<smtpad portHints={["1"]} pcbX="-1mm" pcbY="0" width="1mm" height="0.7mm" />
<smtpad portHints={["2"]} pcbX="1mm" pcbY="0" width="1mm" height="0.7mm" />
</footprint>
}
/>

## Internally / externally shorted pins

<chip
name="SW1" footprint="pushbutton"
internallyConnectedPins={[["pin1","pin4"],["pin2","pin3"]]}
/>

<chip
name="U1" footprint="soic8" pinLabels={{ pin1:"VCC", pin5:"GND", pin6:"TRIG", pin2:"DISCH" }}
externallyConnectedPins={[["GND","DISCH"],["TRIG","VCC"]]}
/>

## Auto‑connect with `connections`

A more condensed alternative to `<trace />`, available on basically all elements

<chip
name="U1" footprint="soic8" pinLabels={{ pin1:"VCC", pin5:"GND", pin7:"OUT" }}
connections={{ VCC: "net.V5", GND: "net.GND", OUT: "net.SIGNAL" }}
/>

Use with `sel` for type‑safe selectors (e.g., `OUT: sel.U2(MyReg).VOUT`). ([GitHub][3], [docs.tscircuit.com][4])

## Part selection & PCB labels

<chip
name="U1" footprint="soic8"
supplierPartNumbers={{ jlcpcb: ["C57759"] }}
manufacturerPartNumber="SN74HC14DR"
pcbPinLabels={{ "1":"TX", "2":"RX" }}
/>

## All normal elements and important props

Most elements have a `name` and `footprint` prop. Most properties
are optional.

- `<board />` - root element
- `<group />` - group of elements
- `<chip name="U1" pinLabels={{ pin1: "VCC", ... }} />` - any generic chip
- `<resistor name="R1" resistance="1k" footprint="0402" />` - `resistance`
- `<capacitor name="C1" capacitance="100n" footprint="0402" />` - `capacitance`
- `<inductor name="L1" inductance="100n" footprint="0402" />` - `inductance`
- `<led name="LED1" color="red" />` - `color`
- `<diode name="D1" variant="standard" />` - `variant` (standard/schottky/zener/avalanche/photo/tvs)
- `<trace from="U1.VCC" to="R1.pin1" />` - `from`, `to`
- `<transistor name="Q1" type="npn" />` - `type` (npn/pnp/nmos/pmos)
- `<mosfet name="M1" channelType="n" mosfetMode="enhancement" />` - `channelType` (n/p), `mosfetMode` (enhancement/depletion)
- `<hole name="H1" diameter="1mm" />` - `diameter`
- `<testpoint name="TP1" />` - `padShape` (circle/rect), `padDiameter`, `footprintVariant` (smd/through_hole), `width`, `height`
- `<via />` - `holeDiameter`, `outerDiameter`
- `<switch />` - `spdt` (bool), `dpdt` (bool), `spst` (bool), `spdt` (bool), `isNormallyClosed`
- `<pinheader />` - `pinCount`, `schFacingDirection` (left, up, right, down), `schPinArrangement`, `gender` (male/female/unpopulated), `showSilkscreenPinLabels`, `holeDiameter`, `connections`, `pinLabels`, `rightAngle`, `doubleRow`
- `<jumper name="J1" pinCount={2} pinLabels={{ pin1: "A", pin2: "B" }} />` - similar to pinheader but pin count must be 2 or 3
- `<fuse name="F1" currentRating="1A" voltageRating="250V" />`
- `<pushbutton name="SW1" />`
- `<cutout shape="rect" width="1mm" height="1mm" />` - `shape` (rect), `width`, `height`
- `<crystal name="X1" frequency="10MHz" />` - `frequency`, `loadCapacitance`, `loadResistance`
- `<battery name="BAT1" />` - `capacity`, `voltage`
- `<potentiometer name="P1" maxResistance="10k" pinVariant="two_pin" />` - `maxResistance`, `pinVariant` (two_pin/three_pin). Common footprint "pinrow2"/"pinrow3"

### Footprint Only Elements

- `<smtpad />` - `portHints`, `pcbX`, `pcbY`, `shape`, `width`, `height`
- `<platedhole />` - `pcbX`, `pcbY`, `shape`, `width`, `height`

## Common Footprints

- "0402", "0603", "0805", "1206", "1210"
- "dip", "dip8", "dip16", "axial", "soic8", "bga64", "tssop8", "stampboard", "stampreceiver", "hc49", "to92", "to220", "ssop", "qfp16", "qfn16", "sot23", "sot23_5", "sot223", "pinrow2", "pinrow6"
- You can generally alter footprints by changing numbers or adding parameters e.g. "soic8_w4mm" creates a 4mm width soic, "pinrow8_p1mm" creates an 8 pin pinrow with 1mm pitch
- For batteries, just use "pinrow2"

## Selector Syntax

When specifying a selector, use "{component_name}.{pin_name}" or "net.{net_name}"

These are common selectors:
- "U1.VCC","R1.pin1","C1.pin2","C1.pos","U2.GND", "J1.SOME_PIN_LABEL"
- Special case Net Selectors: "net.VCC","net.GND","net.GPIO1", "net.BAT_PLUS", "net.BAT_MINUS"

Selectors are used in the `connections` prop and the `from` and `to` props of the `<trace />` element.

- `<trace from="U1.VCC" to="R1.pin1" />`
- `<chip name="U1" connections={{ VCC: "net.VCC", GND: "net.GND" }} />`


## Important Notes

- Make sure you've connected both sides of every passives (resistor, capacitor, inductor)
with a <trace /> or a connections={{ pin1: ..., pin2: ... }} prop
- Every normal element has a footprint prop

`.trim()

Example Prompt:

can you create a 555 timer circuit in tscircuit with a square wave output?