EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: dannyf on December 30, 2014, 08:14:25 pm

Title: el cheapo power supply
Post by: dannyf on December 30, 2014, 08:14:25 pm
In a separate thread, I proposed a simple power supply that utilizes CC/CV control loops: https://www.eevblog.com/forum/projects/el-cheapo-mcu-controlled-power-supply/, (https://www.eevblog.com/forum/projects/el-cheapo-mcu-controlled-power-supply/) and with the possibility of having it controlled through a mcu.

I built it and it worked as expected -> good CV behaviors and good steady state CC behaviors.

One issue with it is that it requires three opamps -> one for the CV loop, one for the CC loop and another for the current sense amplifier. While you can replace the current sense amplifier with a dedicated sense amplifier, it still adds complexity and not as "el cheapo" as I had wanted.

edit: link updated.
Title: Re: el cheapo power supply
Post by: Kalvin on December 30, 2014, 08:18:24 pm
If you use quad op amp, you have still one op amp unused ;)
Title: Re: el cheapo power supply
Post by: Zero999 on December 30, 2014, 08:20:51 pm
If you use quad op amp, you have still one op amp unused ;)
Beet me to it.: TL084, LM324 are cheap.

The link to the other thread doesn't work.
Title: Re: el cheapo power supply
Post by: Zero999 on December 30, 2014, 08:37:47 pm
The drop-out voltage will be quite high.

Be careful using LEDs as ORing diodes. They typically have a maximum reverse voltage rating of 5V which can easily be exceeded when the output of one op-amp is high and the other is low.
Title: Re: el cheapo power supply
Post by: dannyf on December 30, 2014, 08:42:39 pm
Here is a picture of the circuit working on a breadboard, only the CV portion implemented.

The voltage control is done on the lower right, via a blue LED + pot. The load is a 10ohm resistor, and the current sense resistor is a 0.47ohm resistor.

The mosfet is an Onsemi 30N20. Next to it is a 2n5401. Holding the output at 1.268v.
Title: Re: el cheapo power supply
Post by: dannyf on December 30, 2014, 08:47:00 pm
The choice of opamp is interesting.

As the current sense amplifier's inputs may get to GND (small output voltage / current), you need a R2R opamp that will at least get close to GND. That means a PNP input stage. The high side isn't an issue, thanks to the voltage drop over the regulator.

The output is also important, as you need to be able to pull the mosfet's gate below its Vgs(th), even through the LEDs. As such, the output should be able to go as close to ground as possible.

The NE5532 first the input requirement, but not the output requirement.

Here is the output when the pot is turned to ground: the power supply should output 0v, but instead, it outputs 0.9v.

Title: Re: el cheapo power supply
Post by: dannyf on December 30, 2014, 08:50:15 pm
Two other opamps / comparator excelled at this job, LM358 and LM/KA393.

Both holding the output at 0.0v when the pot is turned to ground.
Title: Re: el cheapo power supply
Post by: dannyf on December 30, 2014, 08:52:38 pm
The power supply's ability to output to 0v is actually helped by the mosfet's Vgs(th): a mosfet with higher Vgs(th) will be easier to go to the ground, everything else being equal.

Choices of regulator: Not critical at all. It can be bjt (single or darlington), mosfet, or even a regulator, like LM317. Higher drop out is more desirable in that it provides the opamps more headroom on the positive side.

Title: Re: el cheapo power supply
Post by: Zero999 on December 30, 2014, 08:56:23 pm
How stable is it with the LM/KA393 comparator? Have you tested the transient response? A comparator won't be frequency compensated so there's a good chance of oscillation.
Title: Re: el cheapo power supply
Post by: dannyf on December 30, 2014, 08:58:22 pm
Q1: Q1 is very interesting.

First of all, it is optional, in that without it, the whole ps works.

2ndly, Q1 does two things good:

1) it isolates the regulator from the opamp. That's important in terms of speeding up the reaction time, and minimizing the gate capacitor's impact on the opamps.
2) if the power supply is powered by a high voltage source, or the output needs to be held stable over a wide voltage range, the power supply may not be able to output 0v: even if the opamp's output is at 0v, the voltage drop over the diodes / led can still be enough to turn on the regulator.

So there are conditions under which Q1 is desirable.

However, Q1 does one thing bad: it lowers the current through those diodes / LEDs to the point where they are not visible to your eyes. You have to figure out other ways to tell if CV/CC loop is in force.

Title: Re: el cheapo power supply
Post by: dannyf on December 30, 2014, 09:02:10 pm
Vtrl generation: I used a led that functions also as a power indicator. It is OK but you want to have it clamped hard to a given voltage. Something like a 78L05 or TL431 would be better.

Other niceties: I didn't drop decoupling caps, etc. They are nice to have. You may also want to experiment with the compensation on the opamp - they are operating without local feedback loop and that's typically not so nice. Some capacitors / resistors there between the inverting input / output would be helpful.

Title: Re: el cheapo power supply
Post by: dannyf on December 30, 2014, 09:04:23 pm
MCU control: this ps is not that friendly to mcus.

On the voltage side, you can use a mcu to generate Vtrl. Not a problem at all.

On the current side, you have to use a digital pot in place of R8. Those suckers don't have a lot of resolutions so the granularity is not great, 256 steps on the high end, and 512 steps are very rare.

I will play with the CC side more and report back.
Title: Re: el cheapo power supply
Post by: dannyf on December 30, 2014, 09:49:15 pm
Quote
Something like a 78L05 or TL431 would be better.

I put in a 78L05. With a 10K/10K divider and the pot fully out (Vtrl=5v), I get 10.0v on the output. Not bad.

edit: I took out Q1 so that the leds light up if their respective loop is active. The yellow LED is on the CV loop.
Title: Re: el cheapo power supply
Post by: dannyf on December 30, 2014, 09:52:01 pm
Also implemented the CC part of the circuit.

Here is the CV/CC part together, with CV active, as indicated by the yellow led.

Adjust the Vtrl pot to get to a 2.1v output.

edit: the probe wasn't on the right point. Updated picture.
Title: Re: el cheapo power supply
Post by: dannyf on December 30, 2014, 09:56:45 pm
This is where it becomes interesting.

With Vtrl untouched, if I were to change R8 so that the CC loop becomes active - the red led illuminates, pulls down the voltage on the output.

Except that the output voltage does not recover and stays low. No oscillation as the typical CC loop hits the limit. I think this is the side effect of having the current sense after the regulator.

This kind of behaviors can be desirable as it functions like a fuse, and takes out the power source if there is a fault condition in the circuit powered by this supply. Under the typical CC circuit, it would remain powered on.

Very interesting.

edit: the probe wasn't on the right line. Updated picture - no material changes.
Title: Re: el cheapo power supply
Post by: mikerj on December 30, 2014, 10:04:12 pm
Have you looked at the transient performance of the CC loop?  The simulation looks pretty terrible.
Title: Re: el cheapo power supply
Post by: dannyf on December 30, 2014, 10:23:38 pm
All the above was done with LM358. I will pop in the KA393 later.
Title: Re: el cheapo power supply
Post by: dannyf on December 30, 2014, 10:24:08 pm
Quote
If you use quad op amp

Every penny counts, :0
Title: Re: el cheapo power supply
Post by: dannyf on December 30, 2014, 10:26:10 pm
Quote
How stable is it with the LM/KA393 comparator?

Nothing that would have been detected via a multimeter. Either case, some local feedback is desirable.
Title: Re: el cheapo power supply
Post by: dannyf on December 30, 2014, 10:40:30 pm
One potential modification is to add soft-on/off.

In the case that Q1 is used, you can have a circuit that ties Q1's base to ground at power on and release it afterwards.

If you don't use Q1, you can have a npn/n-ch (or even an optocoupler) that ties M1's gate to ground at power on.

This also provides a way for the mcu to turn on / off the power supply.
Title: Re: el cheapo power supply
Post by: dannyf on December 30, 2014, 11:16:52 pm
Put the probe on the output and plugged in a few opamps. Good, bad and ugly.

First, LM358. Ripple is about 5mv?

Title: Re: el cheapo power supply
Post by: dannyf on December 30, 2014, 11:18:46 pm
KA393. Ripple about 100-200mv? You can half that by  putting a 220pf capacitor on that. But still bad.

Title: Re: el cheapo power supply
Post by: dannyf on December 30, 2014, 11:22:16 pm
Lastly, ne5532, comparable to LM358, with the exception that the output cannot go to 0v (with an led).

Title: Re: el cheapo power supply
Post by: dannyf on December 30, 2014, 11:24:34 pm
BTW, you can solve the >0v output issue for NE5532 by utilizing a regular diode in stead of the LED.