Simulation examples for KiCad/Eeschema/ngspice

I have added a simple TRIAC circuit and a quartz crystal oscillator.

1 Like

These are great. Thank you so much!

I am really pleased that this thread exists. Simulation examples are far harder to find for KiCad than for its PCBs

I am new to KiCad and I am very happy to find out these examples in this forum.

I tried the first one - LM3886-simple. I could open it smoothly in KiCad 6.0.4 (Linux). But when I simulated it, Vout stayed at -91.97V which I think was abnormal.

I also tried LM3886. The simulation result was similar with Vout stayed at an unrealistically high voltage.

Is there anything I just overlooked?

What is your ngspice version?

What’s the easiest way to check in Linux? Can you type something in the terminal to spit it out? Or does it say somewhere explicitly in the GUI? I only know how to check using version within a .control / .endc block, and wondering if there’s an easier way Linux users may be able to do it.

It should say in Help → About KiCad → Version on all operating systems, although maybe that’s only be true for relatively recent versions of ngspice?

1 Like

Below is the KiCad version info for your reference.

Application: KiCad Schematic Editor

Version: 6.0.4-6f826c9f35~116~ubuntu20.04.1, release build

wxWidgets 3.0.4
libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3

Platform: Linux 5.13.0-39-generic x86_64, 64 bit, Little endian, wxGTK, pantheon, x11

Build Info:
Date: Mar 21 2022 17:21:29
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
Boost: 1.71.0
OCC: 7.5.2
Curl: 7.81.0
ngspice: 31
Compiler: GCC 9.4.0 with C++ ABI 1013

Build settings:

But somehow, I tweaked for a while and finally got LM3886 as well as the next example (Nelson Pass F5) working. Below is what I have done.

  1. I just notice that my ngspice is of version 3.1. It is the latest version available from Ubuntu packages. With this version, I cannot get the Nelson Pass F5 example to work because ngspice 3.1 does not recognize the VDMOS thermal model.

  2. So I follow the user manual of ngspice to compile ngspice 3.6. It took me some time to sort out all development libraries required because I did not specify to install development environments in my ElementaryOS. But finally, I can make it compiled.

  3. Furthermore in KiCad I have to choose compatibility with PSpice and LTSpice in order to make the LM3886 and PassF5 examples work.

Conclusion: Versions of KiCad and ngspice are important.

I will continue to try the other examples in the forum.

1 Like

Type /usr/local/bin/ngspice. It will show the version info as below.

** ngspice-36 : Circuit level simulation program
** The U. C. Berkeley CAD Group
** Copyright 1985-1994, Regents of the University of California.
** Copyright 2001-2020, The ngspice team.
** Please get your ngspice manual from Ngspice, the open source Spice circuit simulator - Documentation: manual and control flow
** Please file your bug-reports at Ngspice circuit simulator - Reporting Bugs
** Creation Date: Sat Apr 16 05:46:43 UTC 2022

1 Like

I have already requested and ask for adding ngspice-36 to the Ubuntu PPA KiCad distribution. The maintainer has agreed. So hopefully the next release (KiCad 6.0.5), due by end of April, will contain ngspice-36.

1 Like

Great news! Thanks, holger.

I have added another demo, a 200 V, 20 A full bridge.