LM324 Bench PSU

Hi attached is a LM324 based PSU LM324 bench PSU.JPG which I have built to help me build my digital audio project. The ic is not expensive and will work well if set like a traditional bench psu. Some improvement can be added to the circuit but its for temporary use for the meantime
 
I have reworked the circuit and i will upload a new versions soon. I read a little bit here and there but fell on this today http://cp.literature.agilent.com/litweb/pdf/5952-4020.pdf
and got more insight about what i was working with. I also found this while searching a bit http://www.youtube.com/watch?v=HxXC78vylug and this http://www.youtube.com/watch?v=zQKkrC5VwHY which also gave me an idea of whats inside a high quality bench PSU.

I am thinking of doing two things first breadboard my new circuit, then plug digital control into the circuit and see how precise it is, as for the concept i already tested and got it working.


There is also inside those bench PSU a buck regulator called a preregulator before the linear regulator. It kicks in when there is a huge voltage difference between the input and output voltage in the linear regulator e.g. 30V in and 5V out and avoid severe power dissipation which is the issue with linear regulator when the input to output differential is high. I am a bit scarce on heatsinks so that could be a good solution. I will try one at a time and see how things go
 
Last edited:
TL494 Buck regulator prototype working

Attached is a schematic of a voltage controlled buck regulator. I forgot to add the totem pole and gate drive resistor but at least it gives an idea of what I am heading for. This circuit will be used to drive the LM324 PSU and stay at full duty cycle all the time. when the output of the supply will create an input output voltage differential of x(which I need to estimate), the duty cycle will go down, hence reducing the voltage fed to the linear PSU and reducing power dissipated. The pot shown in the schematic will need to be replaced by another circuit (substracting opamp circuit maybe) to sense the input output differential voltage across the linear PSU. A frequency/phase compensation around the TL494 Voltage opamp + an additional forward choke output filter on the buck regulator output will be needed. I also made an override of the current opamp just to make things simple. It will have a current limiting built in afterwards.

In case those of you reading the post wonder how the cheap chineese linear PSU do it is by having several output taps on their transformer with e.g. 6V, 12V, 30V taps. The PSU simply switches between those taps depending on the output voltage settings and it removes the need for a monster heatsink. The agilent seies do it differently by using SCR's in the bridge rectifier. By changing the firing angle of the SCR they can control the input voltage so no multiple taps transformer needed.

My implementation is different and uses a buck converter at the input to help reduce dissipation. the reason why I am doing this instead of the simple heatsink or mid complex tap switch approach is more to have a grasp on feedback compensation networks in voltage mode SMPS and have something usable with my bench PSU at the end than the usual throw away prototypes I usually build. TL494 100KHz buck regulator.jpg
 
I am about to build the new PSU board and test it with analogue control. Past that I am going to head for digital control. I will substitute the LM324 with a LM339as a comparison
 

KX36

New member
Looking good. Designing your own adjustable linear series voltage regulator can be a bit of work to ensure it's stable under all loads as the feedback loop generally requires some kind of frequency compensation beyond that built into the opamp. You can't call yourself an electronics hobbyist without building your own bench power supply! :)

I can't view your youtube links as I'm at work but I assume it's the EEVblog power supply which uses a datasheet schematic DC-to-DC converter pre-regulator with an output voltage tracking the output voltage plus just a couple of volts above the minimum voltage drop of a voltage regulator IC and having a constant current supply feeding a constant voltage supply. Dave Jones knows his stuff and his design is a great place to start. IIRC, the reason he uses an off-the-shelf voltage regulator IC is to try to enure stability without having to compensate anything. From what I remember, when he simplifies his constant current into a circuit to modulate his CV supply, he makes it so that the output voltage can have high frequency oscillations in CC mode, so it is better to have the 2 separate pass transistors for CC and CV if possible. Remember a linear voltage regulator has a bandwidth and its noise rejection reduces with frequency, so if you want a low noise linear supply with a switching preregulator, you have to filter it quite well and/or keep the switching frequency reasonably low, well within the bandwidth of the linear regulator.

You're using a TL431 as a precision 2.5V zener as part of your reference. If you look at how it works you'll see it's actually quite similar to a series voltage regulator IC except that it's a shunt regulator IC. It has an error amplifier built into it and so you could make a very simple series regulator with it just adding a pass transistor and a couple of extra parts. In fact there is such a design in the datasheet Fig. 19.

Short of doing that, I notice you're amplifying the reference voltage from your 2.5V output of the TL431. You can simplify this by setting the TL431 output directly as Fig 17 in the above datasheet, optionally buffering that with an opamp if you need more current from it, which should still be better than amplifying with an opamp.

Overcurrent protection can be done in several ways, there are generally 1-2 transistor solutions for standard current limiting and foldback current limiting which sense current and act directly on the pass transistor. Foldback current limiting can potentially cause instability especially in a SMPS, but it's often worthwhile in a linear supply as the pass transistor dissipates a lot of power in a short circuit condition without it.
 
Last edited:
LM339 bench PSU

Hi thanks for your input. Like i mentionned up i am using a modified schematic which i haven't yet posted. I see your point about TL431 and this is changed in the new schematic, i have effectively dropped voltage amplification in favour of a TL431 + Voltage follower. The current limit has also be modified to run the PSU on constant curent source when required and a separate current protection implemented. The link is not an EEVblog video but its from Greg sweeney doing an agilent repair/tear down. He also has a blog that shows the issues he had in building a digitally controlled PSU. If you have any other input i would be glad to discuss. I have attahced a picture of the quick protoype i will be using for testing, it needs heatsinking + the ic e.t.c. First i will test and run off classical analog control then to digital control. Photo-0175.jpg
 
Progress

I made some progress but i went back to the LM324. There are better LTC versions out there which i will consider later. For the time being the power supply is working fine and is pretty stable. The system was run using only constant voltage control and a TL431 as voltage reference. The micro controller is being prepared to take over. I have to look around and find a suitable DAC to replace the TL431 as i doubt the PWM in the micro controller can be as accurate as the TL431.
 

KX36

New member
A DAC still needs a reference, so you'll still have to have one somewhere. If you're using a DAC to provide a control voltage which will be scaled to an output voltage by an opamp and then current boosted with an emitter follower, be careful to use the right opamp. You might want to use a precision rail to rail opamp.
 
Hi thanks for the input. Yes effectively a proper reference will be needed for the ADC/DAC. I have been looking a little bit around at Ti/LT/ST/microchip for their ADC/DAC solutions as well as price v/s resolution. There is also Max Vin for the ADC to be considered. I haven't yet settled my mind. for the time being I will use the PIC ADC and PWM DAC as a start to stabilize the code. Past that point once I make my mind on which ADC/DAC to go for. If you have any interesting info to share and discuss you're welcome thanks
 
First run of prototype with digital control

I have carried on and made the ADC and PWM on the 16F877A work. As a proof of concept an opamp controlled series pass regulator was setup. The non inverting pin was fed with an RC filtered PWM to act as Vref and the output voltage was sensed through a voltage divider to the pic ADC. The required output voltage was programmed in a variable and the code run. The code is currently in two parts. A first part the calculates the Verf, hence PWM duty to achieve the required target voltage. Once set a second module kicks in and uses the ADC to sense the output voltage and control the duty cycle to maintain the target voltage. No oversampling/dithering/low pass filtering was done on the ADC. The result was an output voltage within +-5 to +-8% of the target voltage. the microcontroller was running at 20MHz hence the code executed @ 5Mhz. My series pass was done quickly on project board and the input voltage limited to 5V to simplify connections. It worked as a proof of concept and the next stage is to make something more stable and test with an input voltage of 20V. I will keep posted.
 

KX36

New member
If you have an opamp acting as an error amp in the tradition linear series voltage regulator topology, do you actually need an extra digital feedback loop controlling duty cycle outside this? I can see it only being a potential source of instability. I would have kept the single analog control loop, used the PIC to set the control voltage on the opamp's non inverting pin via a DAC and only use any ADC for monitoring output for a LCD display if you want one. And for using the PIC to take action in fault conditions. In the end you'll want an external DAC and reference as pwm noise on control voltage will appear on the output. The more you filter the pwm noise, the slower the voltage will change as its adjusted.
 
Hi effectively that is an approach and it relies on the voltage feeding the pic to be very stable as well as the pic clock to be accurate. it all boils down on what level of accuracy I am expecting from the PSU. There is a way to achieve stability between the two loops which I want to investigate. Otherwise the other solution I am keeping under the hood is taking the averaged pwm voltage and using the ADC to maintain an accurate voltage source. I am still in experimental territory right now but definitely the more stable method will win out.
 

KX36

New member
A filtered PWM from a microcontroller is a poor DAC anyway, so you will have a compromise between a noisy output and a poor step response to change in set voltage and lower accuracy. It's OK for prototyping but IMHO not good enough for your final design. There's no point trying to get around this with a feedback loop as your accuracy limit is still the voltage reference.

I'm more used to AVR microcontrollers (I initially chose them because typically they perform 1 operation per clock rather than 1 per 4 clocks of PIC). IIRC, they often have a separate analog power pin and analog reference input pin although I can't remember if that's just used by the ADC.

Use an external DAC controlled by serial data from the microcontroller, with a separate voltage reference IC and you'll get high accuracy, low noise and a fast step response to change in control voltage. Then all you need is a decent opamp and pass transistor and whatever current limiting and voltage/current monitoring circuitry you like and you're done. I've done this before in linear power supply and SMPS. It's inexpensive and performs well. Nesting two feedback loops controlling the same variable doesn't make sense.

Example parts:
MCP4921-E/P, 12 Bit DAC - Cheapest 10-12bit through hole DAC RS sells £1.235
MCP4911-E/P, 10 Bit DAC - About the same price but with a better non-linearity error £1.31

LM336Z-5.0 1% 5V reference (trimmable) £0.53

There's a decent selection of precision rail-to-rail opamps available from analog devices in SO-8 packages that you might use if you need accuracy near the rails e.g. OP184 although they might be a bit overkill, it's up to you. There are other classic precision opamps with lower bandwidth that aren't rail to rail that you might alternatively use.

Improving accuracy is simply a matter of chosing a different DAC and reference (e.g. specify 0.1% accuracy reference) with the right specs and checking the opamp's not an accuracy bottleneck.

Bear in mind that zeners increase accuracy around 5.6V where they transisiton from zener to avalance action (IIRC) and silicon bandgap references are around 2.5V, so you can get some quite accurate references around these voltages, but 5V references are convenient. References on the 2^n scale also work well with DACs as the serial data is programmed on this scale so the output voltage should be a round integer of what you want it to be. e.g. 2.048V and 4.096V
 
Last edited:
Hi thanks for the info very useful indeed. I will be trying out my code with an STM32FVL and use the internal ADC and DAC as a comparison with the pic. One question on your past implementations, when you mention "voltage monitoring" above what are you referring to? Sending back the output voltage to a display device? then if that's it you've just saved me a lot of time instead of me trying to compensate for the series pass opamp inaccuracy using the ADC and go for a more accurate opamp instead. I will take your info into consideration for the STM32VL code.
 
Last edited:

KX36

New member
Yes, when I say monitoring, I mean reading back the output voltage and current to the microcontroller then outputting that data with any other data to display to an LCD or to a PC etc.

Oh, little correction to my earlier post. Silicon bandgap voltage is actually around 1.25V, but 2.5V references do often use an internal bandgap reference.
And I said the 10 bit DAC had a better integral nonlinearity error, which isn't strictly true. That's cos I rushed a reply on my phone. The error is specified in least significant bits, 12 LSBs worst case INL error on the 12bit converter is actually about the same as 3.5LSBs error on the 10bit DAC. Which you'd expect as they're different versions of the same device. There's also offset error, gain error and differential non-linearity errors to consider, but it all depends exactly how accurate you need to be. Often fixed errors can be calibrated out in software and then the main concern is temperature coefficient and drift over time.

Theres also the MCP4811 and MCP4821 which are the same as MCP4911 and MCP4921 but with the addition of an internal 2.048V 2% reference for a 2mV output step size in MCP4811 and 0.5mV step size in MCP4821. You just have to adjust the gain of the opamp to scale the 0-2.048V reference to the output voltage range you want.
 
Last edited:
Hi thanks for the info really helpful. Just one question have you used the same concepts(i.e. microcontroller+DAC+ADC) with a mains powered SMPS?
 
Just some update I still wanted to get the pic to work to its best possible with the pwm dac and I ended up with a target to output voltage varying between 0.1 to 1.8% for different target voltage values, the mean being around 1.3% error most of the time. I think that's the best I can get out of a 16F877A and LM324 with the time and effort I can put in currently most probably there is room for improvement by substituting parts e.t.c but its not for now. I will keep my figures and compare with the STM32VL internal DAC result.
 
Last edited:

KX36

New member
I have used a microcontroller to control an off-line SMPS. Quite a niche design that needed tightly regulated adjustable control and remote control from a PC. Digital signals tend to couple a lot better through optocouplers than analog ones, so it's possible to implement primary side control with a secondary side microcontroller as long as you take into account what happens if the SMPS is on before the micro gets power (or give the micro an auxiliary power source). That particular SMPS used a secondary side controller though as for that particular design, fewer signals had to cross the isolation barrier that way.

An alternative to using a DAC on the non-inverting input of the error amp is to use a digipot on the inverting input resistor divider in place of the lower resistor. They're far from ideal devices and the output voltage vs the set resistance is not linear, but they can work on devices with the error amp's non-inverting input internally connected to a reference as is common in SMPS PWM controllers. The lower resistor of the feedback resistive divider as it's not technically in the AC feedback loop so adjusting it shouldn't affect stability, with the caveat that the gain of the error amp as far as gain bandwidth product is concerned is the local feedback resistor divided by the parallel combination of the upper and lower resistances of the voltage divider, so if that resistance gets too small, the opamp's gain increases, the GBWP pole falls and that can potentially affect stability.
 
I did a quick test using the STM32VL the accuracy was dead spot on for up to 1/100th of the target output voltage. My LM324 right now has around +18mV offset which i have not removed in my code. I will do a proper test to get a realistic %error.
 
Top