uSupply implementation, looking for feedback - Page 1
Forum section: electronics / projects

author: mat_fr
author_rank: Contributor
timestamp: September 22, 2014, 10:16:55 pm
content: Hi,I have made a step forward in the power supply inspired from Dave's uCurrent. Well actually I'm getting closer and closer to his design (and that's normal since I have not the necessary knowledge to choose alternatives in design/ICs/...)I have added a MAX4080 in the design instead of an opamp, as I was having issues with the LM358 to sense the current. I have breadboarded the current and voltage setting using a simple high power resistor as a load and an arduino which set pwm values by steps. It seems to work nicely so I went on making a real thing. Here is the schematic.Now I know it's pretty close to Dave's uCurrent, I just don't have the dedicated DAC/ADC ICs and the voltage reference is not as well dimensioned as Dave's, but I'm not trying to achieve a spot on precision, just to learn and have a decent lab supply I made with my handsDo you see any obvious flaw in the design? I'd be glad to have feedback.And of course I forgot to mention: the supply will be a 24V PSU (I think it can be set up to 28V). The expected output of the circuit is 0.3 to 24V (more or less as the PCU can go up to 28 but the LM328 is not rail to rail) and 0 to 1.25A.I wanted to add an opAmp as buffer to sense the voltage output but I can't buffer a value close to the maximum so I would have got a wrong value close to the upper rail. The drained current will be low so the voltage drop should be under the precision/bit (and could be compensated in software otherwise).Regards.

author: kt315
author_rank: Regular Contributor
timestamp: September 24, 2014, 04:34:53 am
content: Search the forum. There is a pretty serious problem with LDO used this way.Edit: I believe this is the thread:https://www.eevblog.com/forum/projects/lt3080-wierdness-dave's-power-supply-(eev224)-gone-mad/75/

author: mat_fr
author_rank: Contributor
timestamp: September 24, 2014, 11:50:17 am
content: Wow, I missed this one... Thanks for the link.Funny thing is I had the problem too, as mentionned therehttps://www.eevblog.com/forum/projects/usupply-implementation-problem-with-current-sensing/msg515969/#msg515969:Quote from: mat_fr on August 27, 2014, 06:22:26 pmWell, it seems it has more to do with LT3080...LT3083 is too expensive for me, I suppose I will, as others do, switch to LM317. Not sure if I will try to get a negative power rail or just accept a higher minimum voltage for the supply (or is there other problems with LM317 compared to the LT3080?)Thanks for your answers anyway.

author: David Hess
author_rank: Super Contributor
timestamp: September 27, 2014, 12:39:42 pm
content: I have never had a problem using an LM317 or 7805 style integrated regulator like this. Low dropout regulators and negative regulators like the LM337 and 7905 are a little trickier because they require more careful frequency compensation. I have not used the LT3080 series but except for the possible latchup issue I have read about, they should not be worse than any other LDO regulator.Your current control loop is going to have problems with stability because of the uncontrolled voltage gain of Q1.C6 is going to cause phase lag for both the current and voltage control loops compromising stability.Usually you want the voltage feedback to come from the output instead of the adjustment pin of the regulator for better performance but it can work either way.

author: mat_fr
author_rank: Contributor
timestamp: September 28, 2014, 08:46:01 am
content: Hi David,Thanks for your message.Quote from: David Hess on September 27, 2014, 12:39:42 pmOk, I can see the effect that could have and hence how that could be a problem. But is there a simple solution?Quote from: David Hess on September 27, 2014, 12:39:42 pmFrom Dave's videos this cap was to stabilize the output. If that's not necessary I will remove it.Meanwhile I have made some tests with the LM317. And just to play a bit with new concepts (well I mean new for me obviously) I tried to implement a charge pump voltage inverter to supply a negative rail to the opamps and a sustractor to offset the value I send to the set pin by 1.25V. I breadboarded it and it seems to works fine, I'm quite happy with it, though it seems a rather over-complicated solution.Now as I read your remark on the feedback coming from the output I wonder if I couldn't just get rid of the new LM328 completely to get the feedback from the output, which could take the offset into account on its own? Would it work? Wouldn't the output of the opamp go up to the sky when the current control gets in? In that case if the current control gets off and on to regulate won't the voltage control overshoot the target? Maybe that's already the case actually...I definitely have to test itHere is the modified version of the schematics (maybe I've made a little too many modules).

author: mat_fr
author_rank: Contributor
timestamp: September 28, 2014, 10:02:10 am
content: Yep, it works(at least using only the VSet feature).Terrific.Sorry if I marvel about trivial stuff but I really am discovering those things (analog electronics I mean) and I love thatHere is what it would eventually be (I hope).

author: David Hess
author_rank: Super Contributor
timestamp: September 28, 2014, 08:22:23 pm
content: Quote from: mat_fr on September 28, 2014, 08:46:01 amLocal feedback around Q1 can control its voltage gain. Shunt feedback, a resistor or capacitor or series resistor and capacitor between the collector and base, is the best way if you want the output to be able to go all the way to ground but I am not sure that will work well with the way your circuit is setup.There are better alternatives but they require a negative bias supply if you want the output to go to ground.I think you are going to have a problem with your current loop oscillating but maybe that is acceptable?QuoteThe capacitance across the set pin improves line regulation and lowers noise but is not necessary for proper operation. In this case it interferes with the ability of U3B to control the set pin voltage.A regulator like an LM317 can make the same use of a capacitor bypassing the adjustment pin and it has the same problems if an external error amplifier is controlling it.If feedback for the error amplifier is taken from the output, then itreplacesthe function of the set/adjustment pin bypass capacitor.QuoteThat is how I always do it. An LM317 adds 1.25 volts of offset to the output. A 7805 adds 5 volts of offset. The LT3080 adds some small but non-zero offset to the output. Taking the feedback from the output instead of the adjust pin removes the offset from the integrated regulator just like it would remove the Vbe drop from a bipolar transistor used as a pass element.QuoteThat is the case already with your design. With care the overshoot when changing modes is not significant because the operational amplifiers recover quickly enough.QuotePower supply circuits are a great way to learn what does and does not work when dealing with feedback loops.

author: mat_fr
author_rank: Contributor
timestamp: September 28, 2014, 09:28:11 pm
content: Quote from: David Hess on September 28, 2014, 08:22:23 pmOk "local feedback around Q1 to control its voltage gain"' is not something I've been into up to now, so I'm lost on that matter.I tried to use a charge pump voltage inverter but that gives a negative voltage, not much current capacity. I wasn't sure it would work for driving the LM317 to ground, but it does on breadboard with a 22 ohms resistor load... from 0,03V to Vin-drop out (I've used 12V Vin and a pot from GND to VIN for the test, not uControler filtered PWM so I didn't have to use any gain in the opamp loop).Well I hope it will work generally because I've just done a PCB to finalize itI'll try to finish soldering the parts next week end.QuoteI noticed an oscillation actually, on the scope (I have a DSO nano, not much of a proper scope, but it does show interesting things sometimes).Well, the first goal being to learn and have a usable supply, I think it's acceptable.QuoteAfter all the issues possible with that kind of circuit it has something magical to turn a knob and (finally) see the output behaving exactly the same way

author: mat_fr
author_rank: Contributor
timestamp: October 05, 2014, 09:17:34 pm
content: Ok, got myself a Rigol DS1052E, cheap and useful. It's my first oscilloscope (appart from the DSO nano that was pretty unusable, though better than nothing I suppose) and it's still easy to use, greatBut after building my supply circuit (I've rarely made such a poor solder job... had lots of short circuits, awful... But I *think* everything is now as it should from my schematics).I don't know if its the kind of oscillation that you talked about, but it seems that the opamp output, even for voltage control, is oscillating horribly. For Voltage Set to 5V (which actually makes 5V out if measured from a multimeter) I have a huge 1V pp. I found a noise which seems rather important on the signal but I don't know what noise I'm suppose to excpect from such a circuit. Anyway I have a noise between 40mV and 60mV pp on my filtered PWM line, and that's before the x5 multiplication. That shouldn't make 1V though, and I don't think noise could be the cause of the output clean jigsaw oscillation.I join the trace for the VSet signal and main output, both AC coupled. The ISet is set to Max, which should be more than enough not to disturb the plain Voltage control.Too bad I didn't buy the scope before making the PCB, but that's OK, I didn't expect everything to be OK the first time.

author: David Hess
author_rank: Super Contributor
timestamp: October 06, 2014, 08:49:05 am
content: Looks like a frequency of about 5 kHz. What is your PWM frequency?Try adding like 1000pF between the output and inverting input of U3B. I would also disable the current limit by removing Q1 for now.

author: mat_fr
author_rank: Contributor
timestamp: October 06, 2014, 09:43:30 am
content: I set the PWM signal to the atmega max of 62KHz, I figured the filtering would be easier that way.I'll try adding a cap as you say.Removing Q1 was indeed my intended next move to make sure the problem doesn't come from there (I suspect it may, though I couldn't explain why it would trigger without any other load than the LM334).I'll try that, thanks

author: David Hess
author_rank: Super Contributor
timestamp: October 06, 2014, 11:25:35 am
content: Quote from: mat_fr on October 06, 2014, 09:43:30 amSo the PWM signal is not the source of the apparently oscillation.QuoteThe current limit should not trigger but I like to eat my elephants one bite at a time.It may be informative to add some small load to the output although it should be stable with the minimum load you provided.

author: mat_fr
author_rank: Contributor
timestamp: October 06, 2014, 09:56:33 pm
content: Quote from: David Hess on October 06, 2014, 11:25:35 amYou even like to eat others' elephants, you've got some appetiteI only got 5mn free today so I just could desolder the transistor and make a quick check, no difference in the output voltage.I will take other steps tomorrow evening if possible.

author: mat_fr
author_rank: Contributor
timestamp: October 07, 2014, 06:33:35 pm
content: I removed both transistors, added a 100nF cap between inverting input and output (didn't have 1n and 10n was still noisy), it did prevent the noise on opamp output...But now, after some tries with and without output load, I've seen output voltage slowly got up, to reach the maximum value in few seconds, now PWM output visible on the Atmega pins, no display on the LCD, no nothing.Thought I burnt le chip, but it's still programmable in the arduino IDE so I suppose not. And I had to rework some contacts between ground planes (I used transistors legs as vias), I checked it but maybe (probably) some other problems occurred during the operation.That's discouraging, I don't know if I must try to make it work as is, or just go back to the breadboard and start over again (and this time with the whole system if possible).

author: David Hess
author_rank: Super Contributor
timestamp: October 07, 2014, 09:10:03 pm
content: That sounds like the control voltage to the non-inverting input of the error amplifier got disconnected and the bias current of the operational amplifier is charging C8.

author: mat_fr
author_rank: Contributor
timestamp: October 08, 2014, 06:30:07 am
content: That's possible but even in the Atmega pins I can't see any PWM anymore so if something went wrong, like a short between the PWM pin and ground for instance, I may very well have burnt the little guy. My continuity tests didn't show such a problem though, so I don't know what's going wrong.I'll try to investigate further during the week-end.

author: mat_fr
author_rank: Contributor
timestamp: October 09, 2014, 04:51:58 pm
content: Just retried... Test of the uControler on the arduino platform, PWM is present on the pins for VSet and ISet... But nothing but noise when the controler is on the board. I couldn't find any short or bad connection on the path. As I don't have any display on the screen I can suppose the uC can't run at all, maybe keeps resetting due to another bad connection elsewhere.I think I'll get back to beadboarding the thing. Frustrating... Man you got to love electronics to make progress despite the frustration (well as in programming in fact, only more complicated and we have compilers to "build" the code, PCB are longer to make, build and test).Thanks again for all the help, I think I might come back with other questions for next problems (I gave up hopping there wouldn't be any more).

author: mat_fr
author_rank: Contributor
timestamp: October 13, 2014, 10:27:29 am
content: Hi, just a quick question regarding that kind of circuit : what noise level should be expected?I planed on using a 24V 100W switching power supply (more than enough for the needs of the project, and as is the power supply is sleeping in a box), I assume it's a relatively good power supply (bought on eBay). To plug it I made my circuit not with a jack but with a dual screw terminal. And for my tests I used a simple 12V wallwart switching power supply (pretty bad I suppose). Well now that I have an osciloscope I can see the horrible noise on the circuit (looking at it AC coupled). It goes to about 100 to 200mv pp, and that's even after the 7805 powering the uControler. I mean measured between GND and 7805 output...And likewise, I saw a good deal of oscillation (few dozens of mV) on the input of the circuit, so I thought that the current control pin could be subject to the same kind of noise, maybe leading to the oscillation on the output.Aren't the linear regulator 7805 and LM317 supposed to compensate for the oscillations? Or do I have to use bigger caps? What can I do about the noise (which is not any particular frequency)? What would be an expected/acceptable level for this kind of circuit?I have desoldered all the board to begin anew though.

author: David Hess
author_rank: Super Contributor
timestamp: October 13, 2014, 11:30:33 am
content: Quote from: mat_fr on October 13, 2014, 10:27:29 amRegulators have "ripple rejection" and operational amplifiers have "power supply rejection ratio" which are essentially the same thing and reflect their ability to attenuate noise at their power supply inputs. The ability for them to do this falls with frequency. An LM317 for instance rejects more than 60 dB of its input ripple at DC but only 40 dB at 100 kHz and 20 dB at 1 MHz.A couple millivolts peak-to-peak of output noise is typical in a good design like this. To get to this level when a switching preregulator is used, a high frequency LCR filter is typically added before the output regulator. The resistor is in parallel with the inductor to lower the filter's Q and prevent ringing. You can find this structure added to the power supply lines at different points in all kinds of analog instrumentation.

author: mat_fr
author_rank: Contributor
timestamp: October 13, 2014, 01:51:05 pm
content: Quote from: David Hess on October 13, 2014, 11:30:33 amI don't know why there were such a noise on the 7805 output then... Even if there were noise on the input some of it should have been filtered. And there was an input cap on the regulator (the output was in fact close to the uControler).QuoteSomething like the picture joint?I just looked for some references on the subject (once again, new subject for me), but I haven't found examples using the configuration you describe. The wikipedia pagehttp://en.wikipedia.org/wiki/RLC_circuitshows multiple configuration but I assume I want a LP filter but fig 9 doesn't match the description. Unless the fig 5 is the configuration I need (http://en.wikipedia.org/wiki/File:RLC_parallel_circuit_v1.svg)?

author: David Hess
author_rank: Super Contributor
timestamp: October 13, 2014, 03:52:14 pm
content: Quote from: mat_fr on October 13, 2014, 01:51:05 pmI am sure some of the noise was filtered by the capacitance at the input to the regulator but capacitors have ESL and ESR which limit their ability to filter high frequency noise. Inductors and resistors have parasitic capacitance which does the same for them.QuoteThat is it exactly. More than one stage may be required. Some inductors are lossy enough that the resistor is not required.Check out this application note for some ideas:http://www.linear.com/docs/11877There are other ways the noise can get into the output of the linear regulator. It could be a measurement artifact because the output of the switching regulator is bouncing the output ground all over the place compared to earth ground. Filtering on the power and ground might be necessary to prevent that. If the switching regulator is physically close to the linear regulator, leaking magnetic flux from the inductor or transformer may get into the regulator. Using a better inductor or transformer and physical separation may be used to prevent that. Shielding works also but is expensive. The ground return currents for the switching regulator can cause problems if a single point ground is not used. That is a layout issue.

author: mat_fr
author_rank: Contributor
timestamp: October 14, 2014, 09:13:44 am
content: Quote from: David Hess on October 13, 2014, 03:52:14 pmVery enlightening indeed, thanks.QuoteThat's what I thought at first, and I don't know if, in that case, that's a real issue for the powered device (I mean powered by this home made power supply circuit). I've seen that Dave made different ground planes in his board for power and signal parts, which I haven't. Maybe that's a bad idea (TM).QuoteActually in my tests the wall wart switching device was more than 1m away from the circuit. In the end I intend to use that kind of supply :http://www.amazon.co.uk/110V-Switching-Power-Supply-Strip/dp/B00AOCUBBM(not necessarily this one, as I said I bought mine on eBay, difficult to say what's inside). I didn't use that one for my tests because I wanted less voltage first to test it, and I saw the EEVBlog video on how to burn your oscilloscope when using a power supply in which GND is connected to earth. Scared me a little bit...But I have to admit (Ok, shame moment), just for the ease of manipulation, I plugged the switching supply's jack on an arduino board then plugged it's Vin and GND pins on the circuit terminal. I suppose that suffice to bring a lot of noise in the circuit...By the way I would be really interested if someone could point some resources on general PCB layout rules. I've seen some videos from people explaining why they did the layout that way, but it's always one small tip at a time, I wondered if some good reference was available somewhere on the web?

author: David Hess
author_rank: Super Contributor
timestamp: October 14, 2014, 05:31:22 pm
content: Quote from: mat_fr on October 14, 2014, 09:13:44 amThere is a reliable and simple test for this. When you connect the oscilloscope to measure the output ripple, start by connecting the probe's ground and probe's input to the same ground point you would use on the circuit and see what the oscilloscope shows. There should be nothing there because the probe's ground and input are shorted together.

author: mat_fr
author_rank: Contributor
timestamp: October 20, 2014, 10:13:56 pm
content: Hi,I've been a little busy but I'm not giving up on thisQuote from: David Hess on October 14, 2014, 05:31:22 pmWow, just made the test. The scope shows 30mV pp without any supply, and when pluging the wall wart 12V switching supply it shows lots of noise: between 100 and 150mV pp... Is that normal ? I'm on a breadboard, the supply is plugged on an arduino platform, Vin and GND are forwarded to the breadboard.Now, I made some tests with the scope using a part of the circuit on breadboard (the voltage control part, with a charge pump inverter, an LM358 and an LM317). I first saw noise from the supply (measured between Vin and GND). There was switching ripple, spikes and noise (ripples were present when connecting a 27Ohms resistor to the LM317 output). Using a ferrite bead on the supply lead between the arduino and the breadboard I obtained a fair limitation of the random noise, but still saw ripples and switching spikes. Putting a 470uF capacitor on the breadboard power rail greatly reduced the ripples and spikes. I have not tried your LCR solution yet.I also saw the same kind of oscillation on the opamp output (and therefore the LM317 output as well) as I had seen on the circuit. I tried to put different values of caps between output and inverting input. No effect up to 100nF, but a uF stabilized the thing. I don't know if it's too much of a value, just tried and it seemed right.It's great to experiment with all thisEdit: OK, just tested quickly the LC filter with 68uH power inductor (didn't have any lower value ready to use) with a 1uF cap. It drastically lower the noise on the power line, great. I can't say if it does a real difference on the output after the opamp and LM317 though, but I suppose it does.

author: David Hess
author_rank: Super Contributor
timestamp: October 21, 2014, 03:15:13 am
content: Quote from: mat_fr on October 20, 2014, 10:13:56 pmIt is annoying but I would not consider it unusual. They a common mode filter can be used to attenuate the ground noise.