Saturday, June 12, 2021

0000 0000 0110 0101

LM338 (PSU III)

The next phase of the PSU project sees me kicking out the LM7805 as the linear voltage regulator component and swapping in the LM338, for the following reasons.

1. The LM7805 is maxes out at 1.5A whereas the LM338 is rated to 5A (peaking at 7A)

2. My LM7805 stock seems a little shonky

3. I've used the LM338's cousin the LM317 quite a bit and I like the family

The LM338 regulates voltage according to this circuit from the datasheet: 

I have a billion different resistor values and was a bit concerned about choosing values which gave a Vout close to the target voltage. To ease my mind I coded a quick program in Python as follows:

from array import *

print("LM338 calculator")
Vout = float(input("Voltage out: "))
accuracy = float(input("Percentage accuracy? "))

ratio = Vout/1.25-1
accuracy = accuracy/100*ratio

r1 = array('f',[1, 1.5, 2.2, 2.7, 3.3, 3.9, 4.7, 5.1, 6.2, \
                6.8, 7.5, 8.2, 10, 12, 15, 18, 20, 22, 24, \
                27, 30, 33, 36, 39, 43, 51, 47, 56, 62, 68, \
                75, 82, 91, 100, 120, 150, 180, 200, 220, \
                240, 270, 300, 330, 360, 390, 430, 470, \
                510, 560, 620, 680, 750, 820, 910, 1000, \
                1200, 1500, 1800, 2000, 2200, 2400, 2700, \
                3000, 3300, 3900, 4300, 5100, 6200, 7500, \
                9100, 12000, 18000, 22000, 27000, 33000, \
                39000, 75000, 82000, 56000, 62000, 3600, \
                4700, 5600, 6800, 8200, 10000, 15000, \
                20000, 24000, 30000, 36000, 43000, 47000, \
                51000, 68000, 91000, 100000, 120000, \
                150000, 180000, 200000, 220000, 240000, \
                270000, 300000, 330000, 360000, 390000, \
                430000, 470000, 510000, 560000, 620000, \
                680000, 750000, 820000, 910000, 1000000])

r2 = array('f',[1, 1.5, 2.2, 2.7, 3.3, 3.9, 4.7, 5.1, 6.2, \
                6.8, 7.5, 8.2, 10, 12, 15, 18, 20, 22, 24, \
                27, 30, 33, 36, 39, 43, 51, 47, 56, 62, 68, \
                75, 82, 91, 100, 120, 150, 180, 200, 220, \
                240, 270, 300, 330, 360, 390, 430, 470, \
                510, 560, 620, 680, 750, 820, 910, 1000, \
                1200, 1500, 1800, 2000, 2200, 2400, 2700, \
                3000, 3300, 3900, 4300, 5100, 6200, 7500, \
                9100, 12000, 18000, 22000, 27000, 33000, \
                39000, 75000, 82000, 56000, 62000, 3600, \
                4700, 5600, 6800, 8200, 10000, 15000, \
                20000, 24000, 30000, 36000, 43000, 47000, \
                51000, 68000, 91000, 100000, 120000, \
                150000, 180000, 200000, 220000, 240000, \
                270000, 300000, 330000, 360000, 390000, \
                430000, 470000, 510000, 560000, 620000, \
                680000, 750000, 820000, 910000, 1000000])
for i in r1: for j in r2: if (j>i): division = j/i if (abs(division-ratio)<accuracy): print(round(j,1),"divided by",round(i,1), \ "gives", round(1.25*(1+j/i),2)," volts")


So for instance if I were to seek 9V from this list of possible resistor ratios to within an accuracy of 0.5% the output is as follows:

LM338 calculator
Voltage out: 9
Percentage accuracy? 0.5
6.2 divided by 1.0 gives 9.0 volts
51.0 divided by 8.2 gives 9.02 volts
62.0 divided by 10.0 gives 9.0 volts
510.0 divided by 82.0 gives 9.02 volts
620.0 divided by 100.0 gives 9.0 volts
5100.0 divided by 820.0 gives 9.02 volts
6200.0 divided by 1000.0 gives 9.0 volts
510000.0 divided by 82000.0 gives 9.02 volts
51000.0 divided by 8200.0 gives 9.02 volts
62000.0 divided by 10000.0 gives 9.0 volts
620000.0 divided by 100000.0 gives 9.0 volts

Which means I might choose 620k for R2 and 100k for R1. So I set up two LM388's fed from the buck/boost converter to test the ratios, the circuit and also the indicator LEDs before committing to a 3D print run.

The unusually weird problem with this whole project has been the "tripping" of the power once the current creeps much above about 125mA. It was so frustrating that I swapped out nearly every component excepting the obvious one ...



No comments:

Post a Comment