Needed capacitance calculation
It is easier to do this by calculating charge than to attack it via energy.

The easy way to remember the equation that relates current, voltage change, time, and capacitance is: The voltage change is proportional to the current and time, and inversely proportional to the capacitance.  In common units:

&nbsp; &nbsp; dV = A s / F

where dV is the change in volts, A the current in amps, s the time in seconds, and F the capacitance in Farads.

Rearranging this, you can solve for exactly what you want:

&nbsp; &nbsp; F = A s / dV

Now plug in the numbers:  Let's say you want the voltage to drop by no more than 100 mV.  (20 mA)(50 ms)/(100 mV) = 10 mF.