# How to input range of current values in LT Spice

Firstly, I'm a beginner at LT Spice. I wanted to learn how could you input a range of values for current. For example, let's say, I want my waveform to oscillate from 10uA to 10mA in the circuit below (instead of -10mA to +10mA since I've given 10mA as amplitude)-

So, I wanted to know how to change the amplitude for it according to the range I want. Any help would be appreciated, thanks in advance.

• clarify what you mean by 'oscillate from 10 uA to 10 mA'. Do you mean a sinewave whose +ve peak is +10 mA, and whose -ve peak is + 10 uA, so offset from zero mean? Or do you mean a zero mean sinewave with peaks of +/- 10 mA , whose amplitude can be changed to +/- 10 uA or other values during the simulation? Apr 27 at 8:05
• Are you asking for the .param and .step SPICE directives? Apr 27 at 8:10

I want my waveform to oscillate from 10uA to 10mA

That's a peak-to-peak value of 9.99 mA or, a peak value of 4.995 mA.

So, use two current sources in parallel; one set to produce a peak current of 4.995 mA and the other set to deliver the offset current 5.005 mA DC.

Current sources in parallel add and you'll get what you require. Example of a 1 kHz sinewave: -

The composite current from the two sources flows into a 1 kΩ resistor and produces a peak of 10 volts and a valley of 10 mV.

I would use a behavioral current source (bi in the components library)

The amplitude could be driven by a voltage source in PWL mode :

and then, the arbitrary current source (or here voltage source) can be configured (you can use the inside variable "time" which is the current time of the simulation)

And finally you obtain:

If you want to modify it over several simulations, I would recommand to look at ".step param myVariable list listOfValue" in the help

If you're referring only to your current source then what you ened is a sine with offset. So calculate it based on your maximum and minimum values, (10m + 10u)/2 = 5005u = 5.005m. Then calculate the amplitude of the sine as (10m - 10u)/2 = 4995u = 4.995m, and introduce them in your SINE() expression:

SINE(5.005m 4.995m 25)


The parameters are described in the editor, too:

SINE(Ioffset Iamp Freq Td Theta Phi Ncycles)

Not all parameters need to be specified (e.g. you can omit Td and all the others, as you have it now).

Also, you have no ground on the primary side. That's a bad habit, even if LTspice tries to avoid you, shooting yourself in the foot, by adding a hidden Gmin to ground.