Introduction
As everyone knows, in order to create a passive low pass filter, combing resistive elements with reactive elements happens often. Put simply, a typical circuit composed of resistors and capacitors or inductors. According to theories, the resistor–inductor (RL) lowpass topology is equivalent to the resistorcapacitor (RC) lowpass topology in terms of filtering capability. However. in fact, RC low pass filters are more common, so this article will focus on firstorder RC low pass filters.
In this video, Passive RC Low Pass Filter has been discussed.
Catalog
Ⅰ Typical RC Circuit
The RC circuit has thousands of uses and is a very important circuit to study. Not only can it be used to time circuits, it can also be used to filter out unwanted frequencies in a circuit and used in power supplies, like the one for your computer, to help turn ac voltage to dc voltage.
Figure 1. Typical RC Circuit (DC, AC, and Pulse Signals can all use it)
1.1 Time Domain
Capacitor Current:
According to Kirchhoff’s Voltage Law:
Where, the unit of Ui is volts, the unit of RC is seconds, and τ=RC, get:
Suppose the initial voltage of the capacitor is 0, where:
R=1000Ω
C=4.7uF
Ui=1V
t=0.0001~0.1s
τ=RC
Vc(τ)=0.632
Figure 2. Step Response Curve of a Firstorder RC System
1.2 Frequency Domain
Taking the capacitor voltage as the output, the network function of the circuit is:
Where u1=Ui, u2=Uo
Let ωc be equal to:
, which is the cutoff frequency.
Amplitude and phase angle function:
Value of variables:
R=1000Ω
C=4.7uF
A(fc)=0.707
θ(fc)=45, f=0.001, 1, …….100000.
Amplitude and phase frequency characteristics:
Figure 3.
Figure 4.
Logarithmic representation of amplitudefrequency characteristic:
Figure 5.
 Analysis:
When ω<ωc, the amplitude is a straight line parallel to the coordinate, and there is no attenuation.
When ω>ωc, it is a straight line whose slope is proportional to 20dB/decade.
When ω=ωc, the gain is attenuated to 0.707, which is 3dB, and the phase lags by 45 degrees, corresponding to a lowpass filter. This frequency is usually called the cutoff frequency.
 Disadvantages:
When using this analog filter to suppress lowfrequency interference, the filter is required to have a larger time constant and a highprecision RC network. Increasing the time constant requires increasing the value of R, and meanwhile, the leakage current increases accordingly, thereby reducing the filtering effect.
Figure 6. RC Circuit
Ⅱ Firstorder Low Pass Filter on Software
 Advantages
1) The use of digital filtering algorithms to achieve dynamic RC filtering can well overcome the shortcomings of analog filters.
2) This kind of algorithm is more practical when the simulation constant is required.
3) It has a good inhibitory effect on periodic interference.
4) Save RAM space
 Disadvantages
1) Exit phase lag, resulting in low sensitivity.
2) It cannot filter out interference with a frequency higher than half of the sampling frequency (called the Nyquist frequency. For example, if the sampling frequency is 100 Hz, it cannot filter out interference signals above 50Hz). In this case, an analog filter should be used.
3) For the singlechip microcomputer without multiplication and division running instructions, the workload of the program operation is relatively large.
2.1 Basic Filtering Algorithm
 Origin of the Algorithm
The transfer function of the firstorder RC lowpass filter in the S domain for frequency analysis:
Through ztransformation (there are many methods, such as firstorder forward difference, bilinear transformation, etc. Here, the firstorder backward difference method is used):
 Into the Sdomain Transfer Function
After the derivation is transformed into the difference equation, we can get:
The transfer function in the S domain can be transformed into a difference equation in the time domain through the Z transformation.
2.2 Basic Algorithm of Firstorder RC Digital Filtering
X is the input, Y is the output value after filtering, then: a is a parameter related to the RC value, called the filter coefficient, its value determines the weight of the new sample value in the filtering result of this time, and its value is usually far less than 1, when the sampling interval t is small enough:
1) The smaller the filtering coefficient, the smoother the filtering result, but the lower the sensitivity.
2) The larger the filtering coefficient, the higher the sensitivity, but the more unstable the filtering result.
3) The output value this time mainly depends on the last filtered output value, and the current sampled value has a relatively small effect on this output, which plays a corrective role.
4) Cutoff frequency
For example: t=0.5s (f=2Hz), a=1/32
where fl=(1/32)/(2*3.14*0.5)=0.01Hz
 Basic Program
Write the program according to the basic principles and formulas of firstorder filter, as follows:
/*In the program, integer arithmetic is faster than decimal arithmetic. In order to speed up the processing speed of the program, for calculation convenience, a is an integer (from 0~255), 1a is replaced by 256a, which means that the new sample value is being filtered. The weight in the result (you can also change the base of 1a to 100a, and the calculation result will be processed accordingly)*/
#define a 128
char value; //Last filtering value
char filter()
{
char new_value;
new_value=get_ad();//Sampling value
return(256a)*value/256+a*new_value/256；
}
 Initial Optimization of the Program
Reduce the number of operations of multiplication and division to increase the speed of operations.
Specific optimization methods:
First compare the new sampled value with the previous filtering result, and then use different formula calculations based on the comparison, so that the calculation efficiency of the program is doubled.
Resolve the basic formula to get:
 Process
Notes:
S → New Sampling Value
R → Previous Filtering Result
C→ Filter Coefficient
N→ New Filtering Result
 Program
/*Int: NEW_DATA New sampling values
OLD_DATA Last filtering result
k Filter coefficient (0~255)
Out: The filtering results
*/
char filter_1(char NEW_DATA,char OLD_DATA,char k)
{
int result;
if(NEW_DATA<OLD_DATA)
{
result=OLD_DATANEW_DATA;
result=result*k;
result=result+128;//+128 Round Up
result=result/256;
result=OLD_DATAresult;
}
else if(NEW_DATA>OLD_DATA)
{
result=NEW_DATAOLD_DATA;
result=result*k;
result=result+128;//+128 Round Up
result=result/256;
result=OLD_DATAresult;
}
else result=OLD_DATA;
return((char)result);
}
 Filtering Analysis
When the filtering coefficient is 30:
Figure 7.
When the filtering coefficient is 128:
Figure 8.
When the filtering coefficient is 200:
Figure 9.
It can be seen that the smaller the filtering coefficient, the smoother the filtering result, but the lower the sensitivity. On the contrary, the larger the filtering coefficient, the higher the sensitivity, but the more unstable the filtering result.
 Insufficient
1) The contradiction between sensitivity and smoothness
2) Errors caused by discarding decimals.
For example: the current sampling value=25, the last filtering result=24, and the filtering coefficient=10;
According to the algorithm, the filtering result of this time = 24.0390625
In singlechip microcomputers, floatingpoint numbers are rarely used, and the fractional part is either discarded or needs to round up. In this way, the result is 24. If the sampling value is always 25, the result will always be 24. Because the filtering result and the actual data will always have an error that cannot be eliminated. Sometimes it will cause the filtering result curve to deviate from the actual value when the sampling data is stable at a certain value (that is, there is a large error between the filtering result and the actual result although in a stable case).
 Be Careful
1) Changing the filtering coefficient, increasing it will reduce the smoothness, and if it is too large, the filtering will lose its meaning.
2) The use of decimal part in calculations will bring heavy computational pressure to the CPU.
Ⅲ Optimization Method Filtering Coefficients Adjustment
 Realize the Function
1) When the data changes rapidly, the filtering results can be followed up in time, and the faster the data changes, the higher the sensitivity should be (sensitivity priority principle).
2) When the data becomes stable and oscillates within a range, the filtering result can become stable (the principle of stability first).
3) When the data is stable, the filtering result can be approximated and finally equal to the sampling data (eliminate the error caused by decimals in the calculation).
 Judgment before Adjustment
1) Whether the data changes consistently. For example, when the two consecutive sampling values are larger than the previous filtering result, it is normal, otherwise it is regarded as inconsistent.
2) Whether the data changes quickly, which is to judge the difference between the sampling value and the previous filtering result.
Adjustment Principle
1) When the two data changes are inconsistent, it means there is jitter. Clear the filtering coefficient to zero, and delete the new sampling value.
2) When the data changes consistently, gradually increase the filtering coefficient to provide the weight of this sampling.
3) When the data changes quickly (difference value> debounce count acceleration response threshold), the filtering coefficient should be increased quickly.
 Adjusting Filter Coefficient Process
① Calculate the difference (absolute value) between the current sampling value and the last filtering result; Set the data change direction flag.
② Two changes in the same direction?
③ First order filter coefficient + coefficient increment (the maximum value is taken when the result is greater than the maximum value).
 Several Constant Parameters and Their Ranges
1. Debounce counting acceleration response threshold is determined according to the actual situation.
2. The maximum value of debounce count, which is generally 10.
3. The increment of filtering coefficient range is 10~30.
4. The maximum value of the filtering coefficient is generally 255.
Before starting the firstorder filtering program, open the adjustment filter coefficient program to adjust the coefficients in real time.
 Filtering Effect
1. When the sampled data is accidentally interfered, the interference in the filtering result is completely filtered out.
2. When the data oscillates within a range, the filtering result curve is very smooth, almost a straight line.
3. When the sampling data has real changes, the filtering results can be followed up in a relatively timely manner.
4. When the sampling data becomes stable, the filtering result gradually approaches and is finally equal to it.
Finally, improve the algorithm. Taking into account the requirements of sensitivity and stability; and meanwhile, it does not consume too much RAM space. As long as a few constants are adjusted reasonably, the algorithm is more suitable for practical applications.
Frequently Asked Questions about RC Low Pass Filter
1. What is RC low pass filter?
A low pass filter is a filter which passes lowfrequency signals and blocks, or impedes, highfrequency signals. ... Low pass filters can be constructed using resistors with either capacitors or inductors. A low pass filter composed of a resistor and a capacitor is called a low pass RC filter.
2. Why RC circuit is low pass filter?
Then by carefully selecting the correct resistorcapacitor combination, we can create a RC circuit that allows a range of frequencies below a certain value to pass through the circuit unaffected while any frequencies applied to the circuit above this cutoff point to be attenuated, creating what is commonly called a rc low pass fiter.
3. What is difference between RC low pass filter and RC high pass filter?
Low pass filter is the type of frequency domain filter that is used for smoothing the image. It attenuates the high frequency components and preserves the low frequency components. High pass filter: ... It attenuates the low frequency components and preserves the high frequency components.
4. What is the transfer function of a low pass filter?
Low Pass Filters and their Transfer Functions
As its name implies, a low pass filter is an electronic device that allows low frequency AC signals to pass a current through the filter circuit. The output from the filter circuit will be attenuated, depending on the frequency of the input signal.
5. How is low pass filter frequency calculated?
The cutoff frequency or 3dB point, can be found using the standard formula, ƒc = 1/(2πRC). The phase angle of the output signal at ƒc and is 45o for a Low Pass Filter.
Ordering & Quality
Photo  Mfr. Part #  Company  Description  Package  Qty  Pricing (USD) 

SJ5023GRAY  Company:3M  Remark:Bumper Square, Tapered 0.810" L x 0.810" W (20.57mm x 20.57mm) Polyurethane Gray  Package:N/A 
N/A 
In Stock:On Order Inquiry 
Price:

Inquiry  
SJ5023BROWN  Company:3M  Remark:Bumper Square, Tapered 0.810" L x 0.810" W (20.57mm x 20.57mm) Polyurethane Brown  Package:N/A 
N/A 
In Stock:On Order Inquiry 
Price:

Inquiry  
SJ5023WHITE  Company:3M  Remark:Bumper Square, Tapered 0.810" L x 0.810" W (20.57mm x 20.57mm) Polyurethane White  Package:N/A 
N/A 
In Stock:On Order Inquiry 
Price:

Inquiry  
SJ5023BLACK  Company:3M  Remark:Bumper Square, Tapered 0.810" L x 0.810" W (20.57mm x 20.57mm) Polyurethane Black  Package:N/A 
N/A 
In Stock:On Order Inquiry 
Price:

Inquiry 
0 comment