KiCad 5 and Spice

Over the holidays I helped out a friend of mine with some electronics for his Model Railroad installation. This guy is SERIOUS, he actually bought a second house in Seoul just to contain his train setup! Anyway, there was one circuit I got curious about and decided to simulate it in Spice. I noticed KiCad 5.0 was supposed to play nice (nicer) with Spice, so I gave it a try.

Here’s how it went.

The quick summary is that it was a pain to get going. Some of that pain comes from infrequently using Spice, but I kept at it because the interface between KiCad and Spice looked so promising. Once I had it working, it was great. I can see this being really great once some of the issues get ironed out in future releases.

Kudos to the KiCad team responsible for this interface to Spice.

1 Like

That was a great write up, thank you for sharing! I find myself falling back to LT Spice out of habit, but that has happened less and less as the nature of my work has changed. I haven’t yet given SPICE a try in KiCad, but I will hopefully soon.

One thing I’m curious about is transitioning out of “spice mode” and into “layout mode”. How does the program handle things like voltage sources when you go to do the layout?

I’m going to post the project on github today. My first thought is that you’d better keep separate schematics. Practically speaking that’s probably not too severe a limitation, as often you only want to simulate a key section of your circuit, not the whole design. In this regard the benefit of integration with KiCad is the only having to use one schematic tool and the ease of flipping back and forth between schematic and SPICE, not to mention the component tuning interface where SPICE can tweak valies in your schematic.

However, I suppose it’s possible to maintain a single schematic for design and simulation. The parts have a flag which says “exclude this part from SPICE simulations”. Isn’t there a similar flag to exclude a part from the PCB (I’m not at my computer right now to check)? It might get pretty cluttered with SPICE directives and sources, static and dynamic, and test loads. But possible for a not-too-complex design?

It would be really interesting to have this automated, thank you for sharing and look forward to testing it out myself! I’ve tried playing with the “Spice Simulator” in 5.0 but not much yet. As I move into the Current Sink or Swim project that could be very cool to have for sure

In the meantime, does anyone have the LT Spice version of one of these?

We are working on better spice prepared symbols right now: Add new simulation symbol lib by evanshultz · Pull Request #1473 · KiCad/kicad-symbols · GitHub

Meaning v5.1 should come with some symbols ready to go out of the box.

Not only voltage sources are problematic. But symbols need to be made slightly differently for spice support when compared to the current library convention.

The main problem are multi unit parts like opamps. These need the power pins on every unit. Which is a bit dangerous for creating normal circuits (one could connect the same pin multiple times that way.) The new file format expected for version 6 will hopefully bring a better way to define this.

1 Like

Good to hear this news.