I am trying to simulate a simple linear regulator using gschem and ngspice. However, my output voltage varies by over a volt as my input voltage goes from 10V to 20V. Can I reduce this swing in the output voltage by changing circuit parameters or is this a characteristic of linear regulators?

My circuit looks like this:

Circuit diagram

And the netlist that gets generated (witl the comments and models stripped out) is this:

V1 Vin 0 16.8
C2 0 Vout .1uF  
C1 2 0 1000uF  
D1 2 0 1N4004 
R5 q1base 0 1k  
R4 q1base 3 5k  
R3 Vout 3 1k  
R1 q2base Vin 2k  
Q1 q2base q1base 2 2N4401 
Q2 Vin q2base 1 2N4401 
Q3 Vin 1 Vout TIP29 

When I perform a dc sweep on v1 by doing dc v1 5 25 .1 my output is as follows:

Simulation results

  • \$\begingroup\$ What is the intended output voltage? \$\endgroup\$ Oct 25, 2014 at 0:35
  • \$\begingroup\$ R4 will ultimately be a potentiometer which allows for a variable output voltage between 2 and 12 volts. I realize I will have to change the R3 and R5 to access the full range, but I wanted to do a quick simulation to see if the design was correct. Right now the output voltage should be about 8V. \$\endgroup\$ Oct 25, 2014 at 0:49

2 Answers 2


That's about what I would expect. You don't have a very good circuit there, that's the problem.

The only voltage reference is the series combination of the 1N4004 and the B-E junction of Q1. For an input voltage change from 10V to 20V, the current through those parts will change roughly an order of magnitude, so a 10%-ish change in output voltage is to be expected.

You could get somewhat better performance by replacing the 1N4004 with a green LED (however the output will no longer go down to 2V). You could also bootstrap some current from the regulated output to reduce the percentage change in the current. It will still be quite temperature sensitive (approximately PTAT, so it will change hundreds of mV for a 10°C change in temperature with 8V nominal out).

The best way would be to use a better reference such as an LM431 (which contains a band-gap reference and also has sufficient gain to replace the transistor). The minimum output voltage with this configuration is Vref, which is nominally 1.2495V. You do need to ensure 1mA (minimum) gets to the TL431 with minimum input voltage.

enter image description here

  • \$\begingroup\$ This is for a uni lab so all I've got to work with is the small bag of parts which they provided us, hence using a rectifier diode as a voltage reference. I didn't even consider using an LED. I would use a Zener instead to reduce the temperature sensitivity a bit, but the specs say the regulator needs to be able to output down to 2V. If I actually build this, I'll definitely use a voltage reference or replace the whole circuit with an LM317. Thanks! \$\endgroup\$ Oct 25, 2014 at 21:41

Speaking in terms of control theory it is the LOOP GAIN which is too low for good regulation characteristics. In many good working systems we have an opamp (without internal feedback) as part of the control loop (instead of a single transistor). It is a well known fact that a large loop gain is required to keep the error signal (difference between input and feedback signal) at a low value.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.