Custom Components In LTSpice

If you enjoy simulating circuits, you’ve probably used LTSpice. The program has a lot of powerful features we tend to not use, including the ability to make custom components that are quite complex. To illustrate how it works, [asa pro] builds a potentiometer component that is not only a good illustration but also a useful component.

The component is, of course, just two resistors. However, using parameters, the component gets two values, a total resistance and a percentage. Then the actual resistance values adjust themselves.

To simplify making the symbol, the video shows how to read in an existing symbol — in this case a resistor — and then modify it to suit. Of course, at the end, you get to see how to actually apply the new component. Of course, the real value would be making even more complex components, but the potentiometer shows you all the techniques you need such as computing internal values and mapping pins to variables.

This is one of those things that isn’t all that hard, you just have to take the time to figure it out once. The video can help. If you need even more basic help, we have our own videos. Or check out some of the Circuit VR series.

8 thoughts on “Custom Components In LTSpice

  1. It is possible, albeit difficult, to do this in ngspice in KiCAD.
    https://forum.kicad.info/t/how-to-set-spice-transistor-parameters/11131/4 (about halfway down the page) shows an example of entering model data based on datasheet values into ngspice through the KiCAD front end and getting a valid simulation out of it.
    This way you can do schematic entry, simulation, layout, and BOM all in one package.

    Altium also has a way to call pspice, although I haven’t figured all of it out yet.

    1. When using the software on a regular basis you either use hotkeys or you remote control it via a scripting language (python, matlab, …). So the somewhat uncommon UI is less a problem.

    2. Yeah, it’s one of the “living fossil” UIs that have survived essentially unchanged since before the standard patterns of selecting tools, selecting objects, and applying tools to objects evolved.

      While rare in general desktop applications, they are depressingly common in niche industrial software. Some engineer with zero interest in UI design improvised it in 1989 or so, and the company will be damned if they’re going to spend a penny to rewrite it now.

    3. LTSpice? Unfriendly UI?

      Have you ever created a schematic in well.. any other free program in existence?
      I only added that “free” in there because I haven’t tried anything that cost money.
      Because anything I know of that does cost money costs a whole lot of it!
      Maybe those are better, maybe not. For the prices I don’t care.

      But seriously, at least among the free stuff I think LTSpice stands out as being one of the easiest to use pieces of software out there!

      As for the simulation side of it well.. drag a pair of test-probe icons to the correct wires, press go and a virtual oscilloscope appears on the screen. I don’t know what more you are asking for.

      I hope that some day simulation in KiCad is so easy. Going from initial simulation to PCB design in one package would be great!

      1. These days we rarely get to have user interfaces that are actually consistent and don’t try to sacrifice concepts that have become second nature for paradigms that add little to the actual problem solving workflow… or merely become a means to combat bloat (I’m looking at you, Office).

        As for KiCad… if I could forget everything I have learned, unlearned and overwritten from 4 to 5 and now from 5 to 6, I would. Between “you must like the new icons” and default keyboard shortcuts that keep changing and require multiple keys to be combined with may only make sense on a mac or a US keyboard layout, it’s easy to be angry and ungrateful.

        The more I used LTSpice, the better I got at it. I cannot claim the same for KiCad.

        1. I think the changes to Kucad _are_ making it better though. I’m in the same boat, trying to re-learn (again!) how to do things. Of course it doesn’t help that when you search for advice, all the good tutorials are for an older version! The Kicad forums are great though.

          Remember how bad it used to be to manage component libraries? That’s the worst thing from old Kicad that stands out, but I’m sure there were others. I’ve also been blown away by how easy some things are, that used to take layers and layers of plugins a few years ago. Import SVG graphics? Easy. 3D renderings? Easy peasy, and I am certainly NOT a 3D expert. Back in the day I used to do some convoluted process with Eagle and POVray… I do not miss that, not one bit.

          There will definitely be teething troubles with Kicad 6, and I am really hoping that its introduction doesn’t coincide with some kind of production deadline at work… but I think that when the dust settles and users like us have cast aside the muscle memory from Kicad 5, we will have a better Kicad.

          Sorry for going off topic.

    4. I have heard this comment before, and I don’t know what to say.

      Is there a better analog simulator? I have used PSPICE, but I like LTSpice better.

      I think maybe it’s just a matter of familiarity. You get the hang of it with experience.

Leave a Reply to kc8rwr Cancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.