Date

I've been playing with the electronic circuit genetic algorithm design program. I have tried to make some stable bandgap voltage references, so far results have been promising, but not very good. None of the resulting circuits could be used in a production, except if you don't care much about the temperature stability.

One circuit that seemed good when it was evolved was this one(No circuit diagram because I'm lazy):

```.model 2N3906  PNP(Is=455.9E-18 Xti=3 Eg=1.11 Vaf=33.6 Bf=204.7 Ise=7.558f
+               Ne=1.536 Ikf=.3287 Nk=.9957 Xtb=1.5 Var=100 Br=3.72
+               Isc=529.3E-18 Nc=15.51 Ikr=11.1 Rc=.8508 Cjc=10.13p Mjc=.6993
+               Vjc=1.006 Fc=.5 Cje=10.39p Mje=.6931 Vje=.9937 Tr=10n Tf=181.2p
+               Itf=4.881m Xtf=.7939 Vtf=10 Rb=10)
.model 2N3904   NPN(Is=6.734f Xti=3 Eg=1.11 Vaf=74.03 Bf=416.4 Ne=1.259
+               Ise=6.734f Ikf=66.78m Xtb=1.5 Br=.7371 Nc=2 Isc=0 Ikr=0 Rc=1
+               Cjc=3.638p Mjc=.3085 Vjc=.75 Fc=.5 Cje=4.493p Mje=.2593 Vje=.75
+               Tr=239.5n Tf=301.2p Itf=.4 Vtf=4 Xtf=2 Rb=10)
Vin n1 0
rload n2 0 100k
R39826856 n4 n11 1709.1717943
R52792856 n2 n10 2507.84316862
Q155540048 n0 n11 n5 2N3906
Q21597538600 n8 n3 n10 2N3904
R51398488 n0 n11 25282.9648097
R52736296 n10 n2 3272.12493658
R58783432 n7 n5 23812.5332944
R52713520 n4 n6 116372.392136
Q168167800 n1 n6 n3 2N3906
R57551328 n10 n3 821383.334394
Q158216032 n10 0 n10 2N3906
Q259752248 n2 n5 n1 2N3904
Q170112896 n10 n7 n2 2N3906
Q279097800 n3 n7 n11 2N3904
Q21325009232 0 n8 n4 2N3904
R39671064 n6 n11 30496.553302
R47819448 n1 n0 22223.2407018
R42659568 n1 n0 401.01058083
```

When input is swept from 4V to 10V, with step of 0.1V. This is the output voltage: Spice command: dc Vin 4 10 0.1

Looks good, but when output is swept from 0V to 10V this is the result: Spice command: dc Vin 0 10 0.1

Note the y-axis values. After changing only the range of the simulation spice returns completely different results for the whole range. I investigated this a little and when the DC sweep starting value is lower than 3.8441V spice returns the almost zero output value. If starting value is 3.8442V this is the output: Spice command: dc Vin 3.8442 11 0.1

For the starting values 3.8443V and higher spice returns same results as in the first picture. I don't know which output is really correct and I don't really care that much as the circuit wasn't that good anyway, but if you decide to build this circuit let me know the results.

# New bandgap voltage reference

For the next simulation I changed evolution's goals to avoid spice bugs. I varied the dc sweep starting and ending values a small amount for every spice simulation. I also learned from my last post and added input current measurements, more measurements with different load resistances and measurements with different temperatures. I also changed goals so that I didn't check what value output voltage was, but only scored circuits for the stability of the output voltage and let the evolution to decide what is a easy to build voltage reference, but because permanent 0V on the output would also be stable I added a check that output voltage is higher than 1V. I also added a transient simulation that simulates a circuits response to 10V step in input voltage. Transient response isn't that important, but its reason is avoiding bugs. Transient simulation is harder than dc sweep and if spice doesn't know how to simulate a transient response it sure doesn't know to simulate the dc sweep. And if you're wondering why these changes aren't in the github, it's because I just hard coded everything and it can't be currently used to simulate anything else. I will be adding these changes too, but I need to make sure first that the program still works.

I decided to abort the simulation after 30 minutes to avoid overfitting and because the resulting simulations looked good. Generation 50. Schematic as the program designed it. Output is on the collector of Q3 Unnecessary parts removed. I later realized that R3 can also be removed. R2 is the load resistor Previous circuit redrawn and R3 removed. Labels changed.

Simulation results, output voltage is 1.4V, which is about 2*Vbe of a bjt transistor.      Rload stepped from 1k to 10k with 1k step. Output begins to fall if load is less than 1k. Zoomed view of previous plot

The simulations look very promising, especially the constant voltage despite the load resistance, which I had problems with last time. Input current is also small and transistors should not break. Because the simulations looked so good I decided to build this circuit and test it's output.

## Built with real components: I changed the 800 Ohm resistors to 1k Ohms because I didn't have 800 Ohms resistors. Load resistor is 10k Ohms Measured output: 1.362V at room temperature(20° C) when powered from 9V battery, Spice simulated 1.42V.

I measured the temperature coefficient by placing the circuit in the freezer for few hours. Measured output: 1.47V at about -20°C again powered from 9V battery. Taking pictures and using the multimeter same time is hard.

Temperature coefficient is about 3mV/°C, not very good as voltage reference but might be okay for some applications where temperature doesn't change that much. DC sweep, input is 0V to 10V triangle wave, 0.5V/div Zoomed, 0.2V/div, there was some DC offset in the input triangle wave so the bottom isn't actually ground

As you can see above the circuit really works as a voltage reference. I think it has a very good performance considering that it uses only three transistors, at least it's better than anything I could have designed using three transistors.

Error due to the input voltage is about 20mV/V. 10V step input response, 2µs/div, 0.5V/div

Transient behaviour is good. Output voltage rises very quickly, quicker than I can measure with my 60Mhz oscilloscope, but it falls slowly.

Output voltage was little off from the simulated value, but transient response and dc sweep looked very much like in the simulation. I tried to change some of the transistors, but it didn't change output voltage much. Overall considering that the circuit uses only three transistors and the computer made it in 30 minutes it's behaviour is good.