I am absolutely new to KiCad at all (first fault ^^), finally managed a fine tutorial eeschema -> pcbnew, and another project created from scratch (yay).
Now, I want to play with the KiCad -> ngspice interface (second fault?). What I want to simulate is a simple OpAmp-based oscillator. Nothing too wild, just a simple Wien. In my small world, I just need two DC power sources (like +/- 9V=), a GND (or 0V), the parts, the KiCad requirements (like power sources), the wires, a place to put the probe, like a label, and hit run. Well, of course not.
What I believe to have found out so far is that I need an OpAmp that ngspice can deal with. Perhaps you can point me to one (doesnât need to be the most amazing opamp ever invented, just one that will work). I just want to get familiar with the KiCad -> ngspice thing, am far away from being able to create my own part descriptions.
Itâs the usual problem with cool software created by cool brains: the tutorials run like a top model on the catwalk, but if you want to make the next step, itâs like ââuse Google!ââ, and if you do so, youâll find yourself in a nutshell drowning in the Pacific, without even a bottle of water.
You just should work through the examples. And if you have questions, ask them here in this thread.
Because the simple, but not very helpful answer to your question would be: ngspice can deal with all OpAmps. The tutorial names a LF356, more by chance than by reasoning.
Well, Holger, I guess now I know what the Corona lockdown could be good for⊠Honestly, I was afraid of this kind of answer, like I tend to tell my tuition students: ''if you want to unterstand maths, you have to know mathsâŠ" Still, thank you, that tut looks like its learning curve is managable.
Again the answer to this question is simple: Beyond R, C, and L you always have to deal with finding a suitable device model externally (in the web, at the manufacturersâ site etc.). These are not delivered with ngspice nor with KiCAD. But you have to do it only once (per device). People have refrained from making collections of these data and offering them publicly due to restrictions in licensing and maybe other reasons.
For me (with some experience) it takes a few minutes to find a suitable model. And why not just start with the tutorial example?
We should ask the library maintainers to do us (simulators) a favour:
For a very basic (beginners) simulation library set we need:
R, L, C: this is already included, the user just needs to add the value
Bipolar, MOS, JFET, Diode: Add a simple model description to the symbol lib using the default model parameters coming with ngspice. For the diode this for example would be just a â.model SimDiode Dâ, for the npn a â.model SimNPN NPNâ etcâŠHave the correct (alternative) pin sequence compatible with ngspice in the symbol. The user just has to choose the diode symbol or the right symbol for pnp, npn, or p-channel, n-channel.
OpAmp: Use your (Ste) universal OpAmp model, already integrated into the OpAmp symbol.
This library set is then not meant to support creating a PCB (no footprints etc.), but serves as a starter set for people entering simulation. Probably this might be an extension of the already existing âSpice_Simulationâ library, clearly stating that these are generic symbols for generic simulation.
I think this is a great idea, if itâs possible to do. Do KiCad symbols have a field that can add custom SPICE statements to the netlist? I thought they could only reference external text filesâŠmaybe Iâm wrong?
The default models work decent for D and BJT. However, I know MOS default sucks and never gets you anywhere close to your expected result. Maybe that might require a few model params added, or maybe make it a VDMOS (with a 2V-ish threshold) since thatâs what most people use for discrete parts anyway??? I have near-zero experience with JFETs, so I donât know if those have the same problem.
Maybe you are right. Then letâs place all models into a single file and ask the user to download it and place it into ?? (his project folder, the folder where *.sch resides?). We then would have a little more freedom to offer suitable model parameters eg. for MOS, VDMOS and the others.
I would like to see a (small) library of âspice compatible modelsâ in KiCad that work out of the box and are especially targeted at beginners, and the components they use.
For transistors, that is without doubt the BC547 and BC557 for European users, I think the 2n2222 is the âusual starterâ transistor for North Americans.
NE555
Opamps: The usual suspects:
LM741, LM324, TL071
The most important thing is that itâs included in KiCad itself, and guaranteed to work without twiddling. (A separate package which is easily installable is also acceptable)
The problem for beginners is always the chicken and Egg problem. Is there some problem with the models, or does the circuit itself not work at all?
Licensing of spice models is a problematic issue.
The opamp in the sallen key demo:
/usr/share/kicad/demos/simulation/sallen_key/
has a link for a license but that link is dead.
and if you take that literally you are violating the copyright if you read that text.
I have been browsing through random spice models in search of licencing information, but Edsel is hitting hard today.
I have seen licencing info, especially in very old models which state something along the lines of:
This model is free to use and distribute as long as you do not sell it.
For me, the added complexity for searching for spice models, not really understanding whatâs in them and uncertainty about whether they work is such a big hurdle that Iâm more inclined to go back to a breadboard than to spend more time in trying to understand the spice thing.