Adding Components
Component types
Every physical part in a circuit is a ComponentInstance — a discriminated union typed on the type field. The renderer dispatches through COMPONENT_REGISTRY keyed on that string.
Each component type has its own folder under src/components/ containing the geometry builder. All types below are fully renderable with 3D geometry.
Boards
{ id: 'bb', type: 'breadboard' }
{ id: 'bb', type: 'long-breadboard' }Always the first component. breadboard renders a 30-column solderless breadboard. long-breadboard renders an extended version with more tie-points.
Logic gates (DIP-14)
All gate types render as a DIP-14 IC package straddling the centre gap. Each occupies 7 consecutive columns.
{ id: 'xor1', type: 'xor-gate', mountedAt: { board: 'bb', col: 5, row: 'e' } }
{ id: 'and1', type: 'and-gate', mountedAt: { board: 'bb', col: 12, row: 'e' } }
{ id: 'or1', type: 'or-gate', mountedAt: { board: 'bb', col: 5, row: 'e' } }
{ id: 'not1', type: 'not-gate', mountedAt: { board: 'bb', col: 5, row: 'e' } }
{ id: 'nand1', type: 'nand-gate', mountedAt: { board: 'bb', col: 5, row: 'e' } }
{ id: 'nor1', type: 'nor-gate', mountedAt: { board: 'bb', col: 5, row: 'e' } }
{ id: 'xnor1', type: 'xnor-gate', mountedAt: { board: 'bb', col: 5, row: 'e' } }
{ id: 'buf1', type: 'buffer-gate', mountedAt: { board: 'bb', col: 5, row: 'e' } }Passives
Resistor
{ id: 'r1', type: 'resistor', ohms: 330, mountedAt: { board: 'bb', col: 22, row: 'c' } }Renders as a horizontal cylinder with four colour-coded bands. Spans col → col+3. Leads: p1 (left) and p2 (right).
Capacitor
{ id: 'c1', type: 'capacitor', capacitance: 100, mountedAt: { board: 'bb', col: 5, row: 'c' } }Electrolytic capacitor. Spans col → col+1. Leads: p1 and p2.
Potentiometer
{ id: 'pot1', type: 'potentiometer', mountedAt: { board: 'bb', col: 1, row: 'b' },
probes: [pinRef1, pinRef2] }Variable resistor with optional probe wire targets for instrument connections.
LEDs & Displays
LED
{ id: 'led1', type: 'led', color: 'green', mountedAt: { board: 'bb', col: 24, row: 'c' } }Colors: 'red', 'green', 'yellow', 'blue', 'white'. Spans col (anode) → col+1 (cathode).
7-Segment Display
{ id: 'seg1', type: '7seg-display', mountedAt: { board: 'bb', col: 10, row: 'e' } }Semiconductors
Diode
{ id: 'd1', type: 'diode', mountedAt: { board: 'bb', col: 5, row: 'c' } }Zener Diode
{ id: 'z1', type: 'zener', vz: 5.1, mountedAt: { board: 'bb', col: 5, row: 'c' } }BJT (NPN / PNP)
{ id: 'q1', type: 'npn-bjt', mountedAt: { board: 'bb', col: 10, row: 'c' } }
{ id: 'q2', type: 'pnp-bjt', mountedAt: { board: 'bb', col: 15, row: 'c' } }MOSFET
{ id: 'm1', type: 'n-mosfet', mountedAt: { board: 'bb', col: 10, row: 'c' } }
{ id: 'm2', type: 'p-mosfet', mountedAt: { board: 'bb', col: 15, row: 'c' } }Op-Amp
{ id: 'oa1', type: 'op-amp', mountedAt: { board: 'bb', col: 5, row: 'e' } }Switches & Buttons
{ id: 'btn1', type: 'push-button', mountedAt: { board: 'bb', col: 2, row: 'c' } }
{ id: 'sw1', type: 'switch', mountedAt: { board: 'bb', col: 3, row: 'c' } }
{ id: 'dip1', type: 'dip-switch', poles: 4, mountedAt: { board: 'bb', col: 5, row: 'e' } }Power
{ id: 'bat1', type: 'battery', mountedAt: { board: 'bb', col: 1, row: 'a' },
terminals: [pinRef_pos, pinRef_neg] }
{ id: 'dc1', type: 'dc-jack', mountedAt: { board: 'bb', col: 1, row: 'a' },
terminals: [pinRef_pos, pinRef_neg] }Instruments
{ id: 'amm1', type: 'ammeter', ... } // rendered (src/components/ammeter)
{ id: 'vm1', type: 'voltmeter', ... } // rendered (src/components/voltmeter)
{ id: 'dmm1', type: 'multimeter', ... } // rendered (src/components/multimeter)
{ id: 'osc1', type: 'oscilloscope', ... } // rendered (src/components/oscilloscope)
{ id: 'fg1', type: 'function-generator', ... } // rendered (src/components/function-generator)
{ id: 'la1', type: 'logic-analyser', ... } // rendered (src/components/logic-analyser)Other
{ id: 'xfm1', type: 'transformer', ... } // rendered (src/components/transformer)
{ id: 'mcu1', type: 'mcu-trainer', ... } // rendered (src/components/mcu-trainer)Wire
{ id: 'w1', type: 'wire', color: 'red',
from: { board: 'bb', col: 3, row: 'a' },
to: { ic: 'xor1', pin: 'A' } }Renders as an arced bezier tube between two PinRef endpoints. See Pin references for every endpoint type.
| Color | Convention |
|---|---|
'red' | VCC / Input A |
'blue' | Input B |
'orange' | Input C / Cin / Bin |
'white' | Internal signal |
'green' | Sum / primary output |
'yellow' | Carry / Borrow output |
'purple' | Alternate signal |
'black' | Ground |
Every component type also has a buildXxxStandalone() variant (e.g. buildLedStandalone('red')) used by the showcase cards on the landing page and the EceComponentViewer. Write one alongside the board-mounted version.