# Is there a way to buffer current for high usage periods?

I am using a USB port as a power source(500-1000ma) for my latest design(Wireless Comms and lots of LED's) and most of the time things work perfectly. However at times I do get spikes where the current draw can go higher than the supply and restart the MCU.

Is there a solution to store extra current?

I know a battery might solve this but I prefer to not go that way... Any other options?

• If you can't use battery can you add enough capacitance to supply the transient load? – John D Aug 24 '15 at 2:00
• Will your circuit work if you limit the current? – BenG Aug 24 '15 at 2:04
• @JohnD: A USB-compliant device can't have more than 10uF on Vbus. – Ignacio Vazquez-Abrams Aug 24 '15 at 2:08
• @IgnacioVazquez-Abrams Good point, but maybe 10uF is enough, or maybe it can be buffered from Vbus by charging through a resistor and delaying startup of the MCU until the cap is charged. Hard to know without the magnitude and timing of the transient load. – John D Aug 24 '15 at 2:40
• Use a proper power supply, rather than stealing power from USB. – Peter Bennett Aug 24 '15 at 3:41

Providing the circuit with a larger capacitors is a good start. To determine the required capacity you need the energy used during the spike. To do this one can measure voltage and current as a function of time with an oscilloscope. The energy the capacitor has to provide during the spike is roughly $W_S \approx \int_{t_{s0}}^{t_{s1}}u(t)(i(t)-I_{USB,max}) dt$

where $I_{USB,max}$ is the current the USB Port can provide. The energy in a capacitor is

$W= \frac{1}{2}C\cdot V_{USB}^2$ and the capacitor needs to keep at least the voltage $V_\mu$ required to supply the microcontroller. Thus the minimal energy in the capacitor is $W_\mu=\frac{1}{2}\cdot V_{\mu}^2\cdot C$. Consequently we have $W = W_s + W_\mu$ which solves to a minimal capacity of $C=2\frac{\int_{t_{s0}}^{t_{s1}}u(t)(i(t)-I_{USB,max}) dt}{V_{USB}^2-V_{\mu}^2}$ Alternatively set a very large capacitor in parallel to the supply. Measure the current over time during the spike. The minimal capacity would then be $C= \frac{(\overline{I}-I_{USB,max})\cdot T}{V_{USB}}$ where $\overline{I}$ is the arithmetic average of the current flown during the spike.

If those current spikes result from switching the LEDs and the switching timing is not critical (e.g. no optical data transmission) you can add an inductance in series to the LEDs. Sized large enough compared to the needed energy and duration of the spikes this will even the spike over a larger time interval reducing the required capacitor size by using the current supplied via USB. This is not recommended for the time critical wireless communication.

Edit: After a spike there also has to be enough time to the next spike in which the capacitor can be recharged, which depends on $I_{USB,max}$.

There are 3 solutions to your problem as far as I can see:

1. Turn off the low voltage drop detection function in your MCU.
2. Limit the current draw, i.e. remove some of the LEDs, or add higher value resistors.
3. Use super-capacitor such as 1F rated at 5V.
• Not recommended to connect a 1 F supercap directly to your USB port. Use a current limiting circuit! – tomnexus Aug 24 '15 at 18:58