I want to use the simulation function with KiCad 6

I want to draw a circuit diagram with KiCad6 and simulate it with the attached simulator, but it doesn’t work. I used all LTSpice Model parts of the circuit diagram drawn with KiCad6.
The material linked below is the schematic, simulation settings and simulation results. I want the V (OUTPUT) output waveform to be twice the peak-to-peak of the sine wave of the V (IN) input waveform, but it is only a straight line. Can anyone please tell me the solution? Thank you.

Did you attach suitable spice models to your device symbols, as described in KiCad Eeschema as GUI for ngspice, tutorial for setting up the simulation ? And don’t forget the diodes, and check if an alternate node sequence is required for each device (also the diodes).

If you have done that, and still there are simulation problems, please zip and post the complete project, including all models and publish it here or in your cloud. It is unfortunately not possible to get any idea for a bug without looking at the details.

1 Like

thank you for your reply.
Sorry for the late reply.
I’ll look it up now.
Please wait.

The KiCAD standard component library for Eeschema does not contain spice models.
You need to do the following:
1: make a custom library with the semiconductor parts used in your project. I usually store this library together with the project, but you can put it where you like.
2: add the spice models to the parts (you’ll typically need to download them from the supplier). Check for “alternate node sequence” problems. Spice needs C-B-E for BJTs, A-C for diodes for instance.
3: Leave the passives and sources, they have OK spice models already.
4: you’ll need a “0” reference for simulation. It’s in the “pspice” library. This is like the ground clip on your oscilloscope.

Now you’re started. Plenty of pitfalls still ahead, though.

PS: never forget to run a DRC first. It tells you a lot before simulating and helps weed out problems.

1 Like

The SPICE model of the transistor is fixed to pin 1: C, pin 2: B, and pin 3: E. Since the pin arrangement of the transistor symbol of KiCad is matched to the product, 2SC1815 is an ECB arrangement. However, the SPICE model of 2SC1815 is a CBE array and this cannot be changed … Therefore, it is necessary to devise to convert the ECB array to a CBE array, but check the alternative node sequence of the SPICE model and put a numerical value in the text box. I don’t know what kind of number to enter.
Would you please let me know?
By the way, I also attached a compressed file of the entire project including all models.
https://drive.google.com/file/d/1p2Cb0tc-uM6-4nBXf2Duf1ALk9V8ntF7/view?usp=sharing

Unfortunately you did not. There is only a single file in this zip folder.

ngspice (as any other spice) requires the node sequence C B E for its discrete bipolar transistors.
Look at this
Clipboard02
Use the pin numbers from your symbol in the alternate node sequence, and order them in the required sequence C B E.
So the alternate node sequence is 2 3 1.

1 Like

Thank you.
It’s “2 3 1”.
By the way, I tried the alternative sequence with “2 3 1”, but the output waveform of this circuit is 0V.
I doubt that the diode also needs an alternative sequence. Also, are there any mistakes in the j-fet settings? Also, I don’t think this has anything to do with it, but the pnp pipolar is “2 3 1”, but the npn bipolar is also “2 3 1”, isn’t it? I would appreciate it if you could reply. I will send you the zip file again soon.

Once again, attach the compressed file for the entire project, including all models.
KiCad.zip (951.0 KB)

NPN or PNP doesn’t matter, the only thing that matters is the pin sequence. “2 3 1” is correct.
DRC checks OK.
The JFET doesn’t have a spice model. Spice pin sequence is D G S.
And you’re missing the “0” reference.

1 Like

Thank you for your reply.
Was it okay to fill in the alternative sequence with “231”? Or is “2 3 1” better? Also, what is a “0” reference?
Perhaps it means adding a “0V” symbol to the ground?

So, what would 231 mean for a 300-pin device? Bad idea, no?
Of course it should be 2 3 1.
“0”? I’ve already explained this two times. It’s a special ground voltage reference designator for simulating and it’s found in the “pspice” library. It sets the zero reference for the simulator voltage display, and can be placed anywhere in your circuit.
Also, you’ll need to look at alternate sequence for your 1N4007s. As of now, the pinout is wrong.
And do you really want to simulate at 2 Hz?
Here’s the “0” symbol in your schematic:

1 Like

Indeed ngspice will be happy with GND as well, because it is translated to 0 internally.

1 Like

That’s true sometimes, but does not give you the flexibility of placing 0 where ever you want in a simulation. I used the analogy of the 'scope ground clip earlier, and that’s extremely useful.
Especially in AC circuits, you do not have a “GND” and ngspice has no reference.

1 Like

Thank you for politely teaching me.

Thank you.
I will study a lot.
If you didn’t tell me, I wouldn’t understand.

yes. For now, it really doesn’t matter whether it’s 2Hz or 1KHz. All we need is to see the voltage waveform be twice the amplitude of the input voltage waveform.
The alternative sequence for 1N4007 is also wrong, isn’t it?
Then the answer is only “2 1”.
I’ll fix the circuit now and report it later.
Thank you.

holger and ML9104.
thank you for helping me.
The simulation went well.
The alternative symbol for 2SA1015-Y and 2SC1815-Y was “2 3 1”.
The alternative symbol for 1N4007 was “2 1”.
Since the drain and source of “J-FET” can be reversed,
The 2SK2880D was “DGS” of “symbol” and the alternative symbol was “2 3 1” or “1 3 2”.
The “parameter” of the simulation is “transient response”
The “time response” is “1M” (1KHz seems to be good. The waveform becomes dull at 2Hz), the “final time” is “5”, and the “initial time” is “0”.
I will attach a figure.
Thank you everyone.
KiCadフォーラム.pptx (179.9 KB)

holger, thank you.
The simulation went well.
I am very grateful to you.

2 Likes

Hi,
Continuing this thread…
How are people organizing their simulations?
If I have a project I want to implement on PCB, but I don’t want to simulate everything at once or I don’t have models for everything, then are people creating separate New Projects in different directories for the various simulations they wish to do? I assume these New Projects are separate from the main schematic that will be implemented on PCB.

1 Like