Tag archives: ltspice

Thursday 7th July 2011 - 20:38:20


I am learning LTSpice and have finally worked out how to sweep a resistor value over time in an LTSpice simulation. I tried all sorts of stuff to make it work, but didn't think of this novel way of doing it. Drive the resistance by multiplying the total resistance by a 0-1v sweep (and add say 0.001 so LTSpice doesn't cry). Unfortunately I can't take credit for this idea myself - it came after lots of googling and forum trolling. I've incorporated this sweep into my new constant current load simulation. This sweep starts after a delay of 2s.

The first part of the simulation (first 2s) concentrates on the low battery indicator. The vbattery voltage sweeps from 12v up to 24v over 2s so that we can see the battery voltage cross the low battery set threshold and the vlowled indicator fall.

In the top plot area you can see the traces for the battery after the resistor divider (vlowsens), the low battery threshold voltage set with a zener diode (vlowset), the output from the opamp to drive the low battery LED (vlowled) and the +15v output from the LT1121.

In the middle plot we can see the amount of current being sourced and by multiplying the voltage on the high side of R1 by the current on R1, we can see the power in watts.

The bottom plot area shows the linear response of the pot simulating the rotation of the dial for its full range over 10 seconds. It crosses over in the middle where the wiper is at exactly 50%.

There are also a few more notes and photos in the gallery.