Anth's Computer Cave Projects

Build a 5 amp portable power supply with an LM338 regulator

A variable power supply. Picture: Anthony Hartup

For this week's project I have built a 5 amp variable voltage regulator using an LM338 serial regulator. I am building two of these, with one slotting into my main power station, the PowerStation2. The other one I am using to create a portable power station for my desk.

A 5 Amp voltage regulator. Picture: Anthony Hartup
A 5 Amp voltage regulator. Picture: Anthony Hartup.

You can see the whole regulating circuit above. It is built with a mixture of new and salvaged parts and cost about $2.

I have added some extra screw-terminals to allow me to swap out some of the external components without soldering, making it easy to move the board between the various power stations I may use.



Picture: Anthony Hartup

To build an LM338 circuit we obviously need an LM338 regulator. These are a drum-type IC with two pins underneath. The body of the regulator is the power out.

These regulators are rated to 5 amps with a heat sink. They can work with high input voltages, with the main limitation being that your input power must be no more than 35V higher than your desired output voltage.

A heat sink

Picture: Anthony Hartup
A modified television heat sink for an LM338 regulator. Picture: Anthony Hartup.

You could use these regulators without a heat sink if you stay under a couple of amps, but you will need one for anything higher than that.

I built mine from a heat sink salvaged from an old television. I cut away enough to leave room on the PCB for the other components and drilled holes for the LM338. Then I attached the PCB to the heat sink with super glue.

Picture: Anthony Hartup
A reclaimed heat sink from a television (left) and a thermal pad from an old laptop (right).

I reclaimed the thermal pad from an old laptop CPU. This electrically insulates the heat sink from the live LM338, and also aids heat-transfer.


To adjust the voltage on your regulator you'll need to use a 5K variable resistor or potentiometer connected as R2 for the circuit. I have used cheap .5W potentiometers in the past but I chose a 2W unit (pictured below-left) for this more-powerful regulator circuit. It has 10 turns, allowing for minute voltage adjustments. At $4, this was by far the most expensive component in the entire build.

Picture: Anthony Hartup

Resistor, diodes and capacitors

You'll need a 120 Ohm 1W resistor for R1, and two 1N4002 diodes for D1 and D2.

You'll also need three capacitors. The standard seems to be a 47uF, a 10uF and a 0.1uF, but I like to go overboard.

I am using a 1000uF for C3, a 47uF for C2 and a 0.2uF for C1 (pictured below).

Picture: Anthony Hartup

12V power rail

To drive the fan and power the LCD voltmeter you need to provide 12V regardless of your input or output voltage.

To achieve this we use a 7812ct fixed-voltage regulator.

Picture: Anthony Hartup
A 7812ct fix-voltage serial regulator. Picture: Anthony Hartup.

This connects directly to the input power, Vin, and supplies a constant 12V.

Click here for a guide on using 78XXct regulators.

AC/DC transformer.

You could build your own AC to DC rectifying circuit if you wished, but I have so many old power bricks in the cave I thought I would use one of those.

Picture: Anthony Hartup
The casing for the power station with an 18.8V power brick. Picture: Anthony Hartup.

On my portable unit I am using an old Compaq power brick that pushes 18.8V at 3.5 amp. This should output 1.5V to 17.3V through my regulator and provide about 5 amps at 12V. That is more than enough to have on my desk.

I will be using a 24V, 5 amp input for the other regulator on the PowerStation2, which will give me an output between 1.5V and 22.5V.

Voltmeter and spring-terminals

The voltmeter cost $1.50 on Ebay. It can measure up to 100V but must be powered by between 3.3V and 30V. Therefore the power wire connects to the fixed 12V rail, while the measure wire connects to the Vout. This way the LCD will still function when measuring less than 3.3V.

The spring-terminals for the output came from an old television. They can hold tiny wires, but they also open far enough to hold multimeter probes. I prefer these plugs over banana plugs, they are much easier to use.

PCB board and terminals

I am using a 70mm*50mm PCB board that cost about 14 cents. The screw terminals cost 10 cents each.

Picture: Anthony Hartup <
The terminal-block layout for the regulator board. Picture: Anthony Hartup.

You'll notice I have a couple of extra terminals on the board. I want the potentiometer, fan and voltmeter to be replaceable without soldering.

The circuit

Below is the full circuit-diagram for an LM338 power station. I have created this diagram with the soon-to-be-released version 0.2 of CircuitDraw. Right-click the image and select "view image" to zoom.

Picture: Anthony Hartup
The full circuit diagram. Picture: Anthony Hartup.

Let's look at it in a bit more detail.

An LM338 IC has two pins. There is a power in, or Vin, that your input power connects with. The second pin is the adjust pin. The power out, or Vout, is the entire casing. This is why I used an insulated sheet between the LM338 and the heat sink. Without that layer the whole heat sink would be live as well.

Picture: Anthony Hartup

The pins are slightly towards one end of the casing. The image above is the bottom of the casing with the pins pointing to you. Place the LM338 on the heat sink and screw it down. If you are using an isolation layer between the LM338 and the heat sink you'll need to use plastic grommets around the screws. These ensure the screws do not touch the metal casing.

Picture: Anthony Hartup
The regulator and heat sink with isolating grommets and a non-conductive thermal layer. Picture: Anthony Hartup.

Once you have everything fastened, grab a multimeter and check for continuity between the casing and the heat sink. There should be no reading. Also check for continuity between the heat sink and either of the pins. If you get no reading you know you have completely isolated the LM338 and its pins from the heat sink, and you are ready to begin adding the other components.

Building an Lm338 regulating circuit can be as simple as adding two resistors like the diagram below

Picture: Anthony Hartup

Vout (the casing) connects directly to the Vout terminal on the PCB, but it also connects to the adjust pin through the R1 resistor.

The adjust pin then runs through the variable resistor, R2, to GND. By adjusting the resistance of R2, you adjust the output voltage.

This simple circuit will function, but it may not provide clean power. To solve this we add three capacitors to smooth things out. Then, to protect the LM338 from spikes when switching heavy loads we need some flyback diodes.

Picture: Anthony Hartup

I mentioned earlier that I have used my own values for the capacitors. I have used what I believe are the correct diodes. The LM338 data sheet shows 1N4002 diodes, but I have seen a few examples with these replaced by the 1N4004. I went with 1N4004s but Bill has since pointed out in the comments that 1n4002 would have been more than enough.

Now, back to the full circuit.

Picture: Anthony Hartup
The full circuit diagram. Picture: Anthony Hartup.

You can see there are a lot of connections to and from the casing of the regulator, and the junction after R1 (the top potentiometer terminal).

To keep things semi-tidy I connected just one wire to the casing and dropped it down into a central part of the PCB. I then routed everything to and from that central point.

Picture: Anthony Hartup
The central wiring hub for the circuit. Picture: Anthony Hartup.

I have utilized the long shanks on the diodes and resistor to reach this central hub regardless of their positioning.

I was surprised how much thought I had to put in to the actual physical layout of the board design. I spend so much time focused on the electrical side of a design, but it is an entirely different craft actually deciding where all the components will fit. It's a bit like Tetris, really, but with polarity thrown in.

I think this layout looks tidy enough, although I should have moved the potentiometer terminal over to the edge of the board to free up space around the central hub area.

Now the circuit is finished it is time for the enclosure.

Picture: Anthony Hartup

I have just taped the power brick in for because I may want to swap it out for something with higher voltage. I used a few plastic clips to hold the PCB in place then wired it all together.

Picture: Anthony Hartup

Here is my compact, but powerful power station. It cost me exactly $7.50 and I learnt a few things along the way.

Recycled parts

I had to buy a few items for this project, but look at what we have saved from land fill.

There is the casing and timber bottom, as well as all wiring. There is also the power brick and cable.

The heat sink, capacitors, 7812ct regulator, and the output spring clips were all salvaged from disused CRT televisions.

There are some carbon credits to power this thing for a while.


I'll build the second regulator next for the PowerStation2 and once it's installed I'll update the PowerStation2 article. That monster is staring to look like the space station.





Leave a comment on this article

About the Author

Anthony Hartup, creator of AAIMI, Estimcad and Anth's Computer Cave.
Anthony Hartup runs the AAIMI Project, a Python machine-interface platform.
He also codes for the Estimcad Project and ControlCadGUI.

Search the Cave with AaimiClip