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.
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:
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
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.
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.
[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.
③ 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.
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.
[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.
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.
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.
Previous article:Ultrasonic online detection system for precise control of wall thickness
Next article:What industries are infrared thermometers suitable for?
- Popular Resources
- Popular amplifiers
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Seizing the Opportunities in the Chinese Application Market: NI's Challenges and Answers
- Tektronix Launches Breakthrough Power Measurement Tools to Accelerate Innovation as Global Electrification Accelerates
- Not all oscilloscopes are created equal: Why ADCs and low noise floor matter
- Enable TekHSI high-speed interface function to accelerate the remote transmission of waveform data
- How to measure the quality of soft start thyristor
- How to use a multimeter to judge whether a soft starter is good or bad
- What are the advantages and disadvantages of non-contact temperature sensors?
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [Repost] 7 PCB layout principles, good PCB design depends on it
- How to choose electromagnetic relay
- It’s terrible. Two manufacturers in the PCB industry are engaged in a price war. Did you get any benefits yesterday?
- 【McQueen Trial】Python Programming (4)
- Partial Discharge in Switching Power Supplies
- Crazy Shell AI open source drone interruption (key detection)
- How does GaN meet the challenges brought by 5G?
- PCB
- (Help) [New version of Zhongke Bluexun AB32VG1 RISC-V development board] - 6: "COM is closed"
- embOS-Ultra: High-resolution system