Who is actually using Kicad for SPICE simulation?

I know this might be a tad generic of a question yet, on the forum there’s plenty of posts addressing issues with the simulation. I share most of those problems, crashes, limited simulation models and so forth…
I am pretty new to kicad yet it seems a fantastic piece of software … so going back and forth between Kicad and LT SPICE (what I use for simulations at the moment) is, frankly, a quite a hassle prone to any sort of errors and misalignments between schematics which, all in all, voids a fair share of the purpose of the software…
So … who is able to simulate SPICE in KIcad…? And … how…?

4 Likes

I use ngspice with KiCAD and can say that the learning curve is extremely steep.
When the simulation runs it’s wonderful, but the road can be long.
The first big hurdle is getting the schematic right (ERC will help a bit, but is pretty dumb).
The second is getting the models for your parts. Use the manufacturer websites; also this link is helpful:

Look out for pin sequencing, especially on transistors and diodes.
Don’t expect help from the ngspice error messages, they’re written in Klingon.
Important tip: tick the box “Show pin numbers” for ALL parts on your schematic, it’s a super help when simulating.

Once you have a sim up and running, it’s a joy playing around with the design until it’s optimal.

Good Luck.

4 Likes

Perhaps most everyone attempting simulation in Kicad finds both success and shortcomings with NGspice…

I’ve had the various success’s and shortcoming’s and prefer LTspice but, I often want to do the schematic in Kicad - thus, I compromise, as follows:

I export a Netlist from Kicad and use it in LTspice and Run LTspice directly from Kicad.

Link to my post containing my comment/how-to-do it… with additional post/info Details in this Post

2 Likes

This is also a very useful thread (thanks to Holger) that i found very helpful.

I want to encourage you to report crashing bugs. Nobody likes them… :slight_smile:

1 Like

hi, that sounds good. yet… how do you go about differencies in symbols/models between the two…? there used to be some python scripts to import lt spice libs to kicad but with those ymmv…

Kicad has both Spice and pSpice symbols. I use both.
Double-Click The Model - the info goes into the panels/Tabs as appropriate.

You can get/copy model data from LTspice and paste it in panels as needed.
Be sure to Enter Voltage data into the Popup panel you get when clicking the Symbol’s Voltage Value (don’t enter it in by using the usual Text input tool. See below screenshot (the light blue highlighted text next to symbol).

Also, be sure to look at the link “with additional post/info Details” That will give full scope of almost all I know :wink:

1 Like

I see. Yet a model that works just perfectly in SPICE wouldn’t work in Kicad’s ngSPICE.
it’s a model of the LTC1044/7660, it’s included inside a *.sub file (a binary file…?) but Kicad does not open it… or, at least, does not allow selection of the model to simulate … :frowning:

The approach uses LTspice models and Kicad simply calls/runs Ltspice model data that you enter. You can grab the model/subtck/etc data from LTspice and use it.

Click the ‘spice’ tab at bottom, enter data as needed… Remember, it’s NOT a perfect solution but does work for me (and the models I use…). See last screenshot below (shows it running in Kicad’s NGspice).

In the past, many or most of the LT parts in LTspice were encrypted, and thus would only run on LTspice. I’m guessing it’s still true. TI used to do the same, thought sometimes they supplied models that would run on other simulators.

If you are a corporate customer, sometimes companies will supply unencrypted models of normally encrypted parts, usually under NDA. No, I don’t like this approach, but just passing the info along.

John

yes, I guess that’s the case. thanks

yet … if ngspice inside kicad is able to simulate in LTspice compatibility mode … shouldn’t it be able to read the encrypted models too…?

A screenshot that may help. Beyond this and what I’ve posted… you should be able to get there… Summary: it’s about having good model data that LTspice can use (you enter good data in: .LIB, .SUB. or, in the Model, Lib or Sub data typed into the Schematic and/or relevant panels (some Spice and pSpice examples below that LTspice can use)) and Kicad simply runs LTspice.

hi, thank you for taking the time to go through this.
yes, I understand your walkhrough.
my question at this point would be: given the fact that LTSpice can run the sim no problem on its own with the specified 1044.sub … shouldn’t kicad be able to do the same starting from that .lib or .sub file (which seems not to be the case, at the moment)?

btw … where do you access that spice model editor dialog…?

Look at the posted image in previous post containing image with Garbage - it’s not readable.
So, you need to Edit/Cleanup/Add/Delete… to get a good file.

Not all of Spice and pSpice models/lib are bad.

This Video show a very simple Circuit in Kicad. Circuit contains:
• Spice two Voltage Sources
• Spice Resistors
• A diode with ‘my parameters/values’ in a Model file ( .txt )

Video shows running it in Kicad’s NGspice Simulator, then, Exporting the Netlist (menu clicking off-screen, sorry but, it’s: File>Export>Netlist) and, since I did Not Reset the Calling to Run LTspice in the Generator, I’m just opening the exported Netlist (the .CIR shown in video) by open-with, on mac computer). NOTE: if it doesn’t Open, I can boot LTspice and ‘Open Other’ in it’s main panel and select the .CIR). Bingo! and video shows it running in LTspice. Summary: Videos shows running Circuit in both NGspice and LTspice and the circuit contains Kicad’s parts, models and one homemade diode…

I’m going to leave it to YOU to click around, read documentation…
There is nothing more I can say…

x

ok, thank you, I’ll dig some more

Has anyone tried importing an LTSPICE schematic into the latest nightly version of Kicad? I’ve also found out that members of the LTSPICE io.group are very helpful in making sure the circuit imported into kicad can at least work.

No, because that would mean the encryption method and key was known and public, or at least it would be public if if ngspice could decrypt the parts to simulate them since ngspice is open source (theoretically there might be a workaround to this, but practically there is not).

Companies encrypt models for a variety of reasons. Some are good, and some are bad.

John

I use kicad for simulations, sometimes only to generate netlist which then I read using ngspice in command line. Kicad UI for simulations seems to limit possibilities of ngspice (or maybe I don’t know how to use it).

I use KiCad in combination with ngspice for research on PMTs, see: https://roderic.uv.es/handle/10550/80331