How do I integrate Spice models into LTspice?

(Guest) Thomas Wetzel

27/10/2020

Anyone who enjoys working with LTspice will appreciate the included component models. For more complex components, however, these are largely limited to components from the Analog Devices portfolio. Even simpler components such as transistors or diodes are sometimes missing but require more detailed simulation. Most manufacturers often offer a whole range of models for components such as transistors. An internet search for "SPICE model transistor xyz" promises useful results.

In such cases, it is necessary to search for external component models and then integrate them into the simulation. LTspice offers various ways to do this, as shown in the following diagram.

The solutions for standard components

Model placement on the circuit diagram

Standard components are components such as transistors, diodes, or resistors. All of these are already represented by symbols in LTspice. For example, if you want to add a new transistor that isn't yet available in LTspice, you can quickly install it as follows (we'll use the BC817 NPN transistor from On Semiconductor as an example).

(1) Download a SPICE file, which many manufacturers provide on their websites. These SPICE files typically have the extension ".lib," ".sub," or ".mod." In our case, the file is located at: https://www.onsemi.com/pub/Collateral/SBC817-40L.LIB.LIB

If you open this file in an editor, you will see a readable file, starting with a “.MODEL” command, followed by the name of the model (in our case “Qbc81740lt1g”) and the name of the base element (here “npn”).

The remaining lines merely form parameter sets for the basic element of the npn transistor.

(2) We create a circuit in LTspice that contains one or more NPN transistors. Now we simply copy the entire contents of the BC817 transistor's .lib file into the schematic next to the circuit as a Spice directive. To do this, we click the following button in the toolbar:

Next, we copy the contents of the .lib file into the text field, click "OK," and place our model anywhere in the schematic. We also rename the transistor value to the name of the transistor model. In this case, it's the somewhat cumbersome "Qbc81740lt1g." The result will then look something like this:

The simulation can now be started.

Integration via include statement

The disadvantage of the above-mentioned method is the increasing complexity when inserting multiple models into the schematic. A similar approach using the include statement is recommended. This does not require the entire model code to be placed in the schematic, but rather just a statement with a reference to the respective model file.

It is only necessary that the model file is located in the same working directory as the simulation file itself.

The simulation can now be started successfully again.

Integrate directly into the standard library

If you want to avoid placing the component model directly on the schematic or including it via the Include command, you can also include it directly in LTspice's standard library. The standard library is usually accessed by right-clicking on a standard component in the schematic. A window will open where you can then click "Pick New Transistor."

A list of the models already stored in LTspice for the respective standard component will then open. To add the BC817 transistor model to this list, open the "standard.bjt" file (.bjt = bipolar junction transistor) in the "LTspiceXVII\lib\cmp" directory. (LTspiceXVII is now located under Documents in Windows by default.)

The result after inserting it into the “standard.bjt” looks like this:

If you now open the standard library by right-clicking on an NPN transistor and then clicking "Pick New Transistor," the list of standard transistors opens. At the top of the list is our BC817 with its clunky name "Qbc81740lt1g" (which can, of course, be customized as desired).

By selecting our transistor, the simulation can be started without requiring an include command or direct model placement on the schematic. This is useful if you plan to use a component frequently in the future.

Integrate more complex models as subcircuits

More complex Spice models, which (among other things) are constructed from several standard elements, can also be easily integrated into LTspice. An example is the AP8803 LED driver from Diodes Inc.

The Spice model of this device can be downloaded from the Diodes Inc. website (https://www.diodes.com/assets/Spice-Models/Discrete-Prodcut-Groups/Medium-Voltage-DC-DC-LED-Drivers.txtWe now open this file in LTspice by clicking "File → Open" and then opening the file "Medium-Voltage-DC-DC-LED-Drivers.txt." LTspice automatically highlights the file in color, which is very convenient. The result looks like this:

If you now mark the .subckt line, which is displayed in blue font, and right-click on it, a larger selection window appears in which we click on “Create Symbol”.

LTspice then asks us “Do you wish to automatically create a symbol that will netlist against the subcircuit AL8803_SIMETRIX and her 5 ports?”, which we confirm with Yes. Now we're taken to the symbol editor in LTspice, where we can freely customize it, with a few exceptions, and create a symbol to our liking. However, the following simple symbol appears first:

We can assign the numbers next to the 5 connection pins to the connection pins from the datasheet using the subcircuit netlist:

Now we can begin designing our symbol as we wish. The only thing to keep in mind is that the Unnn should remain. This is a placeholder for LTspice and will later be automatically replaced by a sequential number in the schematic. Additionally, the symbol center is defined by the crosshairs, so this is also important to keep in mind.

However, the border box and the pin connections can be moved and designed as desired. After a few editing steps, our symbol now looks like this:

We save the symbol and can now use our LED driver in a simulation. To do this, open a simulation and place a new component. The "Select Component Symbol" dialog box will appear. Here, we'll find a new folder called "[AutoGenerated]," which contains the "AL8803_SIMETRIX" component.

We insert the block into our circuit diagram and add a few standard components to start the simulation.

Eureka! The LED driver, a type of buck converter with an internal switching MOSFET, regulates a current of approximately 200mA through our LED.

If you have any questions about integrating external models or general questions about simulations in LTspice, please don't hesitate to contact us. We'll be happy to help.


My name is Thomas Wetzel, and I studied electrical engineering and mechatronics in Erlangen, Deggendorf, and Dresden, but I'm originally from Forchheim in Upper Franconia. During a stay abroad in Papua New Guinea in 2010, I worked in the technical department of a hospital, where I enthusiastically gained my first experiences in the medical field. During my master's studies in Erlangen and my subsequent career start at Siemens Healthineers, I gained experience in hardware development.


More articles

  • 26/11/2025
  • General, Hardware, Standards, Quality, Testing

Why EMC testing is vital in medical technology: Imagine a patient is lying in the hospital during critical monitoring. Suddenly, a visitor's smartphone rings – and the monitoring device... ...

Read more
  • 20/11/2025
  • General, Hardware, Quality, Technology, Testing

Have you ever considered sourcing inexpensive components from China? The temptation is strong, we know that. And we've already gained some experience, from which I... ...

Read more
  • 25/09/2025
  • General, Electrodermal Activity, Hardware, Production

May I introduce you? This is EDA – our owl for electrodermal activity. This is EDA, our little owl with a special talent. EDA can measure electrodermal activity (EDA for short) – ...

Read more
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Strictly Necessary Cookies

Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.