# Reduce output current ripple on hysteretic buck converters

This circuit has clear analogy with a thermostat. It switches heating ON when the temperature has dropped to the lower limit. According with that the mosfet is turned ON when inductor current has dropped to the lower limit. When the mosfet is ON, inductor current grows slowly until the upper limit of the current is reached. Then mosfet is turned OFF and inductor current decays when the magnetic energy is dissipated in resistances and also partially converted to light. Temperature has the same role as inductor current. Thermal capacitance mens the same as inductance.

If you add a capacitor in parallel with LEDs you can in theory lower the light output swinging during the operation cycle, because the cap can supply a part of the led current when inductor current decays. Respectively charging the cap absorbs the peak of the inductor current. But the benefit is neglible because nobody can notice LED current high frequency swinging by eyes. Of course radio interference, which is spred by the led stripe, diminishes.

To get some benefit the total impedance of the capacitor at the operating frequency must be much smaller than the calculated dynamic impedance of the led stripe. Fast calculation shows that 15uF does all which is doable, you get nothing more if you have 2000uF. 15uF must be free of unwanted resistance and inductance to be useful. I'm not at all sure how it should be made using smaller capacitors to keep total impedance less than 35mOhm at 300 kHz.

Now the answer: If there's no unwanted radio interference nor visible light fluctuation, keep that 100nF ceramic or nothing.

**My solution and workarounds**

Thanks to the other answers, the main issue was found: simply measure the actual LED current and not the overall voltage divider with the capacitor (of course!), and you will be fine. But how to do so? Collecting the answers here, you either:

- Measure with a sense resistor in series with the LED(s), given that the resistor is overall way lower than the overall LED(s) dynamic resistance. This may be complicated but doable.
- Extract with calculations the current capacitor, since \$ I = C \frac{dV}{dt} \$, basically consisting in multiplying the slope of the V/s by the capacitance and subtract it from the overall current, but with this you can just assume and never really measure.

But I found a better way to directly address the issue: at 400 mA the light flux vs current is fairly linear, **so I qualitatively measured the light with a photosensor** (the OPT101). The frequency is 10 times its bandwidth in the bare minimum stable configuration, but with the ripple still quite visible.

Here is the setup, made just with what I had around. Is not perfect, dirty, but seems enough to work qualitatively:

The setup on the LED driver side chosen was the one in the OP which led me to use a 7.2 µF to reduce the ripple from 30% to 5% on the LED current. A 6x reduction. The calculations which led to 7.2 µF are in the OP.

As shown in the schematic, with the OPT101 with DC gain of 0.5, directly reading on the scope in AC mode the pin 5, with proper mechanical light attenuation, consisting in just keeping the LED far/inclined enough to not saturate the output. It's important to not dim from the driver! This will change the LED bias characteristics, dynamic resistance and consequently ripple attenuation efficiency with a given capacitor.

So, by reading the results I got, with no capacitor, an output from the photosensor of 35 mV_{p-p}. Spoiler: pictures taken on the scope, not acquisition, be aware.

Then with a 2.2 µF capacitor, 25 mV_{p-p}.

And finally with 6.6 µF (which is less than 7.2 µF, but was what I had at the moment) I've measured 11 mV_{p-p}.

Now, theoretically with 6.6 µF, without considering parasitics, the ripple can be reduced down to 27 mA, which is 5.5 times lower than the original 150 mA. From measurements described above, the output voltage of the sensor is reduced more than 3.2 times.

I consider it within the same ballpark, since I haven't taken into account various parasitics, non-idealities and rounding from graphs which may contribute to a lower ripple attenuation. From this result I feel confident in the attenuation that could be obtained with 7.2 µF, since at least the theoretical calculations seems to be correct.