Hi! I am trying to convert a fully-positive 50Hz square wave into a flat signal using a low-pass filter. However, I can't find any reference to identify the minimum cut-off frequency. How can I do this?
the minimum cut-off frequency has to be calculated if an upper delay limit is given. The rise time is roughly tr = 0.35 / cut-off frequency.
The maximum cut-off frequency depends on how much AC voltage superimposed on the DC output voltage is tolerable:
Per definition, at the cut-off frequency the amplitude of the output voltage is -3 dB less than the input but the extended slope line would yield 0 dB. If the low-pass filter you are using has a constant slope beyond the cut-off frequency you can calculate the ratio of the cut-off frequency and the base frequency of your signal. (Because the harmonics are located further up in the spectrum, they are even more attenuated by the low-pass filter, so you can neglect them.)
Example: The square wave switches between 0 V and +5 V; a peak-to-peak voltage of 10 mV is tolerable on the DC voltage. The slope of the filter is -20 dB/decade. 10 mV / 5 V = 0.002 -> -54 dB. -54 dB / 20 dB = -2.7, so the cut-off frequency of the filter has to be at most 10^-2.7 = 0.002 times the base frequency, in your case about 0.1 Hz.
If the square wave was off, and is switched on at t = 0, about 90 % of the final DC voltage is reached at t = 0.35 / 0.1 Hz = 3.5 s.
So, choosing the actual cut-off frequency is a trade-off between ripple voltage on the output and reaction time.
Active filters often show a more complicated behavior than a straight slope. For an easy solution, you might use a design tool like this one:
When doing that sort of low path filtering (smoothing) you mostly care of the lowest harmonic (50Hz), if you filter it all others will be even more suppressed (for symmetrical signal that will be only odd harmonics 3..5..7 --> 150Hz, 250Hz, 350Hz ). In fact, the residual ripple will usually look as almost pure sinusoidal 50Hz.
2) Calculate how much the 1st harmonic needs to be attenuated until you are left with acceptable ripple. Let's say you need to dampen the harmonic by X dB.
3) Design a low-pass filter that has a stopband of at least -X dB by the time it hits the 1st harmonic.
The explanations made by other researchers must be helpful.
Nevertheless, I want to make some other comments. I will try my best not to make repetitions but to provide better understanding.
The cut-off frequency of your low-pass filter should definitely be lower than 50Hz (fundamental freq. of your square-wave signal). However, keep in mind that the filter will not be an ideal filter; that is, the AC components of your signal (50Hz and its harmonics) cannot be suppressed by your filter completely. For a filter with a gradual transition after cut-off frequency, the cut-off frequency should be chosen very small (Joerg Fricke already provided an example for a 1st-order low-pass filter, with a monotonic transition of roughly -20dB/dec above cut-off frequency).
If you don't want to set the cut-off frequency to a very low value (There may be several reasons for this), then, by using a higher-order filter you can obtain sharper transitions after cut-off frequency. Active filters can provide such behavior more effectively, with which you can also prefer to use Chebyshev, elliptical, etc. types of filter transfer functions to achieve an even sharper transition band (compared to Butterworth) with the same filter order.
I don't know for which application you need the filter, so I am not sure whether you need a very sharp filter or whether active filters are suitable for your application. So, I cannot provide further suggestions.