1. Skip to navigation
  2. Skip to content
  3. Skip to sidebar

LTspiceIV: Voltage Controlled Switches

Gabino Alonso - Strategic Marketing Engineer Apr 9th 2015

LTspice includes a large number of excellent FET models, but sometimes you need to simulate a simple switch that opens and closes at specific times or under certain conditions.
To insert and configure a switch in LTspice… (example is available at \LTspiceIV\examples\Educational\Vswitch.asc)

  1. Insert the symbol for the voltage-controlled switch in your schematic (press F2 and type “sw” in the search field of the symbol library).
  2. Insert a SPICE directive (press S) and define the SW model’s parameters using this example:
    .model MYSW SW(Ron=1 Roff=1Meg Vt=.5 Vh=-.4)
    where “MYSW” is the unique model name, Ron and Roff are the on and off resistances and Vt and Vh are the trip and hysteresis voltages. The switch trips at (Vt − Vh) and (Vt + Vh).
    LTspice Help (press F1) contains more about the SW model parameters.
  3. Assign the MYSW model to the switch symbol S1: right-click “SW” and enter the unique model name, “MYSW”.
  4. Control the switch with a voltage source connected to the positive terminal of the switch and ground the negative terminal. In this example a PULSE function source is used to generate a 0V–1V triangle waveform with a 1ms period.

Voltage Controlled Switch in LTspiceVoltage Controlled Switch in LTspice

The switch has three distinct modes of voltage control, depending on the value of the hysteresis voltage, Vh. If Vh is zero, the switch is always completely on or off depending upon whether the input voltage is above the threshold. If Vh is positive, the switch shows hysteresis, as if it was controlled by a Schmitt trigger with trip points at Vt - Vh and Vt + Vh. Note that Vh is half the voltage between trip points which is different than the common laboratory nomenclature. If Vh is negative, like in this case, the switch will smoothly transition between the on and off impedances. The transition occurs between the control voltages of Vt - Vh and Vt + Vh. The smooth transition follows a low order polynomial fit to the logarithm of the switch's conduction. For more information on voltage-controlled switch please refer to LTspice help file (F1).

One classic application of voltage-controlled switches is simulating open-circuit and short-circuit conditions. In the example shown, two switches simulate a short- and open-circuit condition on an LED string.

OC & SC Voltage Controlled Switch in LTspiceSimulating OC & SC Conditions using Voltage Controlled Switches




LTspice® software is a powerful, fast and free simulation tool, schematic capture and waveform viewer with enhancements and models for improving the simulation of switching regulators. Click here to download LTspice

To launch a ready to run LTspice demonstration circuit for this part:

  • Step 1: If you have not installed LTspice on this computer, download and install LTspice
  • Step 2: Once LTspice is installed, click on the link(s) below to launch the simulation
  • Step 3: If LTspice does not automatically open after clicking the link above, you can instead run the simulation by right clicking on the link and selecting "Save Target As." After saving the file to your computer, start LTspice and open the demonstration circuit by selecting 'Open' from the 'File' menu

To explore other ready to run LTspice demonstration circuits, please visit our Demo Circuits Collection.