The objective of this activity is to introduce the reader to the world of passive filter circuits. We will be looking at low-pass and high-pass filters.

**Background**

In the previous course, we examined the transient response of simple RC and RL circuits. It was observed that a square wave signal is attenuated when passed through an RC circuit. To ensure this effect, we chose an input signal frequency that had a period longer than the settling time of the RC circuit (5τ). Higher frequencies introduce new complexities such as Fourier analysis. For the purpose of this write-up, we will agree that a square wave signal is comprised of a sine wave at the main frequency and an infinite number of sine waves at odd multiples of the main frequency (3, 5, 7…). An RC filter attenuates these components differently based on their frequency, with higher frequencies experiencing greater attenuation. As a result, the signal’s slope is gentler, as observed in the previous course. RC and CR circuits are called filters since they allow some frequencies to pass through while blocking others. It should be noted that this explanation is a simplification, and we will not discuss LR circuits. RL circuits behave similarly to CR circuits, while LR circuits behave similarly to RC circuits. It is also important to note that when discussing signals and frequencies, we are referring to sine wave signals at a particular frequency.

**Decibels**

Decibels, marked with dB, are a logarithmic unit, used for measuring relative power. To calculate attenuation (or gain) in dB, the following equation is used:

$G_{dB}=10 \cdot log_{10}(P/P_0)$If that wasn’t confusing enough, it should be noted that decibels are typically used to compare power, but we will be using them to compare voltages. This is possible because we know that power is proportional to the square of the voltage, and since exponents inside a logarithm translate to multiplication outside of the logarithm, we can use the following equation:

$G_{dB}=20 \cdot log_{10}(U/U_0)$Simply put, for every 6 dB, the signal is multiplied (or attenuated) by a factor of two. For example, 30 dB corresponds to 25.

**Phase**

You likely know what happens if we add a fixed value to a sign function: it shifts left/right by a corresponding amount. This shift is known as phase (Ф).

$f(t) = A \cdot sin(2 \pi \cdot f \cdot t + \varphi)$If $\varphi$ equals * π*/2, the sine function transforms into a cosine function. If the offset value equals 2

*or a whole multiple of that, the function is seemingly unaltered.*

**π****Impedance**

Impedance can be thought of as “complex resistance”. It consists of resistance and reactance.

$Z=R+jX$X represents components reactance, which is in a complex domain. It is calculated differently for capacitors and inductors:

$X_C=\frac{1}{2\pi \cdot f \cdot C}$$X_L=2\pi \cdot f \cdot L$The j symbol represents complex operator i because in electronics, the lowercase letter i is already reserved for time variable current. Impedance can also be expressed in polar notation as it helps to illustrate the attenuation and phase shifting of the signal.

$X_C=\frac{1}{2\pi \cdot f \cdot C}$$X_L=2\pi \cdot f \cdot L$Multiplying a signal by

$e^{j \cdot \varphi}$

only shifts its phase by Ф without affecting absolute value. This means we can use |Z| to calculate signal attenuation and Ф for signal shifting.

**Background math / complex voltage divider**

Aside from the name, there is nothing too complex in the underlying math. Voltage divider, where instead of resistances, we are using impedances.

We can recall that output voltage is calculated as:

$u_0=u_i \cdot \frac{Z_2}{Z_1+Z_2}$When considering only signal attenuation, absolute impedance can be used without complex numbers. This method is similar to calculating resistive voltage divider and only applies to a single frequency, as frequency is necessary for reactance calculation. However, this method does not account for phase shift.

When accounting for different frequencies and phase shifts, complex numbers must be used for calculation. Division by complex numbers may be intimidating, but it is necessary for accurate calculations. An example will not be provided for brevity, as this level of calculation is unlikely to be encountered outside of exams.

With the background information covered, the main topic of the course can be discussed.

**Filters**

All filters have in common the corner frequency. It is also known as a cutoff frequency. This is a frequency at which the signal drops by 3 dB, which equals 71% of its initial amplitude:

$\frac{1}{\sqrt 2}$This frequency is calculated as:

$f_c = \frac{1}{2\pi \cdot R \cdot C}$The RC part in the equations presented earlier is denoted by τ, which can be useful in analyzing RL filters.

In simple terms, a low pass filter allows signals below the filter’s corner frequency to pass through with no attenuation and attenuates signals above this frequency at a rate of 20 dB/decade. A decade refers to a range in which the value changes by a factor of ten, such as 1, 10, 100, or 3, 30, or 300.

Regarding phase, it begins to shift one decade before the corner frequency and stops moving one decade after it, resulting in a total shift of 90°. The phase crosses the 45° point at the corner frequency.

In reality, signals seldom behave precisely as described above due to various factors. However, engineers use these simplifications as a starting point until the experimental stage of the analysis.

**Low pass filter**

As mentioned before, a low pas filter is just an RC circuit.

Let’s construct a low pass filter from a 1000 Ω resistor and a 10 nF capacitor. The calculated corner frequency is 15.9 kHz, idealized graph should look a little like this (not that X axis is logarithmic):

In the simplified representation of low pass filters, signal attenuation is presumed to be absent below the corner frequency, while the phase begins to deviate one decade before and stabilizes one decade after this frequency. It is important to note that this representation conflicts with the commonly used definition of corner frequency as the point at which signal amplitude crosses the -3 dB threshold, as in this simplified representation, attenuation at the corner frequency is zero. This discrepancy can be regarded as a minor detail of little practical significance.

**High pass filter**

If low pass is just an RC circuit, high pass filter will probably be a CR circuit.

Let’s take a look at the characteristics of such filter, constructed from same components as before – a 1000 Ω resistor and a 10 nF capacitor. Corner frequency will be the same, 15.9 kHz, but the characteristic curves will be different. Note that the phase axis has been altered.

**Bode analysis**

The process of measuring the characteristics of a filter in a real-world scenario may raise curiosity. The answer to this question is straightforward: we can excite the circuit with a synthesized sine wave at various frequencies within the desired range and then measure the amplitude gain (or attenuation) and phase shift. Red Pitaya offers a built-in bode analysis functionality, which can aid in this process. To better understand this concept, let us construct a low pass filter and connect it to the Red Pitaya device to observe its behavior.

Written by Luka Pogačnik Edited by Andraž Pirc