Shottky Diodes in Kicad Sim

Hi

I’ve been playing around with moving a simple transistor current limiter simulation from LTspice to Kicad Ngspice but I’ve been having some trouble. The issue is primarily with the simulation of Schottky Diode models.

To start with I’m using the latest stable v5 kicad. I’ve replaced ngspice 26 with 28 BUT I had the same issue with 26 and I’m on windows 10. The models I’m using are pspice models so I’m using a spice.rc with:

* user provided init file
set ngbehavior=ps

The following top image is the ltspice version of the circuit, D6 is included as a reference to understand how the simulation deals with the diode. If I measure the voltage drop across D6 and D4 in LTSpice I get the plot to the right of the LTSpice circuit. D4 is blue, D6 is green. These voltages are as expected from the datasheet for the 1n5817 schottky diode.

The bottom image is the kicad version of the same circuit and to the right of it the simulation results of the voltages across the same diodes. The plot of the voltages across D2 (which corresponds to D6 above) and D3 (D4 above).

The results are strikingly different the kicad/ngspice not matching the datasheet of the 1n5817

The following is the spice model of the schottky diode:

*******************************************************************
* Model name       : 1N5817
* Description      : Low Drop Power Schottky Diode
* Package type     : DO-41
*******************************************************************
.MODEL 1N5817 D IS=698.22E-9 N=1.0015 RS=35.457E-3 IKF=6.0924 CJO=345.48E-12
+ M=.45399 VJ=.3905 ISR=2.0219E-6 NR=4.9950 EG=.69 XTI=2 TT=0 FC=0.5
*$

I should also say that the current limiter gives the expected results in kicad/ngspice in the standard configuration that is without the schottky diode below the sense resistor but I’m interested in temperature compensation of the limiter so that doesn’t help.

I’m sure this comes down to the fact that I’m completely new to ngspice so I’m sorry if the solution is obvious!!!

Unfortunately I’m a new user here so I can’t upload a zip of the project and I had to make one large image from four images so please excuse if the post is hard to follow.

I just noticed my forum restrictions were lifted so here is a zip of the project.

spice_test.zip (27.3 KB)

I have found the issue. It is because the pinout of the kicad lib doesn’t match the way spice uses the model. For anyone reading this post please see the following:

3 Likes