5A Lab Power Supply With Digital Readout

I got a used 250VA power transformer that was removed from equipment a couple of weeks ago. The transformer has a dual 10V AC output and a few auxiliary voltage outputs. The 10V winding is rated at 10A, I thought it would be perfect for a high current power supply project.

For this particular build, I used the reference design for LM338 5A adjustable linear regulator as the base. Rather than designing digitally controlled voltage adjustment circuitry (e.g. via DAC), I decided to just use the simple resistor-potentiometer voltage control mechanism and add the digital voltage/current monitoring portion. Here are some of my thoughts behind this reasoning:

  • By adding the digital voltage adjustment functionality via the three terminal regulator’s Adj pin, we would have increased the complexity of the control loop. In a power supply, the reliability of the control loop is essential to the stability of the output voltage. If the Adj pin somehow becomes floated due to circuit malfunction, the result could be disastrous as the input voltage would be applied directly to the load.
  • Also the stability and the accuracy of the external reference affect the accuracy and the ripple rejection of the power supply as well. This must be taken in to consideration when using a DAC or PWM circuitry to drive the linear regulator’s Adj pin.
  • Last but not least, since the output voltage of the linear voltage regulator would essentially be controlled by the MCU, adequate filtering and monitoring (e.g. via watchdog timer) as well as careful designing of the board layout are usually needed for the MCU circuitry to work reliably.

Given the above thoughts, I decided to keep the core circuitry as simple as possible using the reference design and using the MCU only for current and voltage measurements. That said, if you intend to build a digitally controlled power supply, you can hop over to Dave’s site. He has series of videos on how to design and build a digitally controlled power supply.

Now, I’ll discuss some of my design considerations.

The very first thing comes to my mind is the power consumption of the LM338. The TO-3 version of LM338 can dissipate around 50W heat with the proper heat sink. The TO-220 version can handle roughly half of that due to the increased thermal resistance. In either case, a single LM338 would not be able to provide 5A of continuous output current at voltages lower than 10V if the input voltage is pegged at 20 volts. In order to obtain the desired 5A current over the input voltage range and stay within the thermal envelop of LM338, the input voltage needs to be adjusted accordingly when the output voltage changes. A simple method to achieve this is to use a comparator with hysteresis to drive a relay so that the input voltage to the regulator can be switched between the two windings of the power transformer (in this case, the input voltage is switched between 10V and 20V depending on the output voltage). More switch points are also possible, but the design would be more complicated and multi-tap transformers are harder to find.

The following schematic shows the voltage selector portion of the circuit using LM339 comparator:

Input Voltage Selector

Input Voltage Selector

Using the parameters given above, the switching point is at around 7 volts with a hysteresis of 1V. When output voltage is below 7V, the 10V output from the transformer is selected and when the voltage is above 7V the 20V output from the transformer is selected. By adjusting the input voltage according to the current output voltage, the maximum power dissipation of the LM338 is significantly reduced. You can use this tool to calculate your desired trip point.

To keep the heat sink small, I employed forced-air cooling. The cooling fan is controlled by another comparator (see circuit below) and by adjusting the potentiometer, you can achieve the desired fan on/off temperature. The hysteresis is necessary so that the fan does not turn on and off constantly when the temperature is near the tripping point.

Fan Controller

Fan Controller

As mentioned earlier, the actual LM338 circuit I used is almost identical to the reference design. Some slight differences are shown in the schematic below:

LM338 Power Supply

LM338 Power Supply

To monitor the current flowing through the regulator, a shunt resistor is placed right before the LM338. By placing the shunt before the LM338, the current measured would be a few milliamps higher than actual current value flowing through the load as there is some current flowing through the voltage divider and the Adj pin. This offset can be easily removed in code though. Alternatively, a voltage follower can be used so that larger resistor values can be used in the voltage divider. But even with the use of voltage follower, there will still be some small constant current through the Adj pin.

I used MAX4375 with a gain of 50 as the current sensing amplifier. Since the maximum ADC input is limited to the 2.5V reference voltage, the maximum voltage drop across the current sensing resistor is limited to 50mV when the load current is 5A. So the value of the sensing resistor needs to be around 10 milli-Ohm. In my design, a 7 milli-Ohm shunt resistor is used so it will give enough range in an over-current situation. MAX4375 has two build in comparators which could easily be used for over-current detection. I may add such functionality later, but for now these comparators are not used.

The voltage measurement is taken via a simple resistor voltage divider, the value of the resistors are chosen so that the maximum output voltage does not exceed the voltage reference of the analog-digital converter (in this case the voltage reference of the ADC is 2.5V).

The ADC I used is an AD7706 which can be used in either buffered or unbuffered mode. In my implementation, unbuffered mode is used. One thing we need to remember is that in unbuffered mode the ADC input impedance is significantly lower than in buffered mode. This means that the the resistors used in the voltage divider need to be small enough so that the ADC input impedance does not affect the reading accuracy. As mentioned earlier, we could add a voltage follower to the resistor divider to solve the impedance matching issue. Alternatively, we could also implement the ADC in buffered mode, although the common mode input range would be more restricted.

AD7706 ADC

AD7706 ADC

AD7706 offers 16 bits of resolution and a voltage resolution of well under 1 mV and a current resolution of under 1 mA can be achieved. The accuracy depends partially on the precision of the voltage reference used. The voltage reference TL431 I used is hand-picked with a reference voltage of 2.500V. The code included later uses the AD770X library. You can see my previous blog post for more details.

The transformer I used has a 14V auxiliary winding, which is perfect for the 12V and 5V Vcc needed for the MCU, ADC and the comparator circuits. The following schematic shows the simple auxiliary 5V and 12V power supply using 7805 and 7812.

Power Transformer and Auxiliary Power Supply

Power Transformer and Auxiliary Power Supply

Finally, the ADC values from AD7706 is fed to an ATmega328P MCU via SPI and the information is then displayed on a 2×16 LCD.

MCU (ATmega328P)

MCU (ATmega328P)

The picture below shows the circuit board of the finished power supply. Everything except the power transformer fits on a perfboard easily. Since the transformer itself is quite large, I mounted it separately in an old ATX power supply case.

Power Supply 1

Power Supply 1

The power from the transformer is brought in using 12 AWG wires and are connected to the main board via disconnects. A thinner cable brings in the rectified and filtered auxiliary power. The following picture shows the power transformer enclosure and the power supply project box side by side.

Power Supply 2

Power Supply 2

Here is a picture of the finished power supply. At 1.26V, 1A, the power dissipation of the LM338 is roughly 7W. The heat sink by itself can handle the power dissipation without any issue and the fan does not come on even after prolonged use.

Power Supply 3

Power Supply 3

LM338 is actually capable of output current in excessive of 5A. The following picture shows the power supply operating at 10.4V 5.9A. In this situation (the worst case scenario) the power dissipation of LM338 is quite high, at around 60W. While this is higher than the maximum recommended power dissipation, the current output remains stable for prolonged use and I suspect the forced air cooling is able to remove much of the generated heat at a reasonable rate to prevent the regulator from thermal shutdown. But the heat sink does get pretty warm.

Power Supply 4

Power Supply 4

Finally, the code used in this project is included below for reference.

Download Source Code:

PowerSupply.tar.gz
AD770X1.1.tar.gz

Be Sociable, Share!

33 Comments

  1. Buzai Andras says:

    Hi,

    Nice power supply :). Congratulations!
    I’m in the process of building my own power supply and for the transformer tap changer circuitry I was thinking of using a very similar setup as yours (a schmitt trigger).
    But I have some concerns about this setup.
    When the output of the op-amp goes low and turns off the NPN transistor which in turn will switch the relay, there will be a small moment when the relay will not be connected to any tap (right after it disconnects from the 10V AC and before it switches to 20V AC). Wouldn’t this cause the output of the regulator to drop suddenly which in turn will cause the output of the op-amp to go high and switch back the relay to the 10V AC? Wouldn’t it oscillate? Especially when there is a load connected.

    Unfortunately I am still in the planing process so I haven’t tested this assumption (I may be totally wrong, since I am a beginner in electronics :) ). That is why I thought I’ll ask about this.

    To even further minimize the power dissipation I will switch between 3 taps using 2 relays.

    Congrats again on your power supply :)

    Best regards,

    Buzai

    • kwong says:

      Hi Buzai,

      Thanks for your comment.

      Using the relay to switch the tab will not cause the relay to oscillate.

      The reason is that the switching is at the transformer side prior to the bridge and the filter cap. The filter cap stores enough energy to last tens of milliseconds during the relay switching (which typically is less than 10ms). Since the output is regulated, while the cap is discharging the input voltage drops but the output voltage stays relatively flat during this period.

      • Buzai Andras says:

        Thank you for your response :).
        One more thing: do you use any inrush current limiting to lower the stress on the transformer and the rectifier bridge when the filtering capacitor charges for the first time?
        I was thinking to implement an inrush current limiter in my power supply but I am not sure that it is really needed.

        Best regards,

        Buzai

        • kwong says:

          You are welcome.

          As long as you have a bridge rectifier that is capable of handling your maximum current load (e.g. a 20A rectifier), the inrush current should not be of any problem as these kind of diodes can handle at least 50 times of the rated current in a short period of time (e.g. under 10ms). This value is typically indicated as maximum overload surge current.

          Given the internal resistance of the transformer, it is very unlikely that you would hit these maximum values even during a dead short.

  2. Sonda says:

    hi,

    in that Lm339 circuit.. is that 100K is the potentio meter? can i use this to drive a auto mobile radiator fan?

    thanks.

  3. Sonda says:

    hi Kwong,
    Thanks heaps..yes that is the circuit. do you have any suggesions for a MOSFET for my purpose? this fan draws nearly 15A. thanks again.

    • kwong says:

      I would recommend using a MOSFET since you don’t have to worry about the driving current requirement. A little modification to the circuit is needed if you don’t want to use P channel MOSFET.

      In order to use an N channel MOSFET, you will need to replace the load (the motor and the protection diode) in the circuit with a resistor (anywhere between 500Ohm and 10K should be fine) and then use the collector output to drive the N-channel MOSFET’s gate. There are plenty of MOSFETs suitable for this purpose. For instance, IRFZ44N has a Vdss of 55V and an Id of 49A which will be able to handle your need.

  4. Sonda says:

    Hey thanks a lot..i will try this out & let u know .. you are a genius.. :)

  5. Sonda says:

    hey sorry to interupt u like this need one more thing to know.. i want this circuit to use my radiator fans, so i need a tepm range of 60 c to 100c will this thermistor help for that or i need to use another?

    • kwong says:

      No problem Sonda, almost all NTCs can handle your temperature range. The only thing you need to adjust is the trip point, which can be set by adjusting the ratios of the voltage dividers on either the positive or negative input of the Op-Amp.

  6. Vasilis says:

    How do you calculate the offset that the LM338, the voltage divider and the adj pin consumes ?

    Thank you.

  7. Vasilis says:

    Thank you very much for your quick answer.
    I am building an application like yours, and i want to measure the current after the LM338. I am using a shunt resistor, but if i will using it after the LM338 the voltage will be reduced.
    If a will add it, before the LM338 like you, i have to remove this offset from the code like you. So i am asking you, how you calculate the consumption of the LM338 and the voltage divider, so i can remove it from the code. The measurement will be with a PIC proccessor.

    • kwong says:

      OK. Got it. The additional current draw is simply Vref divide by the resistor between the Vout pin and Adj pin. So if you are using a 120 Ohm resistor the current is roughly 10mA. Because Vref remains the same (roughly 1.25V) you can simply subtract this amount from your measurement to obtain the actual current readings.

  8. Vasilis says:

    And the consumption of LM338 ?

    • kwong says:

      Since we are dealing with a linear regulator here, the output current equals the input current (except for the aforementioned additional current flowing through the resistor between the output terminal and the adj pin). Hope it makes sense.

  9. Vasilis says:

    Thank you very much!!!

  10. hjf says:

    Did you have any problems with the switchover? I was testing a similar circuit last night and during switchover, my LM338K was killed. I think there could be a problem with EMF from transformer during the switching of the relay.

    Everything else was OK, no other errors in my circuit. The values were the expected but I think there could have been a very high voltake spike from the transformer at some point during switching

    • kwong says:

      Highly doubt that the switch over was the issue. I have been using this power supply for quite sometime now and haven’t noticed any issue yet.

      One possibility is that if you do not use a protection diode between the input and the output of LM338 and you have a large output capacitor, then you could kill your LM338 if the input capacitor is large and connected to LM338 directly (as opposed to switched in via the relay). In that case, the uncharged input capacitor temporarily shorts the input while being charged up and the output capacitor dumps the charge via LM338 instead of the protection diode.

      • hjf says:

        Actually I built the circuit like you did, same as the datasheet with the protection diodes (1N4007). Stackexchange agrees that “disconnecting a coil will cause it to work as a boost converter”. You might want to look into adding a snubber circuit (just RC between transformer pins). I’d like to do that, but my analog electronics knowledge doesn’t go as far.

        Another issue I’m having now is that, I’m using a 12V 200W transformer that’s actually made of 2 100W coils in parallel. I wired them to act as a center-tapped transformer. Oddly enough, when the circuit is working from only one of the coils, everything’s fine. But when I make it work off 24V (33VDC), it won’t regulate. If I add a load, it will drop to 0.9V as soon as I load it (I’m using two 12V 50W lamps in series, so that should be 2.5A at 12V max). So I said screw this, let’s leave this connected. Surprise: voltage started to rise very slowly until it reached my set point. It took it a good 8 seconds to go from 0.9 to 4V

        So I thought… okay.. the problem here is LM338′s current limiting kicking in: this device can’t do 5A when the voltage differential is too high. So I set my output to 13V. Same deal. So now I’m confused. I thought this device may have been a fake so I cut open the other one I had (the one that burned) and it’s definitely not counterfeit.

        Adding or removing capacitance at the output doesn’t help. I used 0, 220 and 1000uF at the output and nothing changed.

        • kwong says:

          Could you link in the stackexchange thread you were referring to? The switch point is before the the LC filter and because the inductor is not in the current loop when it was being switched over, there is no voltage spike at the input to LM338.

          It would be curious to see what is the voltage at the input of the LM338. If the 12V AC is higher than norminal, it could push the rectified and filtered voltage to above 40V (e.g. if the 12 V measures above 14.1V, your input would be 28.2V when both windings are switched in and the unregulated DC input to LM338 would be at around it’s maximum allowed value (40V)).

  11. Ayush says:

    Cool!I’m going to make this. This is gonna be my first power supply!

  12. Ayush says:

    Can we use a centre tapped 12-0-12 transformer instead? keeping a 12v as AC ground and switching between 0 and -12? Hard to get multitaps here

  13. Ayush says:

    Would you recommend using a Current to Voltage converter instead of current sense IC? It’s not available in my area. Also the 10 bit ADC of atmega instead of AD7706. I a m going to use TL072 for the I to V converter

  14. Ayush says:

    Is there a current limiting feature? Can I use the op amp circuitry of the constant current dummy load to limit current in this case?

Leave a Reply