Operating point and sweep
A 10 k divider and a 10 k / 10 uF RC on one board, for reading every node at once and sweeping the supply or a resistor: the arithmetic is in the sketch. There is no microcontroller in it: the simulator solves the 4 parts as a circuit, so it runs the moment you press Run, and nothing needs compiling.
BeginnerRuns in your browser. Free, and no account needed.
How it works
There is no microcontroller in this one, so nothing is compiled: the simulator solves the circuit itself. The file in the editor is the notes that come with it.
// Two of the first circuits anybody builds, side by side, and the two
// readings this editor can take of them.
//
// LEFT, columns 8 to 18: a divider. 5 V through 10 k into 10 k.
//
// I = 5 V / 20 k = 250 uA
// tap = 5 V x 10k / 20k = 2.500 V
//
// RIGHT, columns 22 to 29: an RC. 5 V through 10 k into 10 uF.
//
// tau = 10 k x 10 uF = 100 ms
// v(t) = 5 V (1 - e^(-t/tau))
//
// -------------------------------------------------------------- 1. Shift+O
//
// Press Shift+O, or the meter button on the canvas toolbar. Every net gets its
// voltage. With nothing running you are reading the circuit at the instant it
// is plugged in, which is why the two halves read differently:
//
// the divider tap 2.500 V a resistor has no memory
// the RC node 7.500 uV a capacitor starts discharged
//
// Seven microvolts, not a round zero, and that is not a rounding error: every
// node in this engine carries a 1 pS leak to ground so that a node with no DC
// path to the reference still has an answer instead of a singular matrix. It
// is a 1 Tohm resistor, three orders of magnitude leakier than nothing and
// three orders of magnitude tighter than any real part. The readout prints
// what the solver holds rather than tidying it away, which is the whole point
// of four significant figures in engineering notation.
//
// Click a resistor while the labels are up and the properties panel shows its
// current. The divider's two carry 250 uA each. The RC's resistor carries
// 500 uA, because at t = 0 the whole supply is across it and none of it is
// across the capacitor yet.
//
// Now press Run, wait a second, and press Shift+O again. The RC node is at
// 5.000 V, its resistor is carrying nothing, and the divider has not moved.
// Five time constants is half a second and gets you to 99.3%; a whole second
// is ten of them.
//
// -------------------------------------------------------- 2. Sweep the supply
//
// More menu, then Sweep. Step v1.voltage from 0 to 5 in steps of 0.25 and
// watch the divider tap. You get a straight line of slope exactly one half,
// because that is what a divider is: the ratio does not depend on the supply.
//
// at 1 V the tap is 0.500 V
// at 3 V the tap is 1.500 V
// at 5 V the tap is 2.500 V
//
// Download CSV and the whole table is there, every net and every current, at
// full precision.
//
// ------------------------------------------------------- 3. Sweep a resistor
//
// Same sheet. Step r2.value from 1000 to 20000 in steps of 1000, same probe.
// This one is not a straight line, and the arithmetic says why:
//
// tap = 5 V x R2 / (10k + R2)
//
// at 1 k 0.455 V
// at 10 k 2.500 V
// at 20 k 3.333 V
//
// It is steep where R2 is small and flattens off as R2 grows past 10 k, which
// is the practical lesson about dividers: the half of the ratio you can feel
// is the smaller resistor.
//
// ------------------------------------------------ what the sweep does not do
//
// Every point of a property sweep is a fresh power-on, so the capacitor is
// discharged at every one of them. Sweep the supply and watch the RC node
// instead of the tap and you get a flat line at zero, which is true and is
// the note printed under the plot. Put 500000000 in "settle each point for"
// (half a second, in nanoseconds) and the RC node follows the supply, at the
// cost of running half a second of simulated time twenty-one times over.
//
// ----------------------------------------------------------- 4. The time step
//
// The bottom of the same sheet sets the transient step. Leave it at 0 and the
// solver picks each step from the error it is making. Set 1000 (one
// millisecond) and tick "exactly this step", and the RC still charges on the
// same curve: a hundred steps a time constant is far more than the trapezoidal
// rule needs. Set 50000 (fifty milliseconds, half a time constant) and it is
// still stable, and now visibly coarse.
Parts list
6 parts, plus the jumper wires. Every one is in the editor's parts bin.
- 1 × Full-size breadboard
- 1 × Power, 5 V
- 3 × Resistor, 10k Ω
- 1 × Capacitor, 10 µF
How it is wired
4 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.
- 5 V: Resistor, 10k Ω (1) pin 1; Resistor, 10k Ω (3) pin 1
- Ground: Resistor, 10k Ω (2) pin 2; Capacitor, 10 µF pin 2
- Resistor, 10k Ω (1) pin 2; Resistor, 10k Ω (2) pin 1
- Resistor, 10k Ω (3) pin 2; Capacitor, 10 µF pin 1
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.