Gas station without pumps

2017 August 28

More on cheap buck regulators

Filed under: Robotics — gasstationwithoutpumps @ 18:40
Tags: , ,

A couple of days ago, I wrote about the cheap buck regulators I bought, and expressed some confusion about how poorly they were working.  I’ve spent a couple of days trying to diagnose the problem, and I think it is beginning to make some sense to me.

First, the parts are almost certainly knockoffs of the original MP1584 parts, since those parts cost over $1 in 1000s and the whole board was about 44¢ in 1s.  I’ve not been able to find a good photo of an authentic part, to see if the markings match. The only data sheet available is the original one, which may or may not describe the internals of this chip accurately.

Second, I unsoldered the inductor from one of the boards using a hot-air tool, and soldered on header pins for easy testing.  The inductor appears to be a 1.5µH inductor (though the picture on the website clearly showed a 4.7uH inductor).  The smaller inductor results in larger current ripple.  According to the datasheet, a 1.5µH inductor for a 6V output with a 12V input and 930kHz switching frequency would result in about a 2A peak-to-peak current ripple, and the peak current would be about 1A higher than the load current.  Since the part is supposed to have a maximum switch current of 4A, this is consistent with a 3A limit for the board.

Third, I reverse-engineered the board as best I could by tracing wires, reading resistor values, and measuring capacitances.  It is hard to measure capacitance in circuit, and only the input and output capacitors are reasonably reliable.

 

Reverse-engineered board schematic. The design is essentially the same as the examples in the data sheet (other than too small an inductor).

I spent a lot of time with my Analog Discovery 2, trying to plot voltage and current curves for different loads.  I ran into some difficulty, as my 1Ω power 10W resistor that I tried using for sensing had too much inductance, so I ended up using two 0.5-ohm ¼W resistors in parallel for my sense resistor. (For lower currents, I initially used just one resistor, but at high currents that would have gotten too hot.)

I tried also playing with non-resistive loads (putting an inductor in series with the resistor or a capacitor in parallel).  What I expected to see was that putting an inductor in series would reduce the current ripple, and that putting a capacitor in parallel would reduce the voltage ripple.  Putting a 100µH inductor in series with the load did indeed smooth out the current ripple as expected.

But capacitors had a weird effect. Here are some of the plots:

Putting a big low-ESR (aluminum polymer) capacitor in parallel with the load increased the voltage ripple instead of decreasing it!

Voltage ripple was fairly constant for moderate loads, but got extreme once the current requested got high.

The ±50mV voltage ripple had a frequency of about 930kHz, which was consistent with the 100kΩ resistor used on the FREQ input. At larger currents  (somewhere between 1.34A and 1.46A) the frequency dropped by a factor of 4 or 5, and the ripple went way up.

At first, I could not understand how capacitors could increase the ripple, nor could I make sense of the dV/dt slopes of the voltage.  Partly this came from misunderstanding the block diagram:

Block diagram, copied directly from the data sheet for the MP1584 (copyright Monolithic Power Systems Inc.).

I thought that the system was a simple PWM system, with the oscillator turning on the nFET between SW and Vin, and the feedback deciding when to turn it off.  When the nFET is on, the inductor (and load) current rises. When the inductor is off, the inductor continues to conduct, pulling SW down and eventually turning on the Schottky diode.

The set-reset latch (cross-coupled NAND gates) in the middle makes it look like a simple 2-state system: ON and OFF, but it turns out to be more complicated than that.  The oscillator does indeed turn the nFET on, but the feedback does not turn it fully off. Instead, the nFET oscillates between being on and being off, possibly based on the SW voltage.  The block diagram shows the gate voltage of the nFET as being referenced to SW, so once the nFET is off it should stay off, but I suspect that there are delays that result in the nFET turning back on as SW drops (at least if SW drops fast enough).

I tried looking at the input current to the regulator, which should spike up every time the nFET is turned on.  (Because I was using a 0.25Ω sense resistor on the input and the input capacitor seems to be 10µF, there is a 2.5µs RC time constant that averages out the input current, keeping it from appearing as large spikes.)

The spikes on the input current shows that the nFET turns on and off several times during the cycle, not just once when the oscillator requests it. The input current spikes correspond to places where the output voltage is rising.
Note: this plot averages 500 traces, to reduce the noise on the current measurements.

So the system is not a simple PWM switching between on and off, but switches between on and pulsing. The pulses seem to be around 7.4 MHz, much faster than the oscillator (about the 8th harmonic).

I think I have an explanation for the switching to lower frequencies for the ripple and getting larger ripples at low frequencies. The R+C circuit on the COMP pin is integrating a current proportional to the error to get an error control voltage.  That means that we have essentially a PI (proportional-integral) control loop, with R setting the coefficient for P and C setting the coefficient for I.  When we don’t have sufficient actuator values (that is, when we can’t raise the voltage fast enough with the FET on or lower if fast enough with the FET off), the integrator suffers from “integrator windup” (see my discussion in controlling temperature with just a heater and fan), accumulating lots of error that takes time to be erased.  Windup causes there to be massive overshoot.

We can fix the windup problem by either reducing the integrator coefficient (reducing the capacitor size on the COMP node, whose current size I’m uncertain of) or by using a larger inductor, so that the current changes less when the FET switches, and the time constant of the system is better matched to the integration time constant set by the RC value. [Update 2017-Sep-2: the reasoning here is wrong.  See Correcting reasoning on buck regulators.]

The data sheet makes it clear that the MP1584 is not designed to be used as an adjustable regulator—the R3 and C3 values for the compensation need to be adjusted based on the load resistance, the output capacitor, the output voltage, and the frequency.  They recommend choosing a switching frequency, then setting a crossover frequency to about 0.1 times that.  If we keep the 930kHz switching frequency, then f_c=93kHz.  They then recommend R_3=\frac{2\pi f_c C_2}{G_{EA} G_{CS}} \frac{V_{out}}{V_{FB}}, where C_2 is the output capacitance G_{EA}=60\mu A/V is the error amplifier transconductance, G_{CS}=9A/V is the current-sense amplifier transconductance, and V_{FB}=0.8V is the feedback voltage.  For a 10µF output capacitor and a 6V output, this would set R3=81kΩ, close to the 100kΩ chosen.  With a 470µF output capacitor, R3 would need to increase to around 390kΩ.

To choose C3, they recommend C_3 > \frac{4}{2\pi f_c R_3}, or C_3 > 68pF for R3=100kΩ, and I think that they chose 100pF (but I’m not certain).  With this method for picking R3 and C3, they are setting the RC time constant larger than 4 times the time constant for the crossover frequency, or larger than 40 times the time constant for the switching frequency.  The tradeoff between R3 and C3 is based on the output capacitance  (and output voltage and switching frequency), with larger output voltage, capacitance or switching frequency increasing R3.

I think that the values for R3 and C3 are reasonable on the board, but there is nothing on the data sheet about what to do when integrator windup happens—they recommend big enough inductors that I don’t think it is a problem for them, so I’m going to try replacing the inductor on the board with a good 10µH inductor, probably Abracon ASPI-0630LR-100M-T15, which looks like it is close enough in size to solder onto the same pads.  I’ll let people know in a couple of weeks whether this works.

 

Advertisements

1 Comment »

  1. […] In More on cheap buck regulators, I wrote […]

    Pingback by Correcting reasoning on buck regulators | Gas station without pumps — 2017 September 2 @ 13:10 | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: