The 51 series single-chip microcomputer provides a highly flexible and low-cost solution for many controls. By making full use of its on-chip resources, a fully functional ultrasonic ranging system can be constructed with fewer peripheral circuits.
1 Principle of distance measurement by single-chip microcomputer
The single-chip microcomputer emits ultrasonic ranging by continuously detecting the echo reflected by obstacles after the ultrasonic emission, thereby measuring the time difference tr between the emission and reception of the echo, and then calculating the distance S=Ct/2, where C is the ultrasonic wave speed.
There are four factors that limit the maximum measurable distance of the system: the amplitude of the ultrasonic wave, the texture of the reflection, the angle between the reflected and incident sound waves, and the sensitivity of the receiving transducer. The direct receiving ability of the receiving transducer to the sound wave pulse will determine the minimum measurable distance. In order to increase the measured coverage and reduce the measurement error, multiple ultrasonic transducers can be used as a design method for multi-channel ultrasonic emission/reception. Since ultrasonic waves belong to the sound wave range, their wave speed C is related to temperature. Table 1. Lists the wave speeds at several different temperatures.
Due to temperature changes during distance measurement, the temperature sensor can automatically detect the ambient temperature and determine the wave speed C when calculating the distance, so as to more accurately obtain the distance traveled by the ultrasonic wave in this environment, thereby improving the measurement accuracy. After the wave speed is determined, as long as the round-trip time r of the ultrasonic wave is measured, the distance 5 can be obtained. The system principle block diagram is shown in Figure 2.
The single-chip microcomputer (AT89C51) sends a short 40kHz signal, which is amplified and output through the ultrasonic transducer; the reflected ultrasonic wave is used as the input of the system through the ultrasonic transducer, and the phase-locked loop locks this signal, generates a locking signal to start the single-chip microcomputer interrupt program, and obtains the time t. After the system software calculates and judges it, the corresponding calculation result is sent to the LED display circuit for display. If the measured distance exceeds the set range, the system will prompt the sound alarm circuit to alarm.
AT89C51 outputs an ultrasonic pulse train with a pulse width of 25/us and a carrier of 40kHz through the external pin P2.0, which is added to the base stage of the emitter follower and driven by the power amplifier to be emitted by the ultrasonic transmitter. The ultrasonic receiver sends the received reflected ultrasonic wave to the amplifier for amplification, and then uses the phase-locked loop circuit for detection. After processing, the output is low level and sent to the pin of AT89C51.
Example of design using this principle: Car anti-collision radar
2 System hardware design
Car anti-collision radar can help drivers understand the obstacles around the car in time and prevent the car from being hit or scratched when turning, reversing, etc. The hardware circuit of the receiving part is shown in Figure 3, and the hardware circuit of the transmitting, preset, control, and display part is shown in Figure 4.
sP3.2, provided to the software for processing. After AT89C51 processes the received information, the measured distance is displayed on the LED. The displayed data is output to 74LSl64 by the serial port line RXD and TXD, and converted into parallel data to control the display of the LED, using dynamic display. The two LEDs can represent a distance of 4.9 to 0.1 m, which meets the display accuracy; if the distance is less than the preset low-speed safety braking range of the car (such as: 1 n) or 0.5m), the alarm circuit will issue an appropriate warning tone, and the output of P2.1 will control the operation of the alarm circuit.
3 System software design
The automobile anti-collision radar is developed and designed with AT89C51 microcontroller based on the ultrasonic ranging principle. The entire software adopts modular design and consists of modules such as main program, preset subprogram, transmission subprogram, receiving subprogram, and display subprogram.
The main idea of software design is to compile the preset, transmission, reception, display, and sound alarm functions into independent modules. In the main program, a key-controlled loop is used. When the control key is pressed, each module is executed in sequence within a certain period, calling the preset subprogram, transmission subprogram, query reception subprogram, and timing subprogram, and the measurement results are analyzed and processed. According to the processing results, the content of the display program and whether to call the sound alarm program are determined. When the measured distance is less than the preset distance, the sound alarm program is called. Figure 5 shows the flow chart of the program.
4 Conclusion
The rangefinder designed with 51 series microcontrollers is easy to operate and the reading is intuitive. Actual tests have proved that this type of rangefinder works stably, can meet the requirements of general short-range ranging, and has low cost and good cost performance. Since it takes a certain amount of time for the phase-locked loop in this system to lock, there is an error in the measured distance. In automotive radar applications, this error is 3C111 and can be ignored; but in industrial fields with higher precision requirements, such as automatic ranging of robots, this error cannot be ignored. Only by changing the application of some hardware to achieve rapid locking of the ultrasonic wave can the error be further reduced to 0.31llnl to meet higher requirements.
Reference address:Single chip ultrasonic rangefinder
1 Principle of distance measurement by single-chip microcomputer
The single-chip microcomputer emits ultrasonic ranging by continuously detecting the echo reflected by obstacles after the ultrasonic emission, thereby measuring the time difference tr between the emission and reception of the echo, and then calculating the distance S=Ct/2, where C is the ultrasonic wave speed.
There are four factors that limit the maximum measurable distance of the system: the amplitude of the ultrasonic wave, the texture of the reflection, the angle between the reflected and incident sound waves, and the sensitivity of the receiving transducer. The direct receiving ability of the receiving transducer to the sound wave pulse will determine the minimum measurable distance. In order to increase the measured coverage and reduce the measurement error, multiple ultrasonic transducers can be used as a design method for multi-channel ultrasonic emission/reception. Since ultrasonic waves belong to the sound wave range, their wave speed C is related to temperature. Table 1. Lists the wave speeds at several different temperatures.
Due to temperature changes during distance measurement, the temperature sensor can automatically detect the ambient temperature and determine the wave speed C when calculating the distance, so as to more accurately obtain the distance traveled by the ultrasonic wave in this environment, thereby improving the measurement accuracy. After the wave speed is determined, as long as the round-trip time r of the ultrasonic wave is measured, the distance 5 can be obtained. The system principle block diagram is shown in Figure 2.
The single-chip microcomputer (AT89C51) sends a short 40kHz signal, which is amplified and output through the ultrasonic transducer; the reflected ultrasonic wave is used as the input of the system through the ultrasonic transducer, and the phase-locked loop locks this signal, generates a locking signal to start the single-chip microcomputer interrupt program, and obtains the time t. After the system software calculates and judges it, the corresponding calculation result is sent to the LED display circuit for display. If the measured distance exceeds the set range, the system will prompt the sound alarm circuit to alarm.
AT89C51 outputs an ultrasonic pulse train with a pulse width of 25/us and a carrier of 40kHz through the external pin P2.0, which is added to the base stage of the emitter follower and driven by the power amplifier to be emitted by the ultrasonic transmitter. The ultrasonic receiver sends the received reflected ultrasonic wave to the amplifier for amplification, and then uses the phase-locked loop circuit for detection. After processing, the output is low level and sent to the pin of AT89C51.
Example of design using this principle: Car anti-collision radar
2 System hardware design
Car anti-collision radar can help drivers understand the obstacles around the car in time and prevent the car from being hit or scratched when turning, reversing, etc. The hardware circuit of the receiving part is shown in Figure 3, and the hardware circuit of the transmitting, preset, control, and display part is shown in Figure 4.
sP3.2, provided to the software for processing. After AT89C51 processes the received information, the measured distance is displayed on the LED. The displayed data is output to 74LSl64 by the serial port line RXD and TXD, and converted into parallel data to control the display of the LED, using dynamic display. The two LEDs can represent a distance of 4.9 to 0.1 m, which meets the display accuracy; if the distance is less than the preset low-speed safety braking range of the car (such as: 1 n) or 0.5m), the alarm circuit will issue an appropriate warning tone, and the output of P2.1 will control the operation of the alarm circuit.
3 System software design
The automobile anti-collision radar is developed and designed with AT89C51 microcontroller based on the ultrasonic ranging principle. The entire software adopts modular design and consists of modules such as main program, preset subprogram, transmission subprogram, receiving subprogram, and display subprogram.
The main idea of software design is to compile the preset, transmission, reception, display, and sound alarm functions into independent modules. In the main program, a key-controlled loop is used. When the control key is pressed, each module is executed in sequence within a certain period, calling the preset subprogram, transmission subprogram, query reception subprogram, and timing subprogram, and the measurement results are analyzed and processed. According to the processing results, the content of the display program and whether to call the sound alarm program are determined. When the measured distance is less than the preset distance, the sound alarm program is called. Figure 5 shows the flow chart of the program.
4 Conclusion
The rangefinder designed with 51 series microcontrollers is easy to operate and the reading is intuitive. Actual tests have proved that this type of rangefinder works stably, can meet the requirements of general short-range ranging, and has low cost and good cost performance. Since it takes a certain amount of time for the phase-locked loop in this system to lock, there is an error in the measured distance. In automotive radar applications, this error is 3C111 and can be ignored; but in industrial fields with higher precision requirements, such as automatic ranging of robots, this error cannot be ignored. Only by changing the application of some hardware to achieve rapid locking of the ultrasonic wave can the error be further reduced to 0.31llnl to meet higher requirements.
Previous article:Design and implementation of CAN bus interface circuit based on SJA1000
Next article:How to make Keil MDK compatible with Keil C51?
- Popular Resources
- Popular amplifiers
Recommended Content
Latest Microcontroller Articles
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- 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
MoreDaily News
- 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
Guess you like
- Amplifier
- Multi-cell 36-48V Battery Management System Reference Design
- EBAZ4205 mining board transformation based on Z7010
- Samsung closes another factory in China! N+5 compensation higher than national standards
- IMX6-A9 series: display function test
- 5G in 60: An introduction to 5G
- Battery system state of charge calculation algorithm problem
- I'm a newbie in your place, please take care of me, thank you!
- Choosing Machine Learning Processors at the Edge
- EEWORLD University Hall----MATLAB Applications Complete Book Video