念慈菴

2021 J question periodic signal waveform identification and parameter measurement device +SZPT_ZXL

 
Overview
## Preface

The periodic signal waveform identification and parameter measurement device is mainly composed of STM32 microcontroller system, power supply circuit, signal conditioning circuit, LCD display circuit and other parts. It is mainly composed of STM32F103ZET6 microcontroller, front-stage controllable gain control circuit, working over-lift circuit, LCD display circuit, etc. It adopts algorithms such as FFT, curve fitting, frequency measurement method, and cycle measurement method to successfully identify sine waves, triangle waves, It can accurately measure 6 types of periodic signal waveforms such as rectangular wave, cubic wave and Gaussian wave, and can accurately measure the frequency, peak-to-peak value, duty cycle and other signal parameters of the periodic signal. The absolute value of the frequency and peak-to-peak relative error of the measured signal is not Greater than 1%, the absolute value of the absolute error of the duty cycle of the rectangular wave signal is not greater than 2%. It can display the time domain waveform and frequency domain waveform of periodic signals on the LCD serial port screen, as well as various measurement parameters such as frequency, period, duty cycle, maximum value, minimum value of periodic signal waveforms, and the detection range is extended to signals above 60kHz.

## Team introduction

The team members are all students from Shenzhen Vocational and Technical College. Through this e-tournament, everyone participated wholeheartedly. Although the postponement of the summer vacation disrupted our training plan, we still did not give up on this competition and persisted until the end, finally achieving satisfactory results.

## Project Analysis

1. Basic Requirements
* Able to identify sine wave, triangle wave and rectangular wave signals in the range of 1V≤VPP≤5V, 100Hz≤ f ≤10kHz, and display the type.
* Able to measure and display the frequency f of the signal, the absolute value of the relative error is not greater than 1%.
* Able to measure and display the peak-to-peak VPP of the signal, with the absolute value of the relative error not greater than 1%.
* Able to measure and display the duty cycle D of the rectangular wave signal. The range of D is 20%~80%, and the absolute value of the absolute error is not greater than 2%.
2. Play with parts
* Expand the scope of identification and measurement. It can identify sine wave, triangle wave and rectangular wave signals in the range of 50mV≤VPP≤10V, 1Hz≤ f ≤50kHz, and display the type. At the same time, the parameter measurements with the same requirements as in the basic parts (2), (3) and (4) are completed.
* The recognition results and all measurement parameters are displayed simultaneously, and the response time is less than 3 seconds.
* Add no less than 3 types of identification waveforms and no less than 3 measurement parameters.
* other.

The periodic signal waveform identification and parameter measurement device is mainly composed of an STM32 microcontroller small system, a front-stage controllable gain control circuit, a working boost circuit, etc.! [01.png]
#### Waveform identification

* Sine wave: only the fundamental wave component , basically no harmonic components.
* Square wave: In addition to the fundamental wave, there are also 3rd, 5th, and 7th harmonic components, and the 3rd harmonic component is 1/3 of the fundamental wave component.
* Triangular wave: In addition to the fundamental wave, there are 3rd, 5th, and 7th harmonic components, but the 3rd harmonic component is 1/9 of the fundamental wave component.
* Sawtooth wave: In addition to the fundamental wave, there are also 2, 3, and 4 harmonic components.

Extract the frequency and corresponding amplitude of each harmonic and use them together. The first step is to find the maximum value, the second maximum value and the second maximum value of the amplitude. After it is calculated, it needs to be compared with the values ​​on both sides to see if it is a maximum value. If so, it will be retained. Finally, the comparison is carried out according to the previous ideas. The parameters for comparison are chosen by myself.

#### Adjust the sampling frequency.

The initial sampling frequency is 2400Hz, because the maximum required harmonics can be analyzed at 1kHz, and the sampling frequency must be greater than 2 times the signal frequency. Through calculation, the frequency resolution is only 2.34Hz, which leads to inaccurate measurement of 10 frequencies and amplitudes. Zero padding cannot improve the frequency resolution, so consider changing the sampling frequency in real time.

#### Test plan and test results

The test instruments of this system mainly include: multimeter (KEYSIGHT 34470A), digital function generator (SDG6032X-E), digital oscilloscope (SDS2520X), etc.

## Schematic circuit analysis The

front-stage controllable gain control circuit
uses four relays to classify the signals in the range of 50mV ≤ VPP ≤ 10V, 1Hz ≤ f ≤ 50kHz output by the function generator, and select the ones adapted to the ADC collection of the STM32 microcontroller.
![Pre-programmed amplifier.png]

AD acquisition signal adjustment circuit
Since the signal output by the function generator is an AC signal, and the STM32 microcontroller can only acquire DC signals, the collected signal must be raised by 1.65V through the working point lifting circuit, so that The voltage range of the DC voltage signal entering STM32 is approximately 0~3V. At the same time, in order to ensure circuit signal synchronization, a hysteresis comparator is used to convert the AC signal into a rectangular wave signal.
![DC operating point rise and hysteresis comparator circuit.png]
## Module function

![jXex8rKJqsiKIoQtcihnjeAWrsJbEuqK7zWGSVOp.jpg]
1. Signal boost circuit and square wave conversion circuit
2. Power supply, power supply for the system
3. Serial port screen, used for data Display and interaction
4. F429 microprocessor, the core of the system, is used for data acquisition and processing
5. Programmable amplification circuit, used to amplify and attenuate the input signal
6. Peak-to-peak detection module, used to detect the peak-to-peak value of the signal
7. External 16-bit ADC, used to collect the output of the peak-to-peak detection module

## Program design

The program design flow chart of this system is shown in the figure. First, the system performs ADC detection of peak and peak values, adjusts the signal processor according to the peak and peak values, and outputs a signal suitable for STM32 sampling; then performs ADC sampling and uses DMA to transfer the data collected by the ADC to reduce the burden on the STM32 processor; perform FFT on the data sampled by the ADC operation, and then carry out waveform identification and waveform parameter measurement.
![02.png]
## Main code analysis

#### FFT

![WeChat screenshot_20211224194746.png]



#### THD

![WeChat screenshot_20211224194938.png]



#### Waveform identification

![WeChat screenshot_ 20211224195439.png]
## Product display

! [WeChat picture_20211221203313.jpg]
## Summary

This system uses FFT algorithm and other technologies to achieve signal parameter measurement and can identify a given waveform type. The measurement accuracy meets the basic requirements of the question. Also, as part of the play. The scope of identification and measurement is expanded, and the measurement results are more accurate. The recognition results and all measurement parameters are displayed simultaneously, and the response time is less than 3 seconds. The result is more responsive. Added 3 types of recognized waveforms. Through the test, all indicators met the basic and performance requirements.
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2024-11-22 18:26:04

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号