super_star

[Lichuang Liangshan School] 2021 National Competition Question J-Periodic Signal Waveform Identification and Parameter Measurement Device

 
Overview

Project program updated on April 9, 2023
1. Project Description
  This project uses Liangshan School (GD32F470ZGT6) as the main control, and realizes the measurement of periodic signals through the pre-conditioning circuit. The function is similar to an oscilloscope, but because it is the built-in ADC of GD32F470 , so the measurement range is not as wide as that of professional oscilloscopes on the market. In this project, I will lead you to learn about microcontroller ADC sampling and analyze electronic competition questions. I hope you can gain something from this project. At the same time, the author has made mistakes. You can send a private message, please don’t start a fight!
Oscilloscope parameters:
Measurement voltage range: 0-25V
Measurement frequency range: 0-200Khz
Measurement accuracy: +-1%
Measurement sampling rate: 2.6MSPS
Bilibili video link: https://www.bilibili.com/video/BV1ox4y1c7oE /?vd_source=2115628cb2ad4920fc2783689dd43b85
Please use your little fingers to like and add favorites! ! ! Privately chat with me and enter the technical exchange group.
Your encouragement is the driving force for the progress of elementary school girls. The next issue will bring new works of elementary school girls.
 
2. Open source agreement
GPL3.0 
 
3. Project-related functions
are based on the built-in 2MSPS ADC of GD32F470ZGT6, which is regulated by the preamp The circuit can collect sine waves, triangle waves, square waves from 0-10V, 1HZ-100KHz, and can display waveform types, such as forward sawtooth wave, anti-sawtooth wave, impulse wave and other waveforms. At the same time, the parameters of the periodic signal can be broadcast by voice.
4. Project Attributes
This project is disclosed for the first time and is my original project. The project has not won any awards in other competitions. At the same time, the project is based on the improvement of my award-winning work in the 2021 National College Student Electronic Design Competition.
 
5. Project progress
The overall project took 7 days. The component costs are mainly TFT display, development board and materials, which total about 300 yuan. Interested friends can refer to my BOM to purchase.
 
6. Design principle
The overall system framework
 
op amp uses TL084 with a slew rate of 15V/us, which fully meets the requirements. The gear selection uses the 74HC4051 analog switch chip.
   If we choose a general-purpose op amp here, because the slew rate is too low and a 50khz sine wave is input, the output waveform will get a trapezoidal wave, and the waveform will be completely distorted.
Designing a good pre-processing part will make our equipment better and perform better. So we focus on designing the pre-processing part.
I will introduce the main components here, and I will introduce the schematic diagram and PCB later.
 
6.1 The schematic diagram
is divided into two parts: the main control circuit and the analog pre-conditioning circuit.
 
 
6.2 Liangshan School Master Control
 
The Liangshan School main control has a very good advantage. It comes with a DAP downloader, and the downloader integrates a serial port function, which can be more Conveniently download and debug programs, and locate program problems faster.
After December 5, 2022, the main control of the Lichuang Liangshan Pai development board was upgraded from GD32F450ZGT6 to GD32F470ZGT6. The two chips are compatible. The main differences are GD32F450ZGT6 with a main frequency of 200 and SDRAM 256K, and GD32F470ZGT6 with a main frequency of 240 and SDRAM 512K.
 
6.3 Pre-stage conditioning circuit
  This circuit is the main circuit of the pre-stage and realizes multiple functions through an operational amplifier. The first thing that comes in is the AC and DC coupling, then the voltage follower and then the three operational amplifiers. One is responsible for amplifying the signal 10 times, one is responsible for reducing the signal by two times, and the other is responsible for reducing the signal by 5 times. U6 is CD4051. Responsible for selecting the signal to the post-stage circuit. By default, it is selected to amplify 10 times. The post-stage circuit detects the amplification of 10 times. If it exceeds the threshold, switch to the second gear, pass-through. If the pass-through signal is still very large, then switch to Zoom in twice, and finally switch to zoom in 5 times. The above switching is based on the amplitude of the signal and is detected by the subsequent circuit. We should note here that the selection of resistors must be high-precision resistors, otherwise it will affect the amplification factor.
  The peak-to-peak voltage range that needs to be collected in this design is 0.05V to 10V, and the absolute value of the relative error is not greater than 1%. Since the input voltage of the ADC is 0-2.5V, the measurement signal should be limited to this range. Considering that the linearity of the signal conditioning circuit and ADC will be better in the middle area and worse at both ends, 2V can be selected as its upper limit measurement boundary. At this time, the lower limit measurement boundary can be selected 200mV, which can make the voltage in the low voltage area After amplification, it can switch seamlessly with the medium voltage area. At the same time, the maximum voltage of the high-voltage channel is 10V, which is reduced by 5 times to 2V, which can be seamlessly switched with the medium voltage area.
 
6.4 Post-processing circuit
  First, the post-processing part is divided into a voltage boost part, a zero-crossing detection part, and a protection part. , convert the input positive voltage into negative voltage, and then output it to the adder circuit. The two negative signals are added to obtain a positive signal zero-crossing detection circuit. When the input signal reaches a positive voltage, a signal is output to the microcontroller to obtain the frequency of the signal. To be precise, it is a level-raising circuit, otherwise the microcontroller cannot collect negative signals.
What we should note here is that the microcontroller can only collect 2.495v, so we have to add a diode for protection. In order to protect the microcontroller from being damaged, why is inverse proportional amplification used here? Because inverse proportional amplification can eliminate common mode interference, it is best to use inverse proportional amplification in general circuits.
Here we need to adjust the positioner that raises the reverse voltage so that the voltage reaches a state below 2.5V and above 0V. As shown in the oscilloscope below,
the 6.5 screen circuit and selection
screen choose a TFT 2.8-inch screen, using ILI9341 It is driven by a chip, has a lot of screen information, and displays rich content at the same time. It uses a soft cable to connect to the microcontroller.
 
6.6 Power supply part
The power supply part is very particular, because our ADC is very sensitive to noise, so the power supply we provide to the entire circuit must have low ripple, so we have to add π-type filtering at any cost, and use 0 for digital ground and analog ground. Ohmic resistor isolation achieves a noise suppression function. Our negative voltage is converted from 5V to -5V by SGM3204, and the power supply for other parts is provided by AMS1117.
 
6.7 The zero-crossing detection part
uses our microcontroller to directly measure the frequency of the periodic signal. It is not very accurate. It uses a professional high-speed comparator. The comparator is grounded in the opposite phase and the input signal is connected in the same phase. That is, it can be captured through the PCA input of the microcontroller. Relatively accurate signal frequency and duty cycle
of 6.8. In the gear switching part,
since our input signal range is 0-10V, we need to convert it into a voltage of 0-2.5V, so we have to use a multi-channel analog switch such as 74HC4051. Since The on-resistance of analog switches is different at different input frequencies, so we need to correct our acquisition voltage in different gears to achieve the best effect.
 
6.9 Amplitude detection part
The above is an amplitude detection circuit, which is a comparator. Through comparison, the amplitude of the input signal is known. If the input signal is greater than the threshold, a low-level signal is output to the microcontroller. If the input signal is less than the threshold, a high-level signal is output. signal to the microcontroller. Thereby detecting whether the amplitude of the input signal is within the sampling range of the microcontroller.
 
6.10 Voice playback module
The voice module is directly purchased from Taobao. We only need to download the fixed voice to the SD card and use the program to control it to play the corresponding voice file.
 
7. Software description
7.1 Software framework
The above is the program framework of the entire software
7.2 Key program descriptions
7.2.1 There are two timers in the timer
program, both below the main function
 
7.2.2 Input linear regression
Since everyone’s ADC sampling is different , so we need to have a process of input information in the OSC.c function. We need to correct the parameters later. If we change the value, the voltage will change.
 
7.2.3 System file composition
7.2.4 Waveform recognition algorithm
The above is the waveform recognition algorithm. The input of the algorithm is the 480-bit ADC array, the maximum voltage and the minimum voltage, and the duty cycle
waveform recognition principle:
7.2.5 Display program
The above is the waveform display program , consisting of two arrays, there are comments in the program, and the moving waveform can also be set.
 
8. Physical display
 
9. Design precautions
Program improvement on January 11: Since high-frequency DC rectangular waves have large harmonic components, AC coupling will be used for rectangular waves above 1K.
When using an external reference voltage, Remove the resistor connected between resistor 3.3 and AVCC3.3 on the microcontroller. For details, refer to the schematic diagram of the Liangshan School https://lckfb.com/.
The program routine used can be downloaded from the GD official website: https://www .gigadevice.com/
10. Other
Bilibili video links: https://www.bilibili.com/video/BV1ox4y1c7oE/?vd_source=2115628cb2ad4920fc2783689dd43b85
High-definition Bilibili demo video link https://www.bilibili.com /video/BV1cW4y137Cy/
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-01 15:34:18

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

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号