Chip Hippo ← Back to site

Spice Lite

Spice Lite is a second, more electrical way of running a circuit. The standard engine treats every wire as a perfect logic level that arrives instantly. Spice Lite gives every wire a voltage and every input reads the voltage on its own pin, and it adds what a real bench has: time, voltages that charge and discharge, currents through every part and the limits of the outputs and power supplies that deliver them, and the resistance of the jumper wires. Wire something up wrong and it fails the way the real circuit would, and you can watch a capacitor charge until it crosses a gate's threshold.

It is called Spice Lite because it is not SPICE: there is no circuit-wide matrix and no manufacturer models. A plain "74LS00" still needs no manufacturer or part choosing. Everything comes from a few shared formulas (Ohm's law, the exponential charge curve) and a short table of numbers per logic family, taken from TI's datasheets, and one common set for the diodes and transistors.

Turning it on

Open Settings ▸ Spice Lite and set Spice Lite to On. The change takes effect the next time you press Run: a circuit that is already running keeps the engine it started with.

With it Off, nothing on this page applies: the standard engine runs exactly as described in Running a Simulation.

Every wire is a voltage

Each time the circuit settles, Spice Lite works out the voltage on every wire from what is on it: each chip output as the circuit it really is, each input's own current, and every resistor, LED, diode, transistor and switch between them. Then every input reads the voltage on its own pin:

What that changes:

The probe shows the voltage of every wire that has one beside its level (H · 3.60 V), and the current through the lead in the hole it is on. A floating wire shows its level alone.

Time and charging capacitors

In Spice Lite every settle pass takes one gate delay: about 10 ns for 74LS parts and about 125 ns for CD4000 parts at 5 V (faster at higher supply voltages, following the datasheet's 5 / 10 / 15 V figures). On a desk that mixes the two, the CMOS gates take their proper share longer to answer, and a glitch shorter than a gate's delay never makes it through that gate, as on a real chip.

A net with a capacitor on it becomes an analog node. Its voltage follows the real charge curve toward the voltage the circuit round it pulls it to, at the rate the circuit's resistance and the capacitance set (the RC time constant). The whole circuit round it counts: a chain of resistors, a switch or transistor, the resistance inside the chip output driving it, and the current an input on it draws. A CD4000 output charging a capacitor straight can only deliver its limited current (about 4 mA at 5 V), so the capacitor first charges in a straight line and then curves the rest of the way.

Slow curves cost nothing to run: Spice Lite calculates when a node will cross a threshold rather than stepping toward it, so a 10-second RC delay runs as cheaply as a microsecond one. If the app falls behind (a busy computer, or its window in the background), it catches up on the crossings it missed, in order.

An oscillation faster than the desk can show (anything above 1 kHz, the fastest clock on offer) is recognised once it has gone round twice the same way. From then on it is drawn at 1 kHz with its duty cycle kept, as the standard engine draws a fast 555, while time itself runs at its true rate: a timer's readout shows the true frequency, and a CD4060B or CD4541B counting its own oscillator counts every real cycle. Anything that changes the circuit (a reset, an edited value, a supply moving) ends the fast drawing, and the oscillator is worked out afresh. An RC round an ordinary (non-Schmitt) inverter has no second threshold to swing to: it chatters at its one threshold and is reported as oscillating.

Timers

In Spice Lite a timer is the circuit inside it, not a formula. Each one is built from its datasheet's own block diagram: comparators reading the voltages on its pins against their references, the package's own resistors, a discharge transistor, and the flip-flops behind them. Nothing in it computes a period. The period is whatever your resistor and capacitor actually do, so the circuits the formulas never covered work too.

A running timer's readout shows what it measured: the frequency between its last two rising edges, or the length of its last pulse. The Properties card's Timing row still gives the datasheet's figure, worked out from the values you set. Under Spice Lite a timer never complains that it doesn't recognise its wiring: it does whatever its pins make it do. It still says when a pin it needs is left unwired, or a terminal that must be grounded isn't (a CD4528B's T1): it cannot time at all then. The probe shows the real voltage on every timing pin (THRES and TRIG, CONT, RX CX, RC COMMON, an oscillator's junction).

The CD4000 timers' outputs, and the 555's, are as strong as their datasheets say, and are judged by the same current limits as any other output.

Current and fan-out

Every input wired to an output draws a little current, as its own circuit does: a 74LS input pushes about 0.2 mA out of a pin held LOW (it is a resistor and a diode to its supply inside), and nothing once its pin is past about 1.3 V; a CMOS input, or a memory's or processor's, draws nothing at all. So an output with many inputs on it is pulled away from its level by them, and the voltage it ends up at is the one every input on it reads.

A CD4000 output at 5 V holds one 74LS input LOW at about 0.1 V, two at 0.2 V, five at 0.4 V and six at 0.45 V — all LOW to them, typically, though the datasheet guarantees only one (which is what the standard engine's fan-out warning goes by; under Spice Lite the voltage replaces it). The CD4049UB and CD4050B buffers, whose LOW is about five times stronger, are what belongs between the families in a design that has to work with every part off the shelf.

Every part of a family shares that family's numbers: a 74LS244 bus driver drives as every other 74LS output does, so a circuit behaves the same whichever maker's 74LS parts you picture on the bench. An output that is switched off (a tri-state output not enabled) drives nothing and is no part of a brownout.

Shorts and overloaded pins

What damages an output is the current through it, which Spice Lite knows for every output pin, whatever it is driving, and holds each to what its family is made for:

Family Warning Brown smoke
74LS (and memories, CPUs) over 20 mA through the pin over 100 mA
CD4000 over 50 mW in its output over 100 mW

Past the smoke limit the chip is drawn burnt with brown smoke rather than grey, drives nothing for the rest of the run, and a Brown smoke! notice says why.

A 74LS HIGH shorted to ground carries about 30 mA (a warning); a LOW shorted to the supply about 190 mA (brown smoke). Two 74LS outputs fighting each other carry about 24 mA. An ordinary CD4000 output at 5 V cannot pass enough current to hurt itself; at 15 V a short lets out the smoke. The CMOS parts built to drive more — the CD4049UB/CD4050B buffers' LOW, the CD4511B's segment drivers — are held to the same 100 mW per output transistor their datasheets give every B-series output, so a buffer's LOW shorted to a 15 V supply smokes too. The NE555's output is held to its own sheet's 200 mA.

An analog switch channel (CD4066B, CD4051B/52B/53B) is rated for 10 mA: past it a Switch overloaded warning, and past 25 mA brown smoke. A CD4066B channel switched on straight across a 5 V supply carries 10.6 mA.

A transistor is held to the common limits of its kind:

Transistor Warning Smoke
NPN / PNP (TO-92) over 200 mA, or 312 mW over 600 mA, or 625 mW
MOSFET, TO-92 over 200 mW over 400 mW
MOSFET, TO-220 over 1 W (no heatsink) over 2 W

A transistor past its smoke limit is said with a warning that a real one would have failed, but it carries on conducting: it has no supply pins, so nothing on the desk can be switched off for it.

Inputs have limits too:

A short through a transistor or an analog switch — one switched on with its two ends on opposite supplies — is reported as a Short circuit only when the current really flowing through it is 100 mA or more, or the supply it is on has hit its current limit. The standard engine reports every such join; under Spice Lite a transistor whose base is fed through 10 MΩ, passing microamps, is no short. A short with no part in it (two supplies wired together) is always reported.

Stop restores every chip that let out its smoke.

Power supplies

A power supply brick gains a Current limit in its Properties (100 mA to 5 A; 1 A unless you change it). While Spice Lite is running, the brick shows the current being drawn under its voltage.

The supply's load is every chip's own supply current (1.6 mA for a 74LS part, almost nothing for CD4000), plus everything the voltages make flow: the current through every resistor, LED, diode, transistor and switch from the supply, and out of every chip output into whatever it drives (see LEDs, below): a red LED behind a 330 Ω resistor on 5 V draws about 9.4 mA, and one wired straight across the supply draws everything it can until it burns. Current a chip sinks is routed back through its own ground pin.

Chips powered off the rails

A chip whose supply pins are not wired straight to the rails — fed through a resistor, a diode, a transistor, or from another chip's output — runs at the voltage that actually reaches its pins. Its own supply current is a load on whatever feeds it, and so is everything its outputs drive: an LED lit from one of its outputs is fed through its VCC pin, so a 74LS04 fed through 47 Ω sags to about 4.6 V lighting one — underpowered, and still lighting it. A 74LS chip fed through a diode gets about 4.4 V and is underpowered (it needs 4.75 V); a CD4000 chip, which runs from 3 V, works on the same feed, and its HIGH outputs are the 4.4 V it is running on. Its outputs and inputs are measured from its own pins: a chip whose ground is raised drives its LOW at that ground, and a chip across two supplies' rails (VDD on 12 V, VSS on the 5 V rail) runs on the 7 V between them, its LOW at 5 V and its HIGH at 12 V. The standard engine sees only a supply pin that is not on a supply.

Diodes and transistors

Every diode and transistor is one of a single common kind, whatever part number you give it:

A transistor's lamp on the desk lights while it conducts.

LEDs

With Spice Lite on, an LED carries the current its circuit really pushes through it, worked out from its colour's datasheet, and what that current does to it is what it would do on a bench. The standard engine only asks whether something limits the current; Spice Lite asks how many milliamps.

Colour Datasheet Forward voltage Rated Burns at
Red Kingbright WP7113ID 1.9 V at 10 mA 30 mA 71 mA
Yellow Kingbright WP7113YD 1.95 V at 10 mA 30 mA 60 mA
Green Kingbright WP7113GD 2.0 V at 10 mA 25 mA 54 mA
Blue Kingbright WP7113QBC/D 3.3 V at 20 mA 30 mA 39 mA
White Kingbright WP7113QWC/D 3.3 V at 20 mA 30 mA 41 mA

These are ordinary 5 mm LEDs. Every segment of a display and every bar of a bar graph is taken as an LED of its colour.

A chip output is not a perfect source. Each output is modelled as its datasheet says it behaves:

Character LCDs

The LCD modules' backlight is an LED of the module's colour between A and K, behind the 100 Ω resistor the common 1602A and 2004A boards carry for it. Wired to the supply it lights and draws its current (about 18 mA for a blue module on 5 V, 28 mA for a green one); unwired, the panel is dark. Its rating is the module maker's, so it never warns or burns.

V0 sets the contrast. The glass is driven by the voltage between VDD and V0: full contrast from 3 V (the controller's minimum) up, fading below that, and blank with V0 at the supply or left unconnected. The usual 10 kΩ potentiometer from the supply to ground, its wiper on V0, works as it does on a bench. With Spice Lite off, the backlight and contrast are cosmetic as before.

Wire resistance

Every jumper wire is treated as 24 AWG copper at its real length, about 0.084 Ω per metre. Current from a supply is routed through the wiring to each chip, and a chip loses the voltage dropped across the wires its current shares with others. A chip at the end of a long chain of jumpers sees a little less than the chip next to the supply.

The effect is honest but small: a 10 cm jumper is under 0.01 Ω, so it takes a heavy load to see it. Drops under a millivolt are ignored.

Decoupling capacitors

Each time a chip's output switches, it draws a brief extra spike of current to charge what it drives. When many outputs switch at once, those spikes add up, and on a supply that is already close to its limit they can tip it over. Spice Lite warns with Supply spike.

A capacitor wired across a chip's supply (VCC to ground, the usual 100 nF beside every chip) supplies those spikes itself, and the supply never sees them. Spice Lite does not know where along the rails a capacitor sits or what its value is: one capacitor anywhere across the rails a chip's supply pins are on decouples that chip. A capacitor from a signal net to ground is a timing capacitor, not a decoupling one, and doesn't count.

The Spice Lite settings

Settings ▸ Spice Lite holds:

Every change, the numbers included, applies at the next Run: a circuit that is running keeps the settings it started with. Your changes apply to every project on this computer. Each field has a range — hover over it to see it — wide enough for any logic part (a gate delay of up to 10 µs, a threshold of up to 5 V): a number outside it is set to the nearest end of it, so 20,000 ns becomes 10,000 ns and 0 becomes the smallest value allowed. A field that won't read at all, or a LOW threshold at or above the HIGH one, turns red, keeps the previous value, and says why underneath. A very short gate delay is taken as no more than about 64 times faster than the slowest gate on the desk, so a run never crawls.

What stays the same

What Spice Lite does not model

To keep it light, some things are left out deliberately: