September 2024 - November 2024

"Mengsheng Cup" Electronic Design Competition

Intelligent Sound Source Identification and Localization System

Hardware System DevelopmentSTM32 ProgrammingVoice Control
盟升杯电子设计竞赛项目封面
Click to view larger image

Complete Source Code

Due to the large number and complex structure of the code files, the complete software source code has been uploaded to a GitHub repository, including Keil code, design reports, MATLAB simulation code, Python analysis code, etc.

View on GitHub

Team Information

Guidance

Science and Technology Association, School of Electronic Science and Engineering

Experts from Mengsheng Electronics Company

Team Members

  • Me Team Leader
  • Dilyar Asimjan (School of Computer Science and Engineering) - Algorithm Optimization
  • Rifat Memetrexat (School of Electronic Science and Engineering) - Circuit Soldering and Debugging

Project Background & Requirements

This project originated from Topic D of the 2024 Mengsheng Cup Electronic Design Competition for senior students: "Intelligent Sound Source Identification and Localization System". The competition required designing and building an intelligent system capable of identifying and locating sound sources, achieving precise localization and voice recognition within a predefined measurement area.

Specific Task Requirements

  • Hardware Constraints: The microphone array form can be self-designed, but the number of microphones cannot exceed 5. The overall size of the system must not exceed the measurement area.
  • Localization Function: The system must accurately identify the sound source position within 5 preset areas (A, B, C, D, E) with a localization error not exceeding ±5cm.
  • Voice Recognition: When set to "Recognition Mode", the system must be able to distinguish between 4 commands: "turn on the light", "turn off the light", "turn on the air conditioner", "turn off the air conditioner".
  • Signal Input: Commands are input via a mobile phone, Bluetooth speaker, or a self-made playback device.
  • Result Display: Recognition results are displayed in real-time on an LCD screen at the system end.

Solution

In response to the competition requirements, we designed an intelligent sound source identification and localization system based on the STM32H750 microcontroller. The system uses the TDOA (Time Difference of Arrival) algorithm as its core localization technology, achieving high-precision sound source localization with a four-microphone rectangular array, and integrates an ASR-PRO voice recognition module for intelligent voice control.

After rigorous theoretical simulation, hardware debugging, and system testing, we achieved a localization accuracy of ±2cm, surpassing the competition's ±5cm standard, and won the Third Prize in the 2024 Mengsheng Cup Electronic Design Competition.

Core Technical Solutions

TDOA Localization Algorithm

Achieved ±2cm high-precision localization based on time difference principles, exceeding the ±5cm competition requirement.

Four-Microphone Array

40cm×20cm rectangular layout with an optimized geometric structure to enhance localization accuracy.

Voice Recognition Integration

Offline recognition of 4 smart home control commands with a response time of <100ms.

Real-time Signal Processing

STM32H750 400MHz processor ensures the system's real-time performance.

System Architecture Design

The system adopts a modular design, divided into three main layers: hardware acquisition, algorithm processing, and application control. The hardware layer is responsible for sound signal acquisition and preprocessing, the algorithm layer implements TDOA localization calculations, and the application layer provides user interaction and device control functions.

Signal Acquisition Module

A rectangular array of four MAX9814 microphones, combined with a high-precision AD7606 ADC for multi-channel synchronous acquisition.

Data Processing Module

The STM32H750 is responsible for real-time signal processing, running the TDOA algorithm to calculate the sound source coordinates.

Voice Recognition Module

The ASR-PRO module handles voice command recognition, supporting voice control for devices like lights and air conditioners.

Algorithm Design & Simulation

Before hardware implementation, we first analyzed the signal characteristics of different voice commands using Python. Then, we verified the feasibility of the TDOA (Time Difference of Arrival) algorithm through MATLAB simulation. Finally, we designed the control logic for the ASR-PRO voice recognition module. This complete set of algorithm design and simulation laid a solid theoretical foundation for the hardware implementation.

Python Sound Signal Analysis

Using the librosa library to perform frequency-domain analysis and feature extraction on the four voice commands, providing data support for subsequent algorithm design.

pythonSupports multiple audio formats

Python Sound Signal Analysis Results

A complete signal feature analysis of the four commands—"turn on light," "turn off light," "turn on AC," and "turn off AC"—was conducted using Python's librosa library. The results revealed characteristic differences in the frequency domain, providing a crucial basis for tuning voice recognition algorithm parameters and designing the TDOA localization algorithm.

TDOA Sound Source Localization Algorithm Simulation

Core algorithm implementation based on the Time Difference of Arrival principle, using an error minimization optimization method to estimate the sound source position.

matlab

MATLAB Simulation Verification Results

Extensive simulations were conducted in MATLAB to test localization accuracy at various sound source positions. The results showed that the TDOA algorithm could achieve a localization accuracy of ±2cm under ideal conditions, fully meeting the competition's ±5cm requirement.

Simulation Analysis Summary
  • Conducted 100 random sound source localization tests in the 5 preset areas.
  • Average localization error: 1.8cm, Maximum error: 3.2cm.
  • Algorithm convergence time: average 15ms, meeting real-time requirements.
  • Maintained high accuracy in noisy environments (SNR > 20dB).

ASR-PRO Voice Recognition Control

The core control code for the voice recognition module, converting voice commands into device control actions.

cppReal-time response < 100ms

ASR-PRO Code Architecture Diagram

The ASR-PRO voice recognition module uses a state machine design pattern. It processes voice recognition results through hardware interrupts, achieving efficient voice command parsing and device control logic.

Hardware Design & Implementation

msb.sections.hardware.description

The system utilizes a four-microphone rectangular array layout. Through precise time synchronization and signal processing, it achieves high-precision localization of the sound source. All hardware modules have undergone rigorous electromagnetic compatibility design to ensure stable operation in complex electromagnetic environments.

Core Processor Module

  • STM32H750VBT6 microcontroller with a 400MHz clock speed.
  • Cortex-M7 core with floating-point unit support.
  • 128KB Flash + 1MB RAM.
  • Rich peripheral interfaces: SPI, I2C, UART, ADC, etc.

Sound Acquisition and Processing Module

  • Supports offline voice recognition with a response time of <100ms.
  • Built-in noise reduction algorithm adapts to complex acoustic environments.
  • Customizable command words with support for Chinese recognition.
  • Integrated microphone array interface.

Analog-to-Digital Converter Module

  • 16-bit resolution, 8-channel simultaneous sampling ADC.
  • Maximum sampling rate of 200kSPS, meeting sound signal processing needs.
  • Built-in programmable gain amplifier with a gain range of 1-10x.
  • Differential input design to effectively suppress common-mode noise.
  • SPI/Parallel interface for easy connection with STM32.

Microphone Array System

A four-microphone rectangular array layout with dimensions of 40cm×20cm is used. High-precision TDOA calculation is achieved through precise geometric layout and time synchronization. Each microphone is precisely phase-calibrated to ensure signal acquisition consistency. msb.sections.hardware.micArrayDesc2

Array Dimensions: 40cm × 20cm

Number of Microphones: 4 (Rectangular layout)

Sampling Rate: 20kHz

Localization Accuracy: ±2cm

Enclosure 3D Modeling and Printing

To protect the circuit boards and provide an aesthetic appearance, we designed a 3D model of the enclosure using SOLIDWORKS. The design considered the layout of the microphone array, circuit board mounting, heat dissipation, ventilation, and user convenience. After modeling, we used the free 3D printing service on campus to produce the enclosure.

Enclosure 3D Modeling Showcase - SOLIDWORKS

Completed System

The system is highly integrated and compact. Components such as the core processing board, voice recognition module, and microphone array are optimally connected through a well-designed PCB layout for signal transmission and electromagnetic compatibility. The entire machine has undergone rigorous environmental testing to ensure stable operation under various temperature and humidity conditions.

System Testing & Results

The system underwent rigorous functional testing and performance verification, and finally passed the official test and acceptance at Mengsheng Electronics Company. Key metrics such as localization accuracy, response time, and voice recognition accuracy all met the competition standards. As photography and video recording were prohibited on-site, no official demonstration video is available, but test recordings from the debugging process were kept.

System Debugging Demonstration Videos

The following are demonstration videos recorded during the system development and debugging process, showcasing the actual performance of the sound source localization and voice recognition functions.

Competition Result

Third Prize (2,000 RMB Prize Money)

Project Summary

This was our team's first foray into an embedded project of considerable engineering scale. Starting from scratch, we invested a great deal of time in learning and practice. The biggest challenge was on the software side, specifically how to seamlessly feed the multi-channel real-time data collected by the AD7606 into the TDOA localization algorithm for processing. Although we successfully drove all hardware modules and achieved stable voice recognition, we ultimately failed to complete the joint debugging of the localization function due to inexperience with ADC, DMA interrupt handling, and integrating different code libraries. Over a month of full dedication, filled with countless late nights of debugging and exploration, was a journey full of challenges and rewards. We did not give up in the face of difficulties but poured all our energy into it, learning and doing simultaneously within the limited time, experiencing the complete process from theory to practice. Although the final system did not achieve all its intended functions, we built a complete hardware system, overcame most of the software challenges, and more importantly, gained valuable teamwork experience and the ability to solve complex engineering problems. We are proud of what we accomplished and inspired by the regrets that remain.