Ti LP2951 ACM - Voltage regulation via PWM, hypersensitive - Page 1
Forum section: electronics / projects

author: LeviathanX
author_rank: Newbie
timestamp: May 30, 2013, 09:55:31 am
content: Hi folks,I've been reading around for a while and since I came to the conclusion that you are a nice folk I thought I'd ask my question here.(looks like the correct subforum, doesn't it?!)Currently at work we're reviewing a new PCB revision with some more options and, so far, it works pretty well ...There's just a simple section that won't do exactly as we wish.I'm was sitting on that part for the past two days and my colleague was resoldering some resistors here and there to make my life easier.So it's not a "do my homework request"It's more like I don't understand why that happens and my colleague can't deliver me a proper explanation as well...It just totally bugs me...Ok, on to the problem: in the attached schematic you'll find the extracted portion which gives me/us headache. This part shall deliver approx 7.2V (minimum) to external sensors (need at least 7V supply).This is accomplished via three options1. voltage divider with hard wired resistors (beneath the 470k comes the second one)2. via a potentiometer (replaces the 470k and it's companion)3. via PWM generated by the µC (my part)Well, only the PWM part makes the problem and so I extracted the schematic for that part out of the big plan (left out the other two options).So what exactly is required and what happens?Requirement is simple: set a voltage between 7V and 8 V via software.The used voltage regulator (http://www.ti.com/product/lp2951) needs some steps before going active with PWM0. disable the shutdown1. check continuously the error active pin (=low -> error)2. decrement the duty cycle by 1 digit3. repeat with (1) until error active pin is high4. wait until the circuit is charged (delta of voltages between two cycles equals 0)5. decrement pulse until desired voltage is reached.Sounds simple... might be, but it's not. Sadly the circuit "discharges" with like 1mV/sec.. and even faster with load attached.So I need to DECREMENT the duty cycle by at least one digit to have it recharged once again.Fun fact: I can only decrement the duty cycle, but ONE increment discharges the whole thing...Please refer to the attached picture to see what I mean (I increased the cycle wait time to show the effect)The problem is: even if I only decrement by one each say 200 mV, it will come the time I'm at the limit of the duty cycle where the feedback voltage goes too low and the regulator switches through, full 12V at the external sensor -> boomIt's not that I'm too slow or too fast at all...The µC runs on 64 MHz, and so does the PWM; therefore 1 digit equals approx 15.6ns. The PWM runs (rock stable) at 16kHz, so I have 4000 digits. I re-adjust everything within 10ms cycle time and added a delay to the duty cycle adjustment by three measurement cycles (yields better results (charge time)).The current solution I came up with is shown in the other attachment... I do the described steps and change the duty cycle by 1 digits back and forth every cycle without delay... works "good" in case you can call 60mV ripples on the output supply line "good".There just one drawback in this solution... I happened to see "sudden discharges"...once in a while which puts my output supply beneath 3V.... ugh... don't know what happens here.Big talk...So what me bugs is that one digit less initiates a full charge and one digit more initiates a full discharge.(And I can't find a good SW solution, that bugs me even more)Is someone able to explain me what happens behind the scene? Or does someone eventually have a HW solution in mind (feel free to alter the schematics)?I'm actually a full fledged software engineer and only partly an electrical engineer (I walked the path of technical information technology), so I just understand a little more than the basics but not all too much more beyond that(but feel free to give me all you've got).Thank you for reading that long text!!In hope of nice answers...Have a nice day!Kind regards,

author: wraper
author_rank: Unknown
timestamp: May 30, 2013, 12:20:32 pm
content: Why do you have capacitor connected to the output of opamp? It's totally wrong and can cause stability issues. And the whole schematic of low pass filter is wrong, you are just wasting that opamp, read thishttp://www.proaxis.com/~wagnerj/PWMfil/PWM%20Filters.pdf

author: wraper
author_rank: Unknown
timestamp: May 30, 2013, 01:30:57 pm
content: Also how you can get from 7 to 8V on output with unity gain opamp from pwm. Except that there is another capacitor connected to opamp output on LP2951 schematic,to get 7V at LP2951 out you already need to feed 6,77V to FB pin. I doubt that your MC can output such voltage to PWM pin.By the way what I/O voltage your MC have? What is opamp supply voltage? It needed to account to correctly make PWM schematic. Also max output voltage must be limited in hardware, otherwise I feel really bad about your customers who will get the product with such design. Also I don't think you need such an output voltage control loop, LP2951 will do stable voltage by itself. All you need is provide stable PWM output. Maybe you need ADC only to calibrate PWM when setting voltage and then just keep it stable. Or maybe you don't even need that ADC.

author: Rufus
author_rank: Super Contributor
timestamp: May 30, 2013, 04:37:19 pm
content: The circuit is just rubbish.You drive the LP2951 feedback input directly from the output of the PWM filter buffer (with a huge 100uF to ground and another huge 100uF from the output). The 470k feedback resistor from the output does nothing.If you drive the FB pin with more than 1.25v the regulator output will be off, with less than 1.25v the regulator output will be hard on - no feedback, no control, no regulation - just junk.Get rid of the 100uF capacitor on the op-amp output. The capacitor on the regulator output should go to ground. Read the data sheet for the requirements of this capacitor.Add a resistor from the FB pin to ground to set the output voltage to about the middle of the required range, the 470k feed back resistor looks too high but I didn't check the data sheet carefully.Also drive the FB pin with a resistor from your filtered PWM output. The FB pin will be at 1.25v. This and the combination of the 3 resistors determine what the regulator output voltage has to be for a given PWM voltage.

author: LeviathanX
author_rank: Newbie
timestamp: May 30, 2013, 05:02:18 pm
content: Thanks for your kind replies...First off this is a prototype board... meant for testing and eleminating issues of planned features...The microcontroller is powered by 5V and 1.2V... All other components are fed by 5V. The overall input voltage is 12V (using at least a 5V fixed voltage regulator; I think we use a 12V fixed Vreg as well since the input can be way higher).The mentioned feedback pin has a "funny" behaviour regarding the PWM. I need to feed the Feedback-Pin with a PWM which yields approx 1.235V (see datasheet), when this is matching the error pin goes off. Leading to a charge of approx 3.25V. When (whatever) is charged I need to lower my duty cycle by a few digits to "pump-it-up" to my desired voltage. And that's where my described problems come in... Meanwhile the feedback pin keeps a constant 1.2509V value (calibrated volt meter)I only can lower the digits, since a raise will cause a discharge and my voltage is gone... I cannot fine adjust, I just can cause charge pumps" (or whatever one might call this).The ADC-Input is to control the voltage regulator; with the current voltage dividers I get an input value which needs to be factored by 2.1 to get the real output voltage. With said delays (due to the charges in my opinion) I can control the output more or less (just happen to have too sudden changes with the current behaviour)...Regarding the Op-Amp: I actually don't know whether my colleague intended to make a real PWM filter or just a current follower...Can you please explain me what exactly is wrong with the low pass and op-amp combination and why does it cause this instability?! As said I'm here to learn (more)...I know the basic stuff, so you don't need to start at ground zero with me(Actually, if I wouldn't know the basic stuff I couldn't do my profession (embedded software engineer for automotive sensors and (signal) measurement equipment; I program the hardware directly and therefore I need to know what it does)). I do circuits, which work, in my free time, but at the company it's my colleagues task. So I'm not a complete douchebag; I can follow the topics...I'm going to read that PWM filter lecture for sure, thanks for the advice.@RufusSorry for my bad handwriting... that's "100nF" not "100µF"The 470k actually helped me with the PWM adjustment... we tried some values here... Usually in the PWM variant this 470k wouldn't be in... The capacitor next to it... hmmm, I'm pretty sure it was not to ground... instead it was fed in the split way of the two resistors (for the fixed resistor other variant (which works)). But there are a lot of resistors coming next (I had to draw it on the second row, since I was out of space on the paper)

author: Rufus
author_rank: Super Contributor
timestamp: May 30, 2013, 06:03:46 pm
content: What you are trying to do won't work - not even close.The gain of an LP2951 from FB pin to output is about 2.5 million. Changing the voltage on the FB pin by 1uV will cause a 2.5v change in the regulator output.If you want a crappy voltage regulator controlled by a software feedback loop just amplify your PWM voltage. If you want a decent regulator use the LP2951 as intended and adjust the output voltage as I previously described. It probably isn't a very good solution but it is close to what you already have.

author: wraper
author_rank: Unknown
timestamp: May 30, 2013, 06:43:28 pm
content: There is really hard to describe why this schematic sucks. Because it just really suck and looks like randomly placed components. It just will not work. I was wrong about limited max output voltage, just checked datasheet after Rufus post. Don't know why I thought that FB pin works like ADJ pin of LM317. LeviathanX, I will draw working schematic for you after some time.

author: wraper
author_rank: Unknown
timestamp: May 30, 2013, 10:00:50 pm
content: Try this circuit, it should work. And it has output voltage limited to your needs. Also you should know that with this schematic Higher PWM - lower output voltage and vice versa. Also duty cycle should not go higher than 80% and lower than 5%. It will not do any bad, however opamp will clip. This is if LM358 is used. It can be different with other opamps, depends of how close to rails they can work. Maybe some resistor around LP2951 would need to be slightly adjusted for desired output voltage range on full PWM range. Also LP2951 must be shut down at schematic power up. Then start PWM and only then enable LP2951. Consider to pull up PWM pin to be sure that output is at minimum when MCU PWM pin is in high impedance state for any reason and LP2951 is enabled.

author: LeviathanX
author_rank: Newbie
timestamp: May 31, 2013, 12:22:04 pm
content: Aw, thank you very much!Let me sum up the errors please. To do so I've put the schematics into clean form (Z-Diodes omitted for simplicity; took some generic Op-Amp just as place-holder). I added necessary pull-ups as you suggested since almost all pins of this MCU are tristate out of reset.I've read the PWM Filter document you've linked me to as well... which brought me some better understanding...And I've re-read the whole datasheet once again... to understand what you and Rufus were suggesting....So I think I finally came to an understanding:First thing you did was to replace the two serial (single pole) low pass filters and the current follower with a two pole Sallen and Key low pass filter (Fc=48,22Hz; Q=0.5); R3 shall limit the current I think. This shall give a more stable and higher quality filtering of the PWM signal.R6 which I omitted in the hand drawn schematic (which explains the capacitor "floating in the air") needs to be present as it stabilizes the feedback line (at least that's how I finally understood the datasheet ("Vref=1,235V applied accross R2 (R6 in this schematic)"))... Though, R6 and R5 are present in the fixed resistor variant mentioned. They were both omitted for the PWM variant as "thought" not to be necessary. I got R5 back in since the changes of the duty cycle were pretty sensitive.So, if I understood it right, my PWM signal was more or less something like an instable "resistor replacement" for R6.... which could explain why this whole thing was so damn unstable (and why I somehow needed R5 back in the line).Uh, I'm eager to try it out right now, but since it's day off due to the holiday yesterday I have to wait for MondayBut, I'm really grateful for both of yours patience on this matter.

author: wraper
author_rank: Unknown
timestamp: May 31, 2013, 01:46:50 pm
content: R3 is not to limit current. It is part of voltage divider together with R5 and R6, however together with C3 it may do some additional filtering. You can change range of the regulation by changing it's value. Also you can change value of R1 and R2 to the same as R5 to shrink your BOM. Anyway you may want to sightly change resistor values in voltage divider when you build it in hardware. And about duty cycle range, I wrote values where going beyond is for sure useless. Better consider 10-70% as a usable working area for LM321/LM358//LM324. Using LM318 is bad idea, it's not designed for such a low voltage supply. Better use LM321 or some other low voltage opamp which can work near to rails.

author: LeviathanX
author_rank: Newbie
timestamp: May 31, 2013, 01:56:43 pm
content: stupid me... yes indeed, part of the voltage divider. (I always mix up, don't know why).Thanks for the other advices I'll see what happens when I (hopefully can) try that out on Monday

author: Rufus
author_rank: Super Contributor
timestamp: May 31, 2013, 02:14:36 pm
content: Quote from: LeviathanX on May 31, 2013, 12:22:04 pmNope you need to understand better. The LP2951 has a -ve feedback system. A proportion of the output voltage is fed to the FB pin and compared a 1.25 reference and the output voltage is driven from the result (as I said with a gain of about 2.5 million).If the LP2951 is in control of the output voltage the FB pin will be at 1.25v and the FB pin is high impedance drawing negligible current.The sum of the currents flowing into the FB pin node must be zero. You have currents inR5 = (Vout - 1.25) / R5R6 = -1.25 / R6R3 = (Vpwm - 1.25) / R3The sum of those must be zero and that is why changing Vpwm will change Vout.You can calculate what Vout will be for a given Vpwm, you can calculate the required resistor values to get the range of Vout vs Vpwm you need. If your PWM and supply that generates it is stable there isn't really any need to measure the output voltage because you know what it will be. You might measure it once in production to calibrate your PWM and take out all the errors in the LP2951 and resistors.

author: LeviathanX
author_rank: Newbie
timestamp: June 10, 2013, 06:12:50 pm
content: Hi,thanks for the explanations... yea, one should not forget Kirchhoff....Anyways... I wanted to report last week that the suggestions went well... or rather said perfect.As you pointed out no adjustments afterwards were necessary so we omitted the Op-Amp totally (Eur 2,- cost reduction!) and went with the slower passive RC-Filter (signals still look very good and stable).So a big thank you to you guys for the great help!!

author: Rufus
author_rank: Super Contributor
timestamp: June 10, 2013, 11:51:27 pm
content: Quote from: LeviathanX on June 10, 2013, 06:12:50 pmThanks for bothering to feedback - have you an address for the bill

author: msnyder19
author_rank: Newbie
timestamp: September 25, 2013, 07:33:28 pm
content: I have a similar requirement except that I simply need to generate two voltages from the LP2951 5.4 volts and 8.4 volts.I was thinking I would connect the feedback pin via a 10K (Say R3) resistor to the FB node and then using a PIC would be toggling it high (Vpic=3.3V) and low (Vpic=0V).I am unable to figure out the correct R1 & R2 values. I tried following the guidelines rufus provided to make all the three currents zero but am still lost.I tried R1 = 22K & R2=47K but in the circuit whenR3 = 10K I get 7.5 V when Vpic = 0 & 5.3 V when Vpic = 3.3R3=4.7K I get 8.2 V when Vpic =0 and 3.4V when Vpic = 3.3Can anyone please help me understand whats going on? I really struggled with trying to solve the equation so a worked out example would be really helpful.ThanksMike

author: wraper
author_rank: Unknown
timestamp: September 25, 2013, 09:42:10 pm
content: R1 = 33K, R2 = 6.8k, R3 = 36K, if Vpic is ideal 0 and 3,3V you will get exact voltages you need.

author: wraper
author_rank: Unknown
timestamp: September 25, 2013, 10:34:07 pm
content: Almost ideal with a standard value resistors even without combining them in series to get needed resistance.

author: msnyder19
author_rank: Newbie
timestamp: September 26, 2013, 02:17:44 am
content: Quote from: wraper on September 25, 2013, 10:34:07 pmThank you so much wraper - I will try it out tomorrow...If it is not too much trouble could you please explain how you arrived at the values - I would really like to learn the theory but unfortunately have been going around in circles :-(