12 April 2012

frEDA SPICE 4: KiCad component repository

I have created a Mercurial repository for my KiCad SPICE component libraries at https://bitbucket.org/mithat/kicad-spice-library. At the moment it covers the same components as the PSpice library that ships with KiCad but renamed and drawn to be more consistent with IEC specs. I will add controlled sources and other SPICE primitives as time and necessity allow.

11 April 2012

frEDA SPICE 3: KiCad components

KiCad ships with a small library of SPICE components (installed as /usr/share/kicad/library/pspice.lib  in Debian). It's nice that it does because it lets you do some basic testing with little investment. However the library has a couple shortcomings:
  1. Many SPICE primitives are absent (e.g. controlled sources).
  2. Some of the components could look better (i.e., more consistent with IEEE or IEC specs).
So, yesterday I began to implement a new library based on the existing one. As soon as it's anywhere close to complete I will publish it in a source code repository somewhere.

09 April 2012

frEDA SPICE 2: ngspice

Out of the gate, my frEDA SPICE effort hit a small stumbling block. It turns out that (for reasons that are not clear to me) ngspice in Debian testing and sid is available only for amd64 and in stable only for i386. (You might also note that ngspice is considered non-free in Debian.) And of course I'm using testing i386.

So, time to compile. To get config to complete without errors, I had to install a bunch of {something}-dev dependencies, but once I had all the dependencies in place it seemed to compile and install just fine.

Next step, integration with KiCad.

frEDA SPICE 1: motivation

I've been getting back into analog electronics design, and related to that I've decided to try to use libre EDA tools as much as possible--an effort I've opted to call frEDA, for free Electronic Design Automation. The interpretation of libre in this context is, "as libre as possible for getting the necessary work done."

When it comes to circuit simulation, SPICE is really the only protocol that will work for my needs. So any solution I contemplate must be if not itself a SPICE implementation then at least fully SPICE compatible. And if there's anything like a classic libre toolset for this, it might be gschem from the gEDA project and the ngspice SPICE engine. (Lots of people seem to like gnucap as well, but it's not SPICE-compatible.)

gschem is capable of some really nice things, but I've decided instead to see how well a KiCad and ngspice pairing works. This is for two reasons:
  1. gschem isn't officially supported on Windows--and while I use Linux as my main OS, I know plenty of people who (need to) use Windows.
  2. Inasmuch as I have begun using KiCad for PCB layout, it would be nice to avoid having to learn and maintain a new schematic capture tool just for SPICE.
So, the current (pun!) workflow looks something like:
  1. Pick a SPICE engine, probably ngspice.
  2. Do some experiments to see if there are any nasty gotchas using it with KiCad-generated netlists.
  3. Make a library of basic SPICE components for KiCad.
  4. Frosting: Investigate tools for drawing SPICE generated output.
I will post updates as anything interesting develops.