LM317 regulator model import

Hi All,

I am having some trouble importing and using any models for an LM317 regulator. I use an existing symbol from the kicad library and map the pins to the specified model pin order, however, my simulations are not correct. Here is a picture of my circuit and trace.

I have used both a model from LTSPICE (that works in LTSPICE) and a TI model from a library downloaded from the ngspice webpage.

Any help is appreciated. Thanks

Here is the transient analysis for 10 seconds.

What is the expected simulation output?
What KiCad version are you using?
Did you check the pin correlation between your circuit diagram and the LM317 model in use (the ‘alternate node sequence’)?

I expect the output to roughly follow the ideal output for a lm317 voltage regulator. Vout = 1.25V(1+R2/R1). In our case this comes out to 9.05 V +/- some tolerance on the reference 1.25 Volt. The first few lines of the LM317.sub file are as follows…

*LM317 TI voltage regulator - pin order: In, Adj, Out
*TI adjustable voltage regulator pkg:TO-3
.SUBCKT LM317 1 2 3 Changes my be required on this line
J1 1 3 4 JN
Q2 5 5 6 QPL .1
Q3 5 8 9 QNL .2

I set the alternate node sequence in kicad to 3,1,2 in my based on the schematic I used. I did use the same model in LTSPICE and the results are what I expected, so I am not really sure what the problem is.

Could you post the resulting ngspice netlist here?

My (ngspice) netlist:

LM317 simulation
* https://www.mikrocontroller.net/attachment/434357/LM317.lib
*.include LM317.lib

* https://www.ti.com/lit/zip/slvmc40
.include LM317_TRANS.LIB

*X317 IN ADJ OUT_0 LM317

V1 IN 0 15
R1 OUT_0 ADJ 240
R2 ADJ 0 1.5k

dc V1 0 15 0.1
set xbrushwidth = 3
plot v(OUT_0) v(ADJ)


My results:

1 Like

Hey, Holger thanks for the help. My symbol value didn’t match my spice value. A bit new with kicad/spice. Always inspect the netlist closely!

1 Like