Design of ultrasonic obstacle detection voice broadcast system based on TTS module

Publisher:自在自由Latest update time:2013-03-30 Source: 21IC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
    Ultrasonic waves are sound waves with a frequency of more than 20 kHz, which have the ability to propagate in a straight line. The higher the frequency, the weaker the diffraction ability and the stronger the reflection ability. Due to its strong directivity, slow energy consumption and long propagation distance, ultrasonic waves are often used in the measurement of position and distance, such as rangefinders and level measuring instruments. Ultrasonic detection is often convenient and quick, and can also meet practical requirements in terms of measurement accuracy, so it is widely used in various fields.
    This paper presents an obstacle detection voice broadcast system based on ultrasonic sensor technology, which provides a feasible and simple solution for solving the problem of obstacle approaching distance detection. This solution uses ultrasonic transducers to realize non-contact measurement of obstacle distance based on the pulse echo method, and can perform temperature compensation on ultrasonic velocity to improve detection accuracy. The measurement results will be displayed on the LCD, and the voice broadcast function will be realized through the TTS module. It can be applied to applications such as blind navigation, motor vehicle reversing and illegal intrusion detection.

1 Hardware system design
1.1 Overall system structure
   
The hardware circuit of the ultrasonic obstacle detection voice broadcast system is shown in Figure 1 below. It mainly includes single-chip control module, ultrasonic distance detection module, temperature measurement module, button module, LCD display module, speech synthesis module, power supply module, etc.

a.JPG


    The hardware of the system consists of AT89C51 single-chip microcomputer, ultrasonic distance detection module, DS18B20 temperature detection module, 1602 character LCD display module, iFLYTEK's XF-S4240 embedded Chinese speech synthesis module, LM386 audio amplifier, speaker, 4.2 V/3.3 V power conversion module, etc. The single-chip microcomputer is the main control chip, which controls the generation, transmission and echo detection of ultrasonic signals, and determines the distance of obstacles by detecting the echo delay. The temperature-compensated distance measurement result is first displayed on the LCD screen, and then sent to the XF-S4240 module using the SPI interface for speech synthesis, and then the audio signal is amplified by the LM386 to drive the speaker to sound; the LDO chip AMS1117 is used to realize the power conversion from 4.2 V to 3.3 V, providing the required working power for the XF-S4240.
1.2 Ultrasonic distance detection module and its circuit design
   
① Introduction to ultrasonic distance detection technology
    The ultrasonic wave generated by the transmitting ultrasonic transducer propagates in the air. When the ultrasonic wave is blocked by a target object whose size is larger than its wavelength, it will be reflected, and the reflected wave will be received by the receiving ultrasonic transducer. If the propagation speed v of the sound wave in the medium is known, and the time for the sound wave to reach the target from the sound source and then return to the sound source can be measured as t, the distance d from the sound wave to the target can be calculated as
    d=v·t/2 (1)
    This is the basic principle of the pulse echo distance measurement adopted by this system.
    Ultrasonic waves propagate in the air in the form of longitudinal waves. Since the gas has an elastic modulus that resists compression and expansion, the result of its resistance to the compression change force realizes the propagation of ultrasonic waves in the air. Therefore, the propagation speed of ultrasound is affected by the density, temperature and molecular composition of the gas, that is:
    c.JPG
    Where: E is the elastic modulus of the gas, ρ is the density of the gas. The elastic modulus of an ideal gas is
    E=λ·P (3)
    Where: λ is the ratio of the heat capacity at constant pressure to the heat capacity at constant volume of the gas, λ=1.40 in air; P is the pressure of the gas. The pressure of
    an ideal gas
    e.JPG
    is: R=8.314 kg/mol, T, M, V, μ are the temperature, mass, volume and molecular weight of the gas respectively, and the molecular weight of air is μ=28.8×10-3 kg/mol.
    f.JPG
    It can be seen from formula (5) that the propagation speed of ultrasound in air is closely related to the temperature of the air. Table 1 shows some corresponding relationships between the propagation speed of ultrasound and temperature.

g.JPG[page]

    ②The ultrasonic transmitting transducer circuit design
    uses a single-chip microcomputer to generate a 40 kHz square wave, which is conditioned and driven by U1 CD4049 and then generates the required ultrasonic signal through the ultrasonic transmitting transducer U2. The schematic diagram is shown in Figure 3.

i.JPG


    ③ Ultrasonic receiving transducer circuit design
    The front stage of the ultrasonic receiving transducer circuit uses NE5532 to form a high-power amplifier U4 to amplify the received signal, and the back stage uses LM311 comparator U5 to adjust the received signal. The comparison voltage can be adjusted through the adjustable resistor VAL1 to adapt to different ranging ranges. The schematic diagram is shown in Figure 4.

j.JPG


1.3 DS18B20 temperature measurement module
   
In order to meet the needs of ultrasonic velocity temperature compensation in this design, the DS18B20 intelligent temperature sensor is selected.
    DS18B20 has 4 main data components:
    1) Photolithography ROM: Contains a 64-bit pre-engraved serial number, which can be regarded as the exclusive address of the DS18B20, so as to achieve the purpose of connecting multiple DS18B20 on one bus.
    2) Temperature sensor: used to complete 12-bit temperature measurement, and the measurement result is stored in the form of 16-bit sign-extended binary complement.
    3) Internal memory: includes a high-speed temporary RAM and a non-volatile electrically erasable EEPROM, the latter can be used to store high and low temperature alarm thresholds.
    4) Configuration register: TM is the test mode bit, which is used to set the DS18B20 to enter the working mode or the test mode.
    According to the communication protocol of DS18B20, the host (single-chip microcomputer) must go through three steps to control DS18B20 to complete temperature conversion: reset DS18B20 before each read and write, send a ROM instruction after the reset is successful, and finally send the read and write RAM instruction, so that the predetermined operation can be performed on DS18B20.
    DS18B20 is connected to the single-chip microcomputer P3.2 using a single bus, as shown in Figure 2. After the single-chip microcomputer reads the measured temperature data through the single bus interface, it can compensate the transmission speed of the ultrasonic wave through the formula to obtain higher ranging accuracy.

h.JPG

[page]

1.3 XF-S4240 speech synthesis module and its circuit design
   
① Introduction to XF-S4240 speech synthesis module
    Speech synthesis technology, referred to as TTS (Text To Speech) technology, is used to solve how to convert text information into sound information, so that people can obtain information in a richer and more natural way. Speech synthesis technology has developed rapidly at home and abroad. In China, the research on speech synthesis technology has gradually developed from theory to research and development. Its application field is very wide and the technology is becoming more and more mature. At present, in the field of embedded applications, the most representative ones are: XF-S4240 and XF-S4041CN of iFLYTEK and SYN6288 of Yuyin Tianxia.
    The speech synthesis module selected in this system is XF-S4240 embedded Chinese speech synthesis module of iFLYTEK. This module supports Chinese text in four internal code formats: GB2312, GBK, BIG5 and UNICODE, and provides synthesis of English letters, supports male/female voice pronunciation, and can flexibly adjust the speech speed, intonation and volume.
    ②XF-S42401 Communication mode
    XF-S4240 supports asynchronous serial port (UART), SPI and I2C communication modes, and the maximum length of data allowed to be sent is 1K bytes.
    Serial communication mode: baud rate: 9600 bps (default value), start bit: 1bit, data bit: 8 bits, stop bit: 1 bit, check: none.
    SPI communication mode: adopts 4-wire full-duplex synchronous serial communication interface, works in Slave mode, if the SPI communication interface uses SSEL to select the enable signal, multiple devices can be connected at the same time. I2C communication mode
    : adopts standard I2C bus interface, works in Slave mode, and multiple devices can be connected on the I2C bus at the same time.
    ③XF-S4240 control command
    XF-S4240 provides a variety of speech synthesis control commands, such as: synthesis command, stop synthesis command, pause synthesis command, resume synthesis command; the current working status of the module can be queried through the status query command; and the sleep command can put the module in sleep mode to reduce power consumption. For different control command frames issued by the host computer, the XF-S4240 module will send a single-byte feedback information back to the host computer. In addition, the current working state of the module can also be identified with the help of hardware circuits through the level change of the module output pin RDY/BSY.
    ④ Speech synthesis circuit design
    The speech synthesis system design is shown in Figure 2. The speech module is connected to the single-chip microcomputer with the help of the SPI interface. The working state of the module is indicated by the hardware RDY pin, which is connected to the INT1 pin of the single-chip microcomputer. When the pin is at a low level, it indicates that the board is in an idle state and can receive further commands. The audio power amplifier circuit uses the LM368 audio amplifier, and the output end can directly drive the speaker.
1.4 Other module circuit design
   
① LCD display circuit
    This design uses a 1602 character LCD module as the display output of the system, providing operation instructions and distance information display functions, see Figure 2.
    ② Key interface circuit
    This design uses several keys as the input interface of the system operation, allowing users to select relevant information for display or set the scale parameters of internal signal conversion, see Figure 2.
    ③ Power supply processing circuit
    In this design, the power supply is powered by a 4.2 V lithium battery to facilitate portable applications. However, the XF-S4240 also needs to be powered by 3.3 V. For this reason, the AMS1117-3.3V LDO device is selected to realize power conversion. Due to space limitations, this part of the circuit is omitted.

2 Software system design
   
See Figure 5 for the main program block diagram of the system. The program first initializes the IO ports, interrupt system, timer and other external devices of the microcontroller, and then enters the working cycle. The ultrasonic pulse signal is periodically sent through the ultrasonic transmitting transducer, and the echo signal reflected by the obstacle is detected through the ultrasonic receiving transducer. At the same time, the ambient temperature is measured through the DS18B20 to achieve real-time compensation for the ultrasonic propagation speed, thereby determining the distance of the target obstacle. After that, the LCD display is updated, and the relevant information is sent to the TTS module for voice broadcasting. Finally, the user's key information is read to complete the relevant function operation.

k.JPG


    The block diagram of the speech synthesis program is shown in Figure 6. The MCU first determines whether the speech synthesis module is in the ready state. If so, it sends the frame header, the total number of bytes, the speech synthesis command code, the speech synthesis format control code and the text to be synthesized in sequence. The speech module will then complete the TTS conversion according to the set command.

l.JPG



3 Conclusion
   
This system combines ultrasonic sensors and intelligent TTS speech synthesis functions, providing a new model for non-contact distance measurement and related applications. The system is moderately priced, compact, powerful, and has good practical value. The hardware circuit and software implementation of each part of the system are described in detail in this paper. The design ideas and techniques of this system can also provide reference for the design and production of other related products.

Reference address:Design of ultrasonic obstacle detection voice broadcast system based on TTS module

Previous article:Ultrasonic online detection system for precise control of wall thickness
Next article:What industries are infrared thermometers suitable for?

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号