Circuit analysis is the core course of electrical information and related majors. This paper presents an experimental project of integrated circuit analysis and design based on programmable filter and microcontroller. The host computer sends instructions to the microcontroller, drives the GPIO port and timer of the microcontroller to configure the programmable filter, and can obtain filters of different types, thermostatic element central frequency and bandwidth.
This project involves the knowledge of analog circuit and digital circuit. It enables students to intuitively understand the frequency characteristics of signals, comprehensively exercise students’practical abilities such as filter design, microcontroller programming and so on. Circuit analysis is the core course for students majoring in electrical information and related specialties, and is the basis for the follow-up electrical courses. As a course that combines theory with practice, circuit analysis experiment can make students understand the course knowledge more deeply and improve their practical ability at the same time. The first part of the experimental course generally arranges relatively independent circuit experiments, such as volt-ampere characteristic experiment, resonant circuit frequency characteristic experiment, analog filter experiment and so on. The integrated design experiment is equivalent to a small design project, which is usually arranged at the back of the experimental course. After students have basic circuit knowledge and experimental operation experience, through comprehensive design experiments, they can integrate the knowledge learned, and further enhance their practical ability. Aiming at the above requirements of circuit analysis experiment, this paper presents a comprehensive design experiment based on programmable filter and microcontroller. By using digital integrated circuit, students can deepen their understanding of signal frequency characteristics and grasp the physical significance of signal frequency band, quality factor and other parameters. Programmable filter is a kind of filter which can realize different types, central frequency and bandwidth through microcontroller programming. It is an active filter.
Compared with the traditional passive filter composed of RLC basic components, programmable filter has the advantages of fewer components, easy to adjust and easy to control. In this experiment, Maxim’s dual-channel universal switched capacitor active power filter chip Max261 is selected.
It can realize 64-step adjustable central frequency control and 128-step adjustable quality factor control. The central frequency can reach 57 kHz. The filter can be configured into five types of filters: low pass, high pass, band pass, all pass and band stop. The output of different filter types is controlled by different pins. After the type is determined, the central frequency and bandwidth of the filter can be realized by programming the frequency ratio N and the quality factor Q. Frequency ratio N = fCLK / f0, where fCLK is the input external clock frequency and F0 is the filter central frequency. Q = F0 / B is the quality factor and B = fH – fL is – 3dB bandwidth. The parameters of the filter can be adjusted by configuring the frequency ratio N and the quality factor Q of the filter with a microcontroller. In this design experiment, microcontrollers are needed to transmit the filter instructions and receive the upper computer instructions. The microcontrollers are STM32F407 with 32 bits and 168MHz main frequency of Italian Semiconductor Company. In the experiment, three kinds of peripheral modules of STM 32 are needed, namely GPIO, Timer and USART.
Seven GPIOs connect seven ports of WR, A0-A3, D0 and D1 of Max 261. WR is a low-level effective read-write signal; A1-A3 is the address, which points to the mode, frequency and quality factor parameters of the two-channel filter; D0 and D1 are read-write data, which are pushed into Max 261 bit by bit by shift. Timer generates PWM signals with adjustable duty cycle of 50% to provide clock signals for filters. In order to change the parameters of the filter on-line conveniently, this experiment sends instructions to STM32 through the serial port of the host computer.
If the host computer has 9-pin serial port of RS232, it can communicate with STM32 through Max3232 chip. If the host computer does not have RS232 serial port, the communication between USB serial port and STM32 can be realized by FT232 chip.
STM32 receives instructions from the host computer through serial interrupt, and decodes the instructions in real time and configures Max 261 through subroutines. In this section, an example of a band-pass filter with F0 = 2kHz, – 3dB upper and lower cut-off frequencies fH and fL of 2250Hz and 1750Hz respectively is given to further introduce the experimental process. According to the data manual of Max 261, the frequency ratio of N=100.53 can be selected. The calculated clock frequency is 201.06kHz. The clock signal is generated by Timer of STM32. Bandwidth B = 500Hz is obtained from fH and fL, and Q = f0/B = 4. By configuring the values of N and Q to Max 261 through the GPIO port of STM32, the required filters can be obtained.
Subsequently, in order to visually display the filtering effect of the filter, a multi-frequency sinusoidal mixed signal is generated by a function generator, i.
e. s(t) = sin (2pi f1t) sin (2pi f2t) sin (2pi f3t), where f1, F2 and F3 are 1750Hz, 2000Hz and 2250Hz respectively. The CH1 pen of the oscilloscope is connected to the port, and then the CH2 pen of the oscilloscope is connected to the bandpass filter output (BP) port of Max 261. At the same time, the spectrum analysis function of the oscilloscope is opened to adjust the appropriate frequency scale range.
From the spectrum of CH1, we can see three lines with the same height: 1750 Hz, 2000 Hz and 2250 Hz. S (t) after band-pass filtering, the spectral line energy at the center frequency of 2000 Hz remains unchanged, and the spectral line energy at other frequencies will be attenuated. It can be seen from the spectrum of CH2 that the spectral line heights of 1750 Hz and 2250 Hz are significantly lower than those of 2000 Hz, and the spectral line heights are reduced to 0.707 times (-3dB) of the original. The results show that the bandpass filter has been correctly configured and can work properly. Furthermore, the central frequency and bandwidth of the filter can be changed to test the performance of the programmable filter by sending instructions to STM32 through the serial port of the host computer.
When the clock frequency and quality factor Q remain unchanged, the central frequency f0 decreases with the increase of frequency ratio N. From CH2 spectrum, we can see that the height of 1750Hz spectral line increases gradually, and the height of 2000Hz and 2250Hz spectral line decreases gradually. This result shows that the central frequency of bandpass filter is decreasing. If the frequency ratio N is adjusted back to 100.53 and fixed, i.e. F0 = 2000Hz, and the Q value is increased, we will see that the height of the spectrum line at 2000Hz remains unchanged, and the height of the spectrum line at 1750Hz and 2250Hz gradually decreases. This shows that if the frequency ratio N is unchanged, the bandwidth of the filter will be narrowed. Students can change the type and other parameters of the filter by sending instructions to STM32 through PC serial port, observe the performance and output effect of the filter through spectrum analysis on the filter, and record the relationship between the parameters of the filter and the spectrum of input and output signals, and make the experimental table for quantitative analysis. In addition, Max 261 has two second-order filters built in, if a single filter can not meet the requirements, such as the need to set a specific maximum passband ripple and minimum stopband attenuation.
At this time, two filters can be cascaded to form a fourth-order filter to meet higher design requirements. This paper presents an integrated circuit analysis and design experiment based on programmable filter and microcontroller.
This experiment can help students understand the concepts of bandwidth and quality factor in filter and signal frequency analysis more intuitively and deeply, and improve the design ability and programming practice ability of analog and digital circuits.