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.
Teaching? Assign it to your class in one click.
Beginner About 15 minutes to build and run. Runs in your browser. Free, and no account needed.
The parts retail for about $5.25. On Mokxi they're free.
What you'll learn
- How a voltage divider sets a voltage by a resistor ratio
- Reading every node voltage with an operating point
- How an RC circuit charges with a time constant
- Sweeping the supply or a resistor value and reading a plot
- Why a sweep restarts the capacitor discharged at every point
- Difficulty: Beginner
- Time: About 15 minutes
- Parts: 6
How it works
Two classic circuits share one board. On the left, 5 V goes through two 10 k resistors in a row, a voltage divider. The middle point sits at 2.5 V and the current is 250 microamps. On the right, 5 V goes through a 10 k resistor into a 10 uF capacitor, an RC circuit with a time constant of 100 ms.
There is no code. You read the circuit with Shift+O, which shows every node's voltage. Before you press Run, the divider reads 2.5 V but the capacitor node reads almost zero, because a capacitor starts empty. After a second of running, it reads 5 V.
Parts list
6 parts, plus the jumper wires. They retail for about $5.25; on Mokxi they're free.
- 1 × Full-size breadboard
- 1 × Power, 5 V
- 3 × Resistor, 10k ΩIn Starter Kit, Claw Machine Kit, Halloween Prop Kit.
- 1 × Capacitor, 10 µFIn Power Bank Kit.
Kits that can build it
These 7 starter kits have every part in the circuit. Each kit's page lists what else it can build.
Wiring table
Every connection, pin by pin, read from the circuit itself. Each row joins the pin on the left to the pin on the right, by a jumper wire or a breadboard strip.
| Part and pin | Connects to |
|---|---|
| Resistor, 10k Ω (1) pin 1 | 5 V |
| Resistor, 10k Ω (3) pin 1 | 5 V |
| Resistor, 10k Ω (2) pin 2 | Ground |
| Capacitor, 10 µF pin 2 | Ground |
| Resistor, 10k Ω (2) pin 1 | Resistor, 10k Ω (1) pin 2 |
| Capacitor, 10 µF pin 1 | Resistor, 10k Ω (3) pin 2 |
The notes that come with it
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.
Troubleshooting
The usual mistakes with this circuit, and the fix for each.
- The RC node reads a tiny number instead of exactly 0 V This project
That is expected. The solver puts a very small leak to ground on every node, so you see a few microvolts. - Sweeping the supply shows the RC node flat at zero This project
Each sweep point is a fresh power-on, so the capacitor starts empty. Give each point a settle time, such as half a second, to let it charge. - The LED is dim, burns out, or the pin reads wrong because the resistor value is off. Resistor
Read the color bands again. A 220 ohm to 330 ohm resistor suits a typical LED on 5 V. 10k is a common pull-up or pull-down value. Check with a multimeter if unsure. - A pull-up or pull-down resistor is missing, so the input floats and reads random values. Resistor
Tie the input to 5 V or ground through about 10k. Or use INPUT_PULLUP and wire the switch to ground. - An electrolytic capacitor heats up, bulges or pops. Capacitor
Electrolytics have a polarity. The stripe marks the negative leg, which goes toward ground. Also keep the voltage under the rated value, such as 10 V or 16 V. - An RC circuit charges much slower or faster than expected. Capacitor
The time constant is R times C. A 10 k resistor with a 100 uF capacitor gives 1 second, and about 5 seconds to charge fully. Check that you read the value on the part right.
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.