Help Tweaking LTSpice Linear Regulator for KiCad Simulation (LR8)

Howdy! I ran across the LR8 linear regulator and noticed it can handle a 250V transformer, current limit around 10mA (1-2mA Vacuum Tube Anode current) and has around 60db ripple rejection at 120hz (1/1000 reduction?). I’d like to test it in my amp power supply by sticking it between my reservoir cap and my filter cap for my pre-amp to compare it to a stack of RC filters.

I found a link with a .subckt text file for the LR8 that was pulled from an LTspice forum but after attempting to use the SPICE model with the lr8 symbol baked into kicad I’m getting errors for the “load” statement on the I1 line, and if deleted, an error for the Rser=350k parameter on the C2 line. This leads me to believe I need to make some changes to get this to work with the NGspice simulator in kicad but googling these generic parameters is not leading me anywhere, as you can imagine searching “load spice parameter” brings up half the internet. I’ve attached my own schematic as well as the LTspice txt file I found online and would appreciate if someone could guide me in the right direction.


LR8 (3).txt (712 Bytes)
nnn.kicad_sch (70.1 KB)

To reproduce your example, the transformer model is needed as well.

Sorry, Here you go!
symbols.7z (980 Bytes)
BasicTransformer.sub (120 Bytes)

The “load” option for a current source is not available in ngspice.

I am sure that it can be emulated by a suitable B-Source. I have to think about it.

From the LTspice manual:

This circuit element sources a constant current between nodes n+ and n-. If the source is flagged as a load, the source is forced to be dissipative, that is, the current goes to zero if the voltage between nodes n+ and n- goes to zero. If a negative current is specified, the load keyword is ignored. The purpose of this option is to model a current load on a power supply that doesn’t draw current if the output voltage is zero. When flagged as a load, the current source starts to deviate from a constant current when the voltage across it drops to 0.5V. The impedance eventually drops to a resistance equal to .25Ω/amp times the value of the current source.

RSER neeeds to be replaced by a resistor in series to C2.

I think I’m a bit confused, aren’t S1-C2 all “virtual” components that make up the LR8 IC that don’t actually reference components i’ve placed in my kicad schematic? A bit confused on how I can interact with these individual components inside the IC via placing components on my kicad schematic EDIT: I’m looking more at it and realize you just assign behaviors to the pins, not map out the circuit

I deleted the entire I1 line and the Rser, and am now getting a time step error but looks like the pins are getting parsed so does that tell me the error now lies somewhere else in the schematic?
LR8 (no Rser, no i1 load).txt (682 Bytes)

I am talking about the model for the LR8. It is a subcircuit, starting with .subckt, ending by .ends, containing valid spice elements and being available in file lr8.txt. Some element options (load, RSER, VSer, oneway) are typical for LTspice, and not (yet) available in ngspice. This has nothing to do with the elements you have placed into your circuit. If you simply delete the lines in the model containing the options, the model may be loaded and parsed, but it will not function correctly. So the non-compatible elements in the model have to be replaced by compatible ones.

1 Like

Ah this makes sense, thanks for explaining! I’m trying to brute force learning EE on my own with very little background so I may need to switch to an EDA that will work with LTspice just to get it working until I get a chance to read up on spice syntax as my own knowledge is currently very limited. I’m a visual learner so Spice seems incredibly overwhelming when I don’t have components I can visualize and easily adjust values on to see the outcome

Attached you will find some tiny projects using the LR8.

I have made an ngspice-compatible model for the LR8, with voltage regulation, internal 10u current source and output current limit 20 mA (according to the data sheet). The node sequence is as found in the symbol, so no pin assignment required. See file LR8ng.lib.

I have also modified the transformer model, adding a small series resistance to each coil. This is necessary as you put a voltage source directly onto the (input) coil, and it makes the transformer a bit more realistic.

LR8.7z (15.5 KB)

1 Like

Hey sorry, Have had a busy workweek and just got around to seeing this. Thanks for taking the time to do that, I’ll definitely mess around with it! Thanks!

This topic was automatically closed after 90 days. New replies are no longer allowed.