Subcircuit for LM7805

Hello, I am trying to simulate this circuit
If someone can help me find the subcircuit model for 7805 or even the internal circuitry of LM7805 with exact values of internal components used, so I can create the subcircuit myself, that’s be really helpful.

Seed a search engine with “LM7805 SPICE”. I believe there are several models available based on a transistor-level approach, and many more using macromodel techniques.


LTspice has an LM78XX schematic in its educational examples folder. I pasted a screenshot for you in case you don’t have LTspice installed on your machine (although I highly recommend that you do). The feedback resistor Rx is what determines the output voltage, so 905 for 5V. You should be able to export that schematic’s netlist into a subcircuit and create a .LIB if you like.

Thank you so so much, I did manage to create the subcircuit but the output was 4v, now i can debug that and fix it

A huge source of models (as of early 2000) is here: Somewhere inside there are also models for 78xx and 79xx. Mostly of industrial origin, so hopefully with adequate quality.


Thank you very much, I can replicate a lot of subcircuits now :smiley:

Thanks @holger for the link. I am trying to use (in particular circuit ua7812)

However I get this error:

Original line no.: 0, new internal line no.: 311:
; sign expected.
Original line no.: 0, new internal line no.: 234:
Undefined number [r1_value]
Original line no.: 0, new internal line no.: 234:
Cannot compute substitute
Copies=129 Evals=1230 Placeholders=4 Symbols=8 Errors=3
Numparam expansion errors: Problem with input file.
Error: ngspice.dll cannot recover and awaits to be detached
** ngspice-31+ shared library
** Creation Date: Sat Nov 30 21:47:03 UTC 2019

@saurabh_bansode did you have to tweak the file to make it work?

Thanks in advance.

I noticed that this gets solved if one removes the ‘comma’ in the line:

+ Av_feedback=694, R1_Value=2448

In the future, maybe ngspice could autodetect if commas are used instead of spaces as delimiters?


New error:

s.xu2.x1.sbg xu2.x1.100 xu2.x1.101 /24v 0 sbg1 
Unable to find definition of model sbg1 - default assumed

even if there is the definition:

.MODEL Sbg1 VSWITCH (Ron=1 Roff=1MEG Von=3.7 Voff=3)

Any ideas? Thanks.

Indeed the PSPICE manual does allow space delimiter and comma delimiter. So ngspice in PSPICE compatibility mode should allow both. I will take care.

Did you enable PSPICE compatibility mode? See

Thanks, the ‘SBG1 not found’ issue was solved by enabling the PSPICE compatibility mode as you suggested.

Thanks for the excellent support and for taking care about the comma delimiters in future versions.

Comma issue fixed now by holger in branch pre-master, see

1 Like