Building Circuits
Pin references
Every wire has a from and a to — both are PinRef objects. There are no string-based coordinates. The renderer resolves each PinRef to a THREE.Vector3at build time.
type PinRef = | TiePin // a specific breadboard hole | RailPin // a power-rail hole | IcPin // a named pin on a mounted IC or discrete semiconductor | PassivePin // p1 or p2 lead on a resistor or capacitor | LedPin; // anode or cathode of an LED
TiePin — breadboard hole
{ board: 'bb', col: 3, row: 'a' }| Field | Values |
|---|---|
board | The id of the breadboard component (always 'bb') |
col | 1–30 (for standard board) or 1–63 (for long board) |
row | 'a' through 'j' |
Rows a–e are the top half (above the centre gap). Rows f–j are the bottom half. ICs straddle the gap, with pins landing in row e (top) and row f (bottom).
RailPin — power rail
{ board: 'bb', rail: 'gnd_top', col: 1 }
{ board: 'bb', rail: 'vcc_top', col: 1 }
{ board: 'bb', rail: 'gnd_bot', col: 1 }
{ board: 'bb', rail: 'vcc_bot', col: 1 }| rail value | Physical rail |
|---|---|
'gnd_top' | Blue (−) rail, top of board |
'vcc_top' | Red (+) rail, top of board |
'gnd_bot' | Blue (−) rail, bottom of board |
'vcc_bot' | Red (+) rail, bottom of board |
Every LED cathode must connect to a ground rail. Use a unique column per wire to avoid overlap: gnd_top col:1, col:2, etc.
IcPin — named IC pin or discrete semiconductor lead
{ ic: 'xor1', pin: 'A' } // input A → col+0, row e
{ ic: 'xor1', pin: 'Y' } // output Y → col+2, row e
// Discrete semiconductors (BJTs, MOSFETs):
{ ic: 'q1', pin: 'B' } // Base
{ ic: 'q1', pin: 'C' } // Collector
{ ic: 'q1', pin: 'E' } // EmitterThe ic field references the id of a component with named pins. The resolver looks up that component's mountedAt.col and adds the appropriate column offset.
| Pin name | Offset from mountedAt.col | Row |
|---|---|---|
A / 1A | +0 | e |
B / 1B | +1 | e |
Y / 1Y | +2 | e |
2A | +3 | e |
2B | +4 | e |
2Y | +5 | e |
BJTs, MOSFETs, regulators, timers, etc., all use the IcPin structure for wires (e.g. pin: 'B' or pin: 'G').
PassivePin — resistor or capacitor lead
{ component: 'r1', end: 'p1' } // left lead → mountedAt.col
{ component: 'r1', end: 'p2' } // right lead → mountedAt.col + 3component references the id of a resistor or capacitor. p1 is the left lead (at mountedAt.col), p2 is the right lead (at col+3).
LedPin — LED anode / cathode
{ led: 'led1', end: 'anode' } // anode → mountedAt.col
{ led: 'led1', end: 'cathode' } // cathode → mountedAt.col + 1led references the id of an LED component. Always wire the anode (positive) to the signal chain and the cathode (negative) to ground.