3228

Car-based sound guidance system

 
Overview
  1. Overall program

This car-based sound guidance system consists of a sound receiving part and a mobile sound source control part. The hardware part of the system mainly includes: sound sensor, error distance analysis module, mobile car, and sound source control module. As shown in Figure 1.

                                                                                        Figure 1 System hardware components

The sound source control module controls the sound source to emit intermittent sound signals of specified frequency. The three sound sensors transfer the captured waveform information to the microcontroller. The microcontroller calculates the current position of the sound source and compares it with the set value through Bluetooth communication. The motion control instructions are transmitted to the mobile car, and the mobile car implements forward and turning movements according to the received instructions, and controls the sound source. The serial port screen is used to display and debug system parameters.

Figure 2 Actual position relationship of the system

The actual placement of the system is shown in Figure 2. ABC's three sound receivers are placed on the three vertices of a square with a side length of 1m. The three receivers are connected to the microcontroller module through wires. The microcontroller communicates with the mobile car through Bluetooth communication. The sound source and sound source control module are located on the car. By controlling the movement of the car, the sound source can be moved.

The overall mobile sound source of this system is realized by placing the sound source on a mobile car. The mobile car part uses TM4C123G as the main control. The mobile car is driven by a motor board, an acrylic frame, a single-chip main control board, a Bluetooth receiver and two It is composed of a stepper motor, and the mobile car is also equipped with a sound source and a sound source control module. After the Bluetooth device receives the motion command, the buzzer makes a sound, and the sound sensor receives the signal and transmits it to the microcontroller main control board and the motor drive board to jointly realize the operation of the motor. After the car reaches the target position within the specified time, the onboard RGB lights Shows green light.

The sound detection part of this system uses three sound sensor modules, which are transmitted to the microcontroller through the waveform shaping circuit. The microcontroller compares the time differences of the three channel signals in pairs. After data fitting, the mathematical relationship between the time difference of each sensor and the position information of the moving sound source is obtained. , so that the real-time position of the car can be accurately judged, and instructions can be accurately issued to control the movement state of the car.

  1. programming:

Figure 3 System software design

In this system, we use two microcontrollers to control the movement of the car and the collection of sound signals respectively. First, the microcontroller controls the buzzer to emit periodic sound wave signals. The sound collection module placed at the end point of the coordinate axis collects the sound signal. The microcontroller uses external interrupts to obtain the phase difference between the signals obtained by the three sensors. After processing, it passes The Bluetooth module is passed to the car. The car reaches the designated location according to the received signal and completes the mission goal.

  1. Selection and justification of plans
  2. Selection of microcontroller

A single-chip microcomputer (Single-Chip Microcomputer) is an integrated circuit chip that uses very large-scale integrated circuit technology to combine a central processing unit (CPU) with data processing capabilities, random access memory RAM , read-only memory ROM, various I/O ports and interrupt systems. , timer/counter and other functions (may also include display driver circuit, pulse width modulation circuit, analog multiplexer, A/D converter and other circuits) integrated into a silicon chip to form a small but complete microcomputer system , is widely used in the field of industrial control. Here, we need to use a single-chip microcomputer to control the operation of the car and process the data.

Option 1: Choose 89C52RC as the main control.

STC89C52RC is a low-power, high-performance CMOS 8-bit microcontroller produced by STC . STC89C52 is a microcontroller with 8K bytes of flash programmable and erasable read-only memory (FPEROM-Flash Programable and Erasable Read Only Memory). Low-voltage, high-performance COMOS8 microprocessor, commonly known as microcontroller. The device is manufactured using ATMEL's high-density non-volatile memory manufacturing technology and is compatible with the industry standard MCS-51 instruction set and output pins.

Option 2: Use STM32F407ZET6 microcontroller

The 32 series microcontrollers have a high-performance, low-cost, low-power ARM Cortex-M core specially designed for embedded applications, and are fast, processing data widths of up to 32 bits at a time.

Solution 3: Use TM4C123GH6PMT7

TM4C123GH6PMT7 is an Arm Cortex-M4F based 32-bit MCU with 80MHz frequency, 256KB Flash, 32KB RAM, 2 CAN, RTC and USB in a 64-pin LQFP package. As shown in Figure 3.

Figure 4 TM4C123GH6PMT7 development board

Comprehensive comparison, we choose STM32F407ZET6 as the processor for the sound error analysis part. It has rich pins and powerful processing performance, and can meet the needs of high-speed error calculation; we choose TM4C123GH6PMT7 as the mobile sound source main control processor, which is small in size, rich in functions and Great value for money.

  1. Sound sensor module solution

Option One:

Design and make a microphone sound collection circuit, as shown in Figure 5. The received sound signal is converted into an analog electrical signal, amplified and then transmitted to the microcontroller. The microcontroller determines the location of the sound source by judging the amplitude of the analog electrical signal.

Figure 5 Physical diagram of microphone sound collection circuit

Option II:

Design and produce a microphone sound collection circuit. After the output electrical signal is amplified by the LM386 audio amplifier, the electrical signal of the sound source frequency is screened through the LM567 frequency identification circuit to trigger the low level. The sound source position is determined based on the time difference between the falling edges of the two outputs. The frequency circuit is shown in Figure 6.

Figure 6 Physical diagram of LM567 frequency identification circuit

third solution:

Using an existing sound detection sensor, when the sound source volume is higher than the set threshold, the sensor outputs a high-frequency digital pulse. The dense pulses are shaped into a continuous square wave through the waveform shaping circuit, and the difference in the rising edge time of the two sensor outputs is used. To determine the location of the sound source, the shaping circuit is shown in Figure 7.

Figure 7 Physical diagram of waveform shaping circuit

Among the above three solutions, the first solution cannot accurately determine the position of the sound source through the amplitude of the analog electrical signal output by the sensor, and the error is large. The falling edge of the output of the circuit actually produced in Scheme 2 jittered significantly, which was not conducive to software post-processing, so this scheme was abandoned during the attempt. Option 3 can accurately obtain the rising edge time difference of the two square wave signals, thereby achieving a more accurate judgment of the sound source location, so Option 3 was finally chosen.

  1. Selection of mobile sound source drive motors

The question requires that the moving sound source should be facing the target line when placed, and a straight line needs to be maintained during walking, which requires the driving system to be stable and accurate.

Option One:

The DC encoding motor has an encoder. The value of the encoder can be obtained through the input capture of the microcontroller and then the speed can be accurately controlled through PID. This can achieve the effect of the car walking in a straight line, and it has a larger wheelbase and a stronger load capacity. ability.

Option II:

The stepper motor controls the speed through the number of pulses. When the number of pulses is the same, the angle it rotates is also the same. In this way, when both motors give the same number of pulses, they can easily walk out of a straight line.

The stepper motors in the above two drives have better stability, can provide sufficient output capabilities, and have more advantages in terms of operating performance and energy consumption, so option two is chosen.

  1. Sound source selection

Option One:

Using audio amplifiers and speakers to produce sound

Option II:

Use a high-decibel buzzer to sound

The speaker in Scheme 1 can be easily debugged to emit sounds of different tones, but its sound loudness is limited, and the drive circuit is complex, and the sound it emits cannot exceed the set threshold of the sound sensor. The high-decibel buzzer of option two has a loud sound, a simple control circuit, and low power consumption, so option two is chosen.

  1. theoretical analysis
  2. Figure 8 Intermittent digital pulse signal

Figure 9 Shaped rectangular wave

Voice recognition method

The sound transmitter receives the pulse sound signal from the sound source, converts the sound vibration into an analog electrical signal, and converts it into an intermittent digital pulse signal through a voltage comparator, as shown in Figure 8. The sliding rheostat can adjust the sensor's response to the sound. degree of sensitivity. The intermittent digital pulse signal is integer filtered by the monostable trigger and converted into a standard rectangular wave, as shown in Figure 9. After the intermittent digital pulse signal is shaped by the monostable flip-flop, the falling edge time of the output rectangular wave depends on the circuit RC transient time, so it becomes unreliable, but its rising edge is hardly disturbed. The microcontroller adopts two The phase difference of the rising edge obtained by the path sensor after shaping is obtained, thereby obtaining the position information of the sound source.

  1. Automatic positioning method

Communication between two microcontrollers is carried out through the Bluetooth module. After the sampling microcontroller collects the signal, it transmits the signal to the control microcontroller. After the sampling microcontroller takes the distance, it determines whether the car has reached the target position. If the car reaches the target position, it sends a signal to the car. Signal it to stop.

  1. circuit design
    1. Digital pulse shaping circuit

The retriggerable monostable trigger 74HC123AP digital chip is used, and its function table is shown in Figure 10

Figure 10 74HC123AP digital chip function table

When the sound sensor module receives sound higher than the set threshold, it outputs a low level. From the actual observation of the waveform on the oscilloscope, we found that it outputs a high-frequency digital pulse when receiving sound, and its flag information is the falling edge. Therefore, the monostable circuit is designed to work in the falling edge trigger mode, so the CLR and B terminals are Connect to high level, and terminal A is connected to the digital output pin of the sound sensor module. Observe again with an oscilloscope and find that the time interval between two adjacent low levels of the high-frequency digital pulse is about 1ms. From this, the selected values ​​of the monostable capacitor and sliding rheostat are calculated based on the transient stable time formula T=0.45RC. For this circuit, the capacitor C=1μf is selected, and the resistor is a 5.1kΩ fixed value resistor + 500kΩ sliding rheostat. The shaping circuit principle is shown in Figure 11.

Figure 11 74HC123AP monostable trigger circuit

  1. Sound source driver circuit

The sound source driving circuit is mainly composed of a boost module and a triode. As shown in the figure, the IO port of the microcontroller pulls high and low to saturate or cut off the triode, thereby controlling the on or off between the buzzer and the power supply. Implemented intermittent sounding of the buzzer. In order to make the buzzer sound louder, use a boost module to increase the power supply voltage to 24V.

Figure 12 Sound source drive circuit

  1. Microcontroller expansion board

The PWM and serial ports of TM4C123GH6PMT7 are led out for easy connection. The wiring terminals are Sada konektor Integration makes the line more stable.

  1.  
  2. Motor driver board

Figure 13 Motor drive board

Dual motor drive is used to control two stepper motors, and the two A4988 pins are led out for easy connection, and the Bluetooth module is integrated on the driver board.

  1. Test plan and test results
  2. Sound source frequency debugging

Sound source frequency (KHz)

parameter

0.5KHz

1KHz

2KHz

3KHz

Time difference between adjacent pulses (ms)

2~3.45

1.05~1.35

0.47~0.68

0.31~0.35

Effective distance (m)

0.8

1.5

1.2

0.6

Table 1 Monostable trigger waveform shaping test

By changing the frequency of the sound source and observing the effective receiving distance of the sensor to its sound source, we finally found that when the frequency of the sound source is about 1KHz, the effective sensing distance of the sensor is the farthest, so the buzzer frequency is set to 1KHz.

  1. Sound source localization testing and debugging

Sensor number

AB

AC

OX line time difference (μs)

-500~-1500

/

OY line time difference (μs)

/

800~1300

Table 2 Sound source positioning test and debugging

The time difference between the moving sound source and the sensors on the two stop lines OX and OY is obtained from the actual test, and the data is analyzed to establish the control command threshold to control the motion state of the car. Figure 14 shows the site environment.

Figure 14 Site environment

  1. Question completion test:
 

arrival success rate

Positioning error

basic part

85%

1~10cm

play part

85%

1~6cm

Table 3 Test plan under noisy conditions

 

arrival success rate

Positioning error

basic part

90%

1~8cm

play part

90%

1~5cm

Table 4 Testing in a Quiet Room

Through the actual completion test of the topic, it was found that the system is susceptible to interference in a noisy environment, and its positioning error will further increase. By improving the sound sensor threshold and software filtering algorithm, the impact of the test environment on the system is minimized.

appendix

Physical picture:

Figure 15 Mobile sound source display

Figure 16 Microcontroller error calculation module

Figure 17 Sensor layout and debugging site

Code display:

Figure 18 Sound detection code

Figure 19 Bluetooth handshake code

Figure 20 Stepper motor control code

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-20 03:44:38
  • +++++++++GPRS data serial port to Ethernet
  • A comprehensive look at the entire family of MSP430 microcontrollers
  • I2C Bus Specification
  • Intelligent Plant Growth LED Lighting Control System
  • New Android feature: Use Google search to find lost phones
  • CircuitPython upgraded to 5.2.0

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号