Design of Audio Signal Analyzer Based on DSPIC30F6014A Single Chip Microcomputer

Publisher:CuriousMind123Latest update time:2019-12-02 Source: elecfansKeywords:DSP  IC30F6014  MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

    At present, most audio signal processors are not only large in size but also expensive, and are difficult to be popularized in some special aspects. Embedded system analyzers are small and reliable, so the development of audio analysis instruments based on special function microcontrollers is the basis of speech recognition and has great practical significance. The principle of signal analysis is to convert the signal from the time domain to the frequency domain, so that the unclear characteristics of the original signal become obvious, which is convenient for analysis and processing. For audio signals, their main characteristic parameters are amplitude spectrum and power spectrum. The working process of the audio signal analyzer is: limiting amplification of audio signals, analog-to-digital conversion, fast Fourier transform (FFT, conversion from time domain to frequency domain), eigenvalue extraction; from the amplitude spectrum of the audio signal, the power spectrum of the audio signal is obtained.

    1 Hardware Design

 

    "Smart Home" is also called smart house. The home network intelligent control system uses advanced computer technology, communication technology and embedded technology to connect various devices in the home into a system through the home network. The composition of the entire smart home system is shown in Figure 1. In this system, the monitoring and control of certain household electrical appliances requires the analysis of audio signals.

  This design uses Microchip's DSPIC30F6014A microcontroller as the core processor. This chip is a combination of MCU technology and DSP technology. It not only includes the control function of 16-bit MCU, but also integrates the high-speed computing technology of DSP. It is actually a digital microprocessor that can easily realize various functions of audio signal analysis. The block diagram of the audio system is shown in Figure 2, including several parts such as power module, prefabricated circuit, A/D conversion module, DSP module, LCD display module, etc. The specific design and implementation functions of each module and interface are as follows:

  (1) Power supply module: It adopts a DC three-terminal regulated power supply design. After voltage reduction, rectification, filtering and voltage stabilization, 220 V AC power is converted into the ±5 V and ±12 V power supply voltages required by the system.

  (2) Prefabricated circuit: To ensure that the input bandwidth is within the audio range, the front-end DC bias circuit uses an OP07 amplifier. The first-stage adder adds the input signal to a 2.5 V voltage value, and the second-stage inverter transfers the signal to a 0-5 V range that can be processed by the A/D converter. Because the 50 Ω resistor at the input end is grounded, the system input impedance is approximately 50 Ω.

  (3) A/D conversion module: Because there is only one audio signal input, only AN6 is used among the 16 analog input pins of the 12-bit configurable A/D module. During initialization, this pin is configured as an analog input pin. At the same time, because the processed audio signal voltage is 0 to 5 V, the reference voltage of the A/D module is set to 0 V and 5 V. The conversion output rate is as high as 200 KSPS.

  (4) DSP module: This digital microprocessor is a modified Harvard structure design that can perform real-time analysis with high resolution. The DSP module is called through Microchip's MPLAB C30 C compiler, which provides 49 DSP processing functions to complete all digital signal processing.

  (5) LCD display module: used to intuitively display spectrum waveform.

  (6) ICD2 debug interface: Microchip's ICD2 in-circuit debugger is selected, and an ICD2 debug interface is reserved for this purpose.

  (7) RC oscillator: This microcontroller can operate in four modes: external clock input, external RC input, internal fast RC oscillator, internal low power (RC) oscillator, and post divider used in low power consumption. This design uses the internal fast RC oscillator, which can provide a 7.37 MHz clock. Since the audio signal needs to be processed in real time, the post divider is not used.

 

  2 Software Design

 

  The main loop of the audio system is shown in Figure 3.

 

  (1) After sampling and A/D conversion are completed, the A/D enable flag is cleared to obtain a discrete digital signal.

 

  (2) Call the period determination function to analyze the periodicity of the signal.

 

  (3) Call the FFT transformation function to perform fast Fourier transform on the discrete signal to achieve the transformation from time domain to frequency domain.

 

  (4) Display the spectrum of the input signal.

 

  (5) Calculate the power spectrum of the signal and calculate the maximum power.

 

  (6) Display the power spectrum and maximum power of the signal.

 

  2.1 A/D Sampling

 

  Theoretical analysis: Due to the 12-bit A/D module, the quantization unit is 1/212. Since the frequency resolution △f = 100 Hz and the number of FFT sub-sample points N = 512, the sampling frequency fs = 51 200 Hz (fs ≤ N△f) and the sampling period Ts = 1/51 200 s (sampling period minus sampling time + conversion time). Since the oscillation frequency is 7.37 MHz, the instruction period TCY = (1/7.37) × 4 = 0.5 μs.

 

  Actual control: The conversion time is 14 TAD (for correct A/D conversion, TAD = 333.33 ns). Therefore, if the A/D automatic sampling time is configured to be 6 TAD and the A/D conversion clock is 16TCY, the total A/D conversion time is 0.092 ms and the sampling frequency is 10.87 kHz.

 

  The A/D module works in the system clock source and automatic conversion mode, and enters an interrupt after each conversion. A structure with a sampling point number should be defined in the program to store the data collected by the A/D. Each structure includes a real part and an imaginary part. In the interrupt service subroutine, the digital quantity collected by the A/D module is stored in the real part of the structure, and a total of sampling point conversions are performed. The flow of the interrupt service subroutine is shown in Figure 4.

      2.2 Period determination

 

  The frequency components of audio signals are not only numerous, but also non-periodic. The measurement period can be in the time domain or in the frequency domain. However, since the frequency domain measurement of periodicity requires that certain frequency points have regular zero points or near zero points, it is impossible to correctly analyze the periodicity of more complex signals with more frequency components and more uniform and low power distribution. Therefore, for the periodicity determination of the signal, the period determination function should be called directly before the FFT transformation of the signal. The flow chart of the periodicity determination subroutine is shown in Figure 5.

 

  2.3 FFT Transformation

 

  Since the amount of computation of direct Fourier transform is proportional to the square of the number of sub-sample points N, when N is large, the amount of computation is too large and is not suitable for implementation in embedded systems with limited resources. Therefore, the most commonly used radix 2 FFT algorithm is the one whose main idea is to decompose the N-point direct Fourier transform into multiple shorter direct Fourier transforms, and then use the periodicity and symmetry of the rotation factors to save system resources to a great extent.

 

  The MPLAB C30 C compiler provides almost all digital signal processing software tools. Through the DSP IC30F series microprocessor, digital signal processing can be easily realized by simply calling the library functions provided by Microchip. For the radix-2 FFT transform, its software flow chart is shown in Figure 6.

  2.4 Feature value extraction

 

  The quantities that play a decisive role in frequency domain analysis include sampling frequency and number of sampling points. Through FFT transformation, the discretized amplitude spectrum X(k) is obtained. The discretized amplitude value is first squared and then divided by the number of sub-sample points N to obtain the power value corresponding to the frequency point (power = X(k)*X(k)/N).

 

  3 Conclusion

 

  The main performance indicators of the system are: input impedance 50 Ω; input signal voltage range (peak-to-peak value) 100 mV ~ 5 V; the frequency component range of the input signal is 200 Hz ~ 10 kHz; the frequency resolution is 100 Hz (it can correctly measure the power value of the frequency component with a frequency difference of not less than 100 Hz in the measured signal); the total power of the input signal and the power of each frequency component, the sum of the power of each detected frequency component is not less than 95% of the total power value; the absolute value of the relative error of the power measurement of each frequency component is less than 10%, and the absolute value of the relative error of the total power measurement is less than 5%; the analysis data is refreshed at a period of 5 s, and the frequency components of the signal should be stored in sequence according to the power size and can be played back and displayed. At the same time, the total power of the signal and the frequency and power values ​​of at least the first two frequency components are displayed in real time, and a pause button is set to keep the displayed data. Audio signal analysis based on DSP microcontroller technology has the characteristics of stable performance, simple circuit, fast speed, low cost and small size. It is suitable for embedded systems that require audio signal analysis and can be further promoted and applied in more fields, such as environmental monitoring, speech recognition, and control of intelligent systems.

Keywords:DSP  IC30F6014  MCU Reference address:Design of Audio Signal Analyzer Based on DSPIC30F6014A Single Chip Microcomputer

Previous article:Introduction to the method of preventing spectrum analyzer damage by Antai maintenance
Next article:What is a protocol analyzer?

Recommended ReadingLatest update time:2024-11-16 14:37

AVR128 MCU minimum system serial port, external interrupt, marquee, uCOS-II transplantation
Experiment name: Serial communication experiment Function description: The computer sends data to the development board through the serial port, and the development board sends the data back as is. Experiment purpose: Learn serial communication Experiment description: MCU--M128           internal 8M crystal oscillator
[Microcontroller]
Design of car steering wheel button controller system based on MCU
With the popularity of cars in people's daily lives and the increasing value of automotive electronics in automotive applications, more and more comfort performance and "smart" applications are being integrated into the field of body electronics. Freescale's latest automotive-grade 8-bit microcontroller
[Automotive Electronics]
Design of car steering wheel button controller system based on MCU
51 MCU parallel interface P0~P3
Preface When learning 51 single-chip microcomputer, IO port can be said to be the most important. In application design, it should be understood that the computer is composed of digital circuits, and only TTL level exists. High level 3.5V~5V and low level 0V correspond to digital 1 and 0. The state input of the periph
[Microcontroller]
51 MCU parallel interface P0~P3
Mobile data processing and transmission system based on DSP and Cygnal microcontroller
1 Introduction The mobile data processing and transmission system is mainly used in small or portable instruments. It can collect, process and transmit and receive data through wireless mobile networks. Due to the cost of wireless mobile networks, the mobile data processing and transmission system should ha
[Embedded]
Application of single chip microcomputer to detect AC power failure program (RGB control)
RBG soft light strip is a common load in lighting accessories. It is usually used as a background light decoration and a guardrail tube. The program implements the function of using a wall switch to control the RGB light strip, which is divided into 4 gears. The first gear: a gradient effect is achieved between RGB. Th
[Microcontroller]
Application of single chip microcomputer in medical signal detector
A circuit with Atmega163 microprocessor as the core is designed to collect multiple physiological parameters of the human body in real time and transmit high-speed data, so as to form a human physiological parameter detector and provide a basis for doctors to diagnose diseases. Keywords: microprocessor, photoelec
[Industrial Control]
Application of single chip microcomputer in medical signal detector
Experiment 3: MCU internal interrupt processing
1. Use timer interrupt to control the signal light.             ORG        0000H               LJMP      MAIN                 ORG        000BH            ;Internal interrupt T0 entry address               LJMP      T0INT                 ORG        02400H MAIN:    MOV        SP,#30H               MOV   
[Microcontroller]
Serial port and serial communication technology of MCS-51 single chip microcomputer
Basic concepts of data communication There are three types of serial communication: simplex communication, half-duplex communication and full-duplex communication. Simplex communication: Data can only be transmitted in one direction from one end to the other. For example, current cable TV programs can only be transmit
[Microcontroller]
Serial port and serial communication technology of MCS-51 single chip microcomputer
Latest Test Measurement Articles
Change More Related Popular Components

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号