There are quite a lot sources and resources for getting started with ngSpice in KiCad, so I thought to make a list with links instead of repeating the information again and again and again and…
Text Tutorials
First, of course the ngSpice website itself. The link below is to how to use ngSpice with KiCad, but there is lots of other info over there, from the official ngSpice manual (ngSpice is a separate project then KiCad), to (links to) downloadable libraries with models.
Videos
If you prefer videos, Holger (the main developer / maintainer of the ngSpice project) has also made a youtube channel with some tutorials:
Examples
On this user forum there are several threads dedicated to ngSpice examples. For the most recent overview, you can do a direct search:
https://forum.kicad.info/search?q=simulation%20examples
And some direct links to the threads with examples:
Attached you will find some simulation examples for audio amplifiers, oscillators, power supplies, and other circuits.
All have been designed/tested with KiCad 6.0.2 / ngspice-36 or KiCad 6.0.10 and ngspice-38.
All will run with internal ngspice,
Inspect → Simulator → Run —> Add Signals
some (Tian probes) will require an additional external ngspice (mostly for its more complex interface and output capability)
File → Export → Netlist… → Create Netlist and Run Simulator Command
after having …
New simulation examples are following here.
Up to Class E RF generator I have been using KiCad 8. Now I am switching to KiCad 9. It should be no problem to open KiCad 8 Eeschema files in KiCad 9 for simulation, as the simulator interface did not change. Unfortunately it is not possible the other way round. You may not be able to open KiCad 9 files in KiCad 8 any more. ngspice-44 is typically involved.
The previous examples (KiCad 6, ngspice-38) are visible at Simulation examples for KiCad/Ees…
Currently ngspice contains 68 code models, ranging from simple elements like analog gain cells or digital inverters up to complex ones like a digital state machine , SRAMs, 3D table models or interfaces to digital Verilog building blocks compiled with Verilator.
I have created a symbol library for KiCad 8, containing digital and hybrid symbols. It is accompanied by the associated simulation model library. Enhancement by analog symbols and models will follow.
XSPICE-symbols-models.7z (4.0 KB)
B…
Some pitfalls to watch out for
You need to have a GND symbol or a “zero” node in the simulation.
The models have to work, and be compatible with ngSpice.
The pin mapping has to correspond with the symbols (Spice pin mapping is often different from real IC’s).
You can not have open nodes (unconnected resistors or capacitors).
You have to add what type of simulation you want to run.
The timing parameters of the simulation have to fit with the timescale in which your circuit operates.
6 Likes