(Recommended for collection) Read the entire RC filter design process in one article
Today I would like to share with you an article about RC filter design. About an embedded system, you can say "no filter, no built-in". Different sensor signals will carry some noise signals to a greater or lesser extent, and then pass filter can better reduce and remove noise, restore real useful signal,
Passive RC filters are of course preferred cheap design among most filters, and can be converted to software filters relatively easily, so software and hardware filtering is a discrete digitization process, so overall design is similar.
However, most engineers who have worked for many years still blindly tune parameters of RC filter, which is somewhat bleak, so following materials will help you better understand filter and design process.
Of course, many will ask that there are many more complex filters, such as FIR, IIR, etc. In fact, they all go through small differences, so let's stop talking nonsense and continue reading text!
One, time and frequency domain
When you view an electrical signal on an oscilloscope, you will see a line representing change in voltage over time. At any given moment, signal has only one voltage value. What you see on an oscilloscope is a representation of signal in time domain.
The typical waveform display on an oscilloscope is very intuitive, but also somewhat limited in that it does not directly display frequency content of signal. The opposite of time domain representation is frequency domain, where a moment in time corresponds to only one voltage value. Frequency domain representation (also known as spectrum) conveys information about a signal by identifying various frequency components that are present at same time.
Second, what is a filter
A filter is a circuit that removes or "filters out" a specific range of frequency components. In other words, it separates frequency spectrum of signal into frequency components to be passed through and frequency components to be blocked.
Unless you have much experience in frequency domain analysis, you may still not know what these frequency components are and how they can coexist in a signal that cannot have multiple voltage values at same time. Let's look at a short example to help clarify this concept.
Suppose we have an audio signal that consists of a perfect 5kHz sine wave. We know what a sinusoid looks like in time domain, in frequency domain we only see a frequency "burst" at 5 kHz. Now let's assume that we have activated oscillator at 500 kHz to introduce high frequency noise into audio signal.
The signal seen on oscilloscope is still a sequencevoltages with a value at each point in time, but signal will look different because its changes in time domain should now reflect a 5 kHz sine wave and high frequency noise fluctuations.
However, in frequency domain, sine waves and noise are separate frequency components that coexist in same signal. Sine waves and noise occupy different parts of signal representation in frequency domain (as shown in Figure 1), which means that we can filter out noise with circuits that route signal through low frequencies and block high frequencies.
Figure 1. Different distribution of parts of a sinusoidal and noise signal in frequency domain
Third, filter type
Filters can be placed into broad categories corresponding to general characteristics of filter's frequency response. If a filter passes low frequencies and blocks high frequencies, it is called a low pass filter, if it blocks low frequencies and passes high frequencies, it is a high pass filter. There are also bandpass filters that pass only a relatively narrow range of frequencies, and notch filters that block only a relatively narrow range of frequencies (Figure 2).
Figure 2. Frequency domain representation of each filter
A filter can also be classified by type of components used to implement schema. Passive filters use resistors, capacitors, and inductors; these components do not provide gain, so passive filters can only maintain or reduce amplitude of input signal. On other hand, an active filter can both filter signal and apply amplification because it includes active components such as transistors or op amps (Figure 3).
This active low-pass filter is based on popular Sallen-Key topology.
Click on blue link to learn more about Sallen-key: Active Filter-Sallen-key topology
This article discusses analysis and design of passive low-pass filters. These circuits play an important role in various systems and applications.
Fourthly, RC low pass filter
To create a passive low pass filter, we need to combine a resistive element with a reactive element. In other words, we need a circuit consisting of resistors and capacitors or inductors. Theoretically, a resistor-inductor (RL) low-pass topology is comparable to a low-pass resistor-capacitor (RC) topology in terms of filtering capabilities. But in fact, resistor-capacitor approach is more common, so rest of this article will focus on RC low-pass filters (Figure 4).
Figure 4. RC Low Pass Filter
A low-frequency RC response can be created by connecting a resistor in series with signal path and a capacitor in parallel with load, as shown in figure. In diagram, load is represented by a single component, but in real circuits, it can be more complex, such as an analog-to-digital converter, an amplifier, or an oscilloscope front end used to measure response of a filter.
The filtering action of an RC low-pass topology can be intuitively analyzed if we understand that resistors and capacitors form a frequency-dependent voltage divider (Figure 5).
Figure 5. Redrawing RC low pass filter to look like a voltage divider
When input frequency is low, impedance of capacitor is higher than impedance of resistor, so most of input voltage drops across capacitor (and across load, in parallel with capacitor). ). When input frequency is high, impedance of capacitor is lower than impedance of resistor, which means that voltage across resistor decreases and less voltage is transferred to load. Therefore, low frequencies are passed, and high frequencies are blocked.
This qualitative explanation of RC's low pass function is an important first step, but it's not very helpful when we need to actually design circuits because terms "high frequency" and "low frequency" are very vague. Engineers need to create circuits that pass and block certain frequencies. For example, in audio system above, we want to keep 5 kHz signal and reject 500 kHz signal. This means we need a filter that transitions from pass to block between 5kHz and 500kHz.
The frequency range where filter does not cause significant attenuation is called passband, and frequency range where filter causes significant attenuation is called stopband. Analog filters, such as RC low-pass filters, always transition from passband to stopband. This means that one frequency at which filter stops passing signal and starts blocking it cannot be identified. However, engineers need a way to conveniently and succinctly generalize frequency response of a filter, and this is where concept of cutoff frequency comes into play.
When you look at frequency response graph of an RC filter, you will notice that term "cutoff frequency" is not very accurate. An image in which signal spectrum is "cut" in half, one of which is kept and other is discarded, is not applicable, because attenuation gradually increases as frequency moves from lower cutoff to upper cutoff.
The cutoff frequency of RC low-pass filter is actually frequency at which amplitude of input signal is reduced by 3 dB (this value was chosen because a 3 dB reduction in amplitude corresponds to a 50% reduction in power). Therefore, cutoff frequency is also called -3 dB frequency, which is actually a more accurate and informative name. The term "bandwidth" refers to bandwidth of filter, which in case of a low-pass filter is -3 dB (as shown in Figure 6).
In fig. 6 shows overall frequency response of an RC low pass filter with a -3 dB bandwidth.
As mentioned above, low-pass filter behavior of an RC filter is caused by interaction between frequency-independent resistor impedance and frequency-dependent capacitor impedance. To determine details of a filter's frequency response, we need to mathematically analyze relationship between resistance (R) and capacitance (C), and we can manipulate these values to design a filter that meets specifications exactly. The cutoff frequency (f) of RC low pass filter is calculated as follows:
Let's look at a simple design example. Capacitor values are more restrictive than resistor values, so we will start with a total capacitance value such as 10nF and then use this formula to determine required resistor value. The goal is to design a filter that will retain 5 kHz sound waveform and reject 500 kHz noise waveform. We will try a cutoff frequency of 100 kHz, later in article we will analyze in more detail effect of this filter on two frequency components, the formula is shown in Figure 8.
So a 160 ohm resistor combined with a 10nF capacitor will give us a filter that matches desired frequency response very closely.
5. Calculate filter response
We can calculate theoretical behavior of a low pass filter using a frequency dependent version of a typical voltage divider calculation. The output of resistor divider is shown in Figure 9:
The RC filter uses a similar structure, but instead of resistor R2, a capacitor is used (Fig. 10). First, replace R2 (in numerator) with reactance (XC) of capacitor. Next, we need to calculate total impedance and put it in denominator. Thus, we have (Figure 11):
The reactance of a capacitor is reciprocal of current, but unlike resistance, reciprocal depends on frequency of signal passing through capacitor. Therefore, we must calculate reactance at a certain frequency as follows (Fig. 12):
In design example above, R≈160 ohms and C=10nF. Let's assume that VIN has a value of 1V, so we can simply exclude VIN from calculation. First, we calculate value of VOUT at frequency of sinusoid (Figure 12):
The amplitude of sinusoid is basically constant. This is normal, since our goal is to keep sine wave while suppressing noise. This result is not surprising since we have chosen a cutoff frequency (100 kHz) which is much higher than sine frequency (5 kHz).
Now let's see how filter successfully attenuates noise component (Fig. 14).
The amplitude of noise is only about 20% of original value.
6. Visualize filter response
The most convenient way to evaluate effect of a filter on a signal is to examine filter's frequency response graph. These plots are often referred to as Bode plots and have amplitude (in decibels) on vertical axis and frequency on horizontal axis; horizontal axis usually has a logarithmic scale, so that physical distance between 1 Hz and 10 Hz is same as between 10 Hz and 100 Hz, same physical distance between 100 Hz and 1 kHz, etc. (Fig. 15). This configuration allows you to quickly and accurately evaluate behavior of filter over a wide frequency range.
Figure 15: Example of a frequency response plot
Each point on curve represents amplitude of output signal if input signal had an amplitude of 1 V and a frequency equal to corresponding value on horizontal axis. For example, when input frequency is 1 MHz, output amplitude (assuming input amplitude is 1 V) will be 0.1 V (because -20 dB corresponds to a tenfold reduction factor).
The general shape of this frequency response curve will become very familiar if you spend more time with filter circuits. The passband curve is almost perfectly flat, then starts to fall off faster as input frequency approaches cutoff frequency. Eventually rate of attenuation change (called roll-off) stabilizes at 20 dB/decade, i.e. for every tenfold increase in input frequency, output signal amplitude decreases by 20 dB.
7. Evaluate effectiveness of low-pass filter
If we carefully plot frequency response of filter we designed earlier in this article, we can see that amplitude response at 5kHz is almost 0dB (i.e., a gain of 0.2). These values are consistent with calculations we performed in previous section.
Because RC filters always have a gradual transition from passband to stopband, and attenuation never reaches infinity, we cannot design a "perfect" filter, i.e. one that does not affect sine wave and completely eliminates noise device. Instead, we always have compromises. If we move cutoff frequency closer to 5kHz, we have more noise attenuation, but also more attenuation of sine wave we want to send to speaker. If we move cutoff frequency closer to 500kHz, we have less attenuation at sine wave frequencies, but also less attenuation at noise frequencies.
We discussed above how filters change amplitude of various frequency components of a signal. However, in addition to amplitude effects, reactive circuit elements always introduce phase shifts.
Eight, low-pass filter phase shift
The concept of phase refers to value of a periodic signal at a certain point in cycle. So when we say that a circuit causes a phase shift, we mean that it introduces a skew between input and output signals: input and output signals no longer start and end their cycles at same moment. The value of phase shift (eg 45° or 90°) indicates amount of shift produced.
Each reactive element in circuit introduces a 90° phase shift, but this phase shift does not occur at same time. The phase of output signal, like amplitude of output signal, gradually changes as input frequency increases. The RC low pass filter has a reactive element (capacitor), so circuit also results in a 90° phase shift.
Like amplitude response, phase response is most easily assessed by examining a graph in which horizontal axis represents logarithmic frequency. The following description is a general diagram, see fig. 16.
Initially, phase shift is 0°.
The phase shift gradually increases until it reaches 45° at cutoff frequency; during this part of response, rate of change gradually increases.
After cutoff frequency, phase shift continues to increase, but rate of change gradually decreases.
When phase shift approaches 90°, rate of change becomes very slow.
The solid line is amplitude response and dotted line is phase response. Cutoff frequency 100 kHz. Note that phase shift at cutoff frequency is 45°.
Nine, second-order low-pass filter
Until now, we have assumed that an RC low-pass filter consists of a resistor and a capacitor. This configuration is a first order filter.
The "order" of a passive filter is determined by number of reactive elements (ie capacitors or inductors) in circuit. Higher order filters have more reactive components, resulting in more phase shift and steeper rolloff, which is main motive for increasing filter order.
Adding a reactive element to filter, such as 1st to 2nd order or 2nd to 3rd order, increases maximum rolloff by 20 dB per decade.
Second order filters are usually built around a resonant circuit consisting of an inductor and a capacitor. This topology is called RLC (Resistor-Inductor-Capacitor). However, it is also possible to create second-order RC filters. As shown in figure below, all we need to do is cascade two first order RC filters (Figure 17).
While this topology certainly provides a second-order answer, it is not widely used. As we will see in next section, its frequency response is generally not as good as active second order filters or second order RLC filters.
Frequency response of tenth and second order RC filters
We can try to design a first order filter according to desired cutoff frequency and then choose two of them to be connected in series to form a second order RC low pass filter. This allows filter to exhibit a similar overall frequency response with a maximum rolloff of 40dB/decade instead of 20dB/decade.
However, if we take a closer look at response, we can see a -3 dB reduction in frequency. The second order RC filter does not behave as expected because two filter stages are not independent, so two filters cannot simply be connected together and circuit analyzed as a first order low pass filter superimposed on an identical same order low pass filter. go through filtering.
Also, even if we insert a buffer between two stages so that 1st and 2nd order RCs can be used as independent filters, attenuation at original cutoff frequency will be 6dB instead of 3dB. Precisely because two stages work independently. The first filter has 3 dB of attenuation at cutoff frequency, and second filter adds another 3 dB of attenuation (Figure 18).
A fundamental limitation of second-order RC low-pass filters is that designers cannot fine-tune transition from passband to stopband by adjusting Q factor of filter; this parameter specifies how much frequency response is attenuated. If two identical RC low-pass filters are connected in cascade, overall transfer function corresponds to a second-order response, but quality factor is always 0.5. At Q = 0.5, filter is at edge of overdamping, which leads to a “drop” in frequency response in transition region. Active second order filters and resonant second order filters do not have this limitation; designers can control quality factor to fine-tune frequency response in transition region.
All electrical signals are a mixture of useful and unwanted frequency components. Unwanted frequency components are often caused by noise and interference, and in some cases can adversely affect system performance.
A filter is a circuit that reacts differently to different parts of signal spectrum. The low-pass filter is designed to pass low-frequency components and block high-frequency components.
The cutoff frequency of a low pass filter indicates frequency range over which filter changes from low to high attenuation.
The output voltage of an RC low-pass filter can be calculated by considering circuit as a voltage divider consisting of resistance (independent of frequency) and reactance (depending on frequency).
Plots of amplitude (in dB on vertical axis) versus logarithmic frequency (in hertz on horizontal axis) are a convenient and effective way to check theoretical behavior of filters, as well as phase and plot of logarithmic frequency. to determine amount of phase shift applied to input signal.
Second order filters have a steeper rolloff; this second order characteristic is useful when signal does not provide wideband separation between wanted and unwanted frequency components.
It is possible to create a second order RC low pass filter by building two identical first order RC low pass filters, then connecting output of one to input of other, but final overall frequency of -3 dB will be lower than expected.
- What is drowning in gold? Why Shen Jin?
- This is a metaphor for EMI/EMS/EMC that can be understood at a glance.
- How many types of pads have you seen in PCB design?
- Summary of Common PCB Repair Techniques
- What is three anti-paint? How to use it correctly?
- Knowing these rules, you will not get confused looking at circuit diagram.
- How to make anti-interference PCB design?
- Can diodes do this?