← Back to Projects

Circuit Lab
LiveA bench on your phone. Circuit Lab is a real circuit simulator: draw a schematic with your thumb, and it solves it continuously, animates the current, lights the LEDs, and puts any node on a four-channel oscilloscope. Built for the person who wants to see why the capacitor does that.
Screenshots
What It Does
- →Tap a part, tap the grid, drag to wire: resistors, capacitors, inductors, pots, DC and AC sources, pulse and triangle generators, switches, diodes, LEDs, zeners, NPN and PNP transistors, MOSFETs and op-amps
- →The simulation runs all the time: current flows as lit dots along the wires, wire colour shows voltage, LEDs glow, and a tap flips a switch
- →A four-channel oscilloscope with a bench-style readout header, time and volts per division, trigger, cursor, pause and a persistence ghost of the last sweep
- →Long-press any part for a value sheet with a big tabular number, unit-prefix chips and a sweep slider the circuit follows live
- →Ten worked examples, from a voltage divider to a bridge rectifier and an astable multivibrator, each with a real schematic thumbnail; floating nodes and source loops get a plain-language note, never a crash
- →Circuits save themselves, export as JSON, and fit inside a link, so a whole circuit travels in the URL; installs to your phone and works offline
What I Built
- →A modified nodal analysis engine written from scratch: dense LU with pivoting, a DC operating point, then trapezoidal transient integration with backward Euler across discontinuities
- →Newton–Raphson with SPICE-style junction limiting for the nonlinear parts: Shockley diodes, Ebers–Moll BJTs, square-law MOSFETs and a rail-limited op-amp
- →An analytic test suite: RC step response within 1%, RLC resonance, rectifier peaks against an independent diode solve, op-amp gain, BJT bias points, plus hundreds of random circuits that must never crash the solver
- →Every schematic symbol drawn by rule in IEEE style on one stroke weight, with labels that move out of each other’s way, and a colour-blind-safe voltage ramp
- →Phosphor-green scope traces with a graticule and persistence, drawn on Canvas with no charting library
- →A static, installable web app (React, TypeScript, Vite) with a service worker; honest about its models (no Early effect, no slew rate) and says so in the README


