Design of distance measurement system based on ultrasonic sensor

Publisher:TranquilDreamsLatest update time:2013-10-31 Source: 21icKeywords:Atmel Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
  Safe obstacle avoidance is a basic problem in mobile robot research. Obtaining the distance between the obstacle and the robot is the premise of studying safe obstacle avoidance. Ultrasonic sensors are widely used as distance sensors due to their advantages such as simple information processing, low price, and easy hardware implementation. This ultrasonic distance measurement system uses the Polaroid 6500 series ultrasonic distance module and 600 series sensor produced by SensComp, and the microprocessor uses the AT89C51 of ATMEL. This article analyzes and introduces this ultrasonic distance measurement system in detail.

  1. Ultrasonic sensor and its ranging principle

  Ultrasonic waves refer to mechanical waves with a frequency higher than 20 kHz [1]. In order to use ultrasonic waves as a detection method, it is necessary to generate and receive ultrasonic waves. The device that performs this function is an ultrasonic sensor, usually called an ultrasonic transducer or ultrasonic probe. An ultrasonic sensor has a transmitter and a receiver, but an ultrasonic sensor can also have the dual function of sending and receiving sound waves. Ultrasonic sensors use the principle of piezoelectric effect [1] to convert electrical energy and ultrasonic waves into each other. That is, when emitting ultrasonic waves, electrical energy is converted to emit ultrasonic waves; and when receiving echoes, ultrasonic vibrations are converted into electrical signals.

The principle of ultrasonic ranging generally uses the time of flight method TOF (time of flight) [2]. First, the time it takes for the ultrasonic wave to be emitted and return after encountering an obstacle is measured, and then multiplied by the speed of the ultrasonic wave to obtain twice the distance between the sound source and the obstacle, that is,

  2. Hardware circuit design

  The ultrasonic distance measurement system we designed is composed of Polaroid 600 series sensor, Polaroid 6500 series ultrasonic distance module and AT89C51 single chip.

  2.1 Polaroid 600 Series Sensors

  This ultrasonic sensor is a sensor that integrates transmission and reception. There is a circular sheet inside the sensor. The sheet is made of plastic, with a metal film coated on the front and an aluminum back plate on the back. The sheet and the back plate form a capacitor. When a square wave voltage of 49.4kHz and 300VAC pk-pk is applied to the sheet, the sheet vibrates at the same frequency, thereby generating ultrasonic waves with a frequency of 49.4kHz. When receiving echoes, there is a tuning circuit in the Polaroid 6500 so that only signals with frequencies close to 49.4kHz can be received, while signals of other frequencies are filtered out.

  The ultrasonic wave sent by the Polaroid 600 ultrasonic sensor has a beam angle of 30 degrees [3], as shown in Figure 1:


Figure 1 Beam angle

  Ultrasonic sensors can be used as both transmitters and receivers. The sensor transmits a series of ultrasonic beams over a period of time. The reception can only be started after the transmission is completed. If the time for transmitting the beam is D, the signal reflected from the object within D time cannot be captured. In addition, the ultrasonic sensor has a certain inertia, and there is still a certain amount of residual vibration after the transmission is completed. This residual vibration also generates a voltage signal through the transducer, disrupting the system's work of capturing the return signal. Therefore, before the residual vibration disappears, the system cannot be started for echo reception. The above two reasons cause the ultrasonic sensor to have a certain measurement range. This ultrasonic wave can measure 37cm at the closest.

  2.2 Polaroid 6500 Series Ultrasonic Distance Module

  The hardware circuit of the Polaroid 6500 series ultrasonic distance module is shown in Figure 2:


Figure 2 Hardware circuit of Polaroid 6500 series ultrasonic distance module [page]

   TL851 is an economical digital 12-step distance control integrated circuit. There is a 420KHz ceramic crystal inside. When the 6500 series ultrasonic distance module starts working, in the first 16 cycles of transmission, the ceramic crystal is divided by 8.5 to form a 49.4KHz ultrasonic signal, which is then transmitted to the ultrasonic sensor through transistor Q1 and transformer T1. After transmission, the ceramic crystal is divided by 4.5 for timing of the microcontroller. TL852 is a chip specially designed for receiving ultrasonic waves. Because the returned ultrasonic signal is relatively weak, it needs to be amplified before it can be received by the microcontroller. TL852 mainly provides an amplification circuit. When TL852 receives 4 pulse signals, it sends a high level to TL851 through REC to indicate that the ultrasonic wave has been received.

  2.3 AT89C51 Microcontroller

  This system uses AT89C51 to control the Polaroid 600 series sensors and Polaroid 6500 series ultrasonic distance modules. The single-chip microcomputer controls the transmission of ultrasonic waves through the P1.0 pin via an inverter, and then the single-chip microcomputer continuously detects the INT0 pin. When the level of the INT0 pin changes from a high level to a low level, it is considered that the ultrasonic wave has returned. The data counted by the counter is the time experienced by the ultrasonic wave, and the distance between the sensor and the obstacle can be obtained by conversion. The hardware schematic diagram of ultrasonic ranging is shown in Figure 3:


Figure 3 Hardware diagram of ultrasonic ranging

  3. System software design

  The system program flow chart is shown in Figure 4:


Figure 4 Ultrasonic ranging program flow chart

  When working, the microprocessor AT89C51 first sets P1.0 to 0, starts the ultrasonic sensor to transmit ultrasonic waves, and starts the internal timer T0 to start timing. Since the ultrasonic sensor we use is a transceiver, the ultrasonic sensor still has aftershocks after sending 16 pulses. In order to eliminate the transmission signal of the ultrasonic sensor from the return signal, the return signal must be detected 2.38ms after the start of the transmission signal, so that the output interference can be suppressed. When the ultrasonic signal hits an obstacle, the signal returns immediately, and the microprocessor keeps scanning the INT0 pin. If the signal received by INT0 changes from a high level to a low level, it means that the signal has returned, and the microprocessor enters the interrupt shutdown timer. The data in the timer is converted to get the distance between the ultrasonic sensor and the obstacle.

  4. Experimental data processing

  Due to the influence of ambient temperature and humidity, there is always some deviation between the measured value of the ultrasonic sensor and the actual value. Table 1 lists the measured value of this ultrasonic ranging system and the corresponding actual value:

Table 1 Measured values ​​and actual values ​​of ultrasonic ranging system Unit: cm

 

  From the data in the table, we can see that the measured value is always about 7cm larger than the actual value. After analysis, there are three main reasons: first, the data measured by the ultrasonic sensor is affected by the ambient temperature; second, the command execution takes a certain amount of time, which makes the measured data larger; third, in order to prevent interference from other signals, the drive circuit sends 16 pulse trains when the microcontroller starts counting. For the single echo method, when the drive circuit receives the fourth pulse returned by the obstacle, it stops counting, so the final measured time is four pulses longer than the time corresponding to the actual distance. In order to reduce the deviation between the measured value and the actual value, we use the least squares method [4~5] to correct the data in Table 1. After fitting, we get the following equation:

   y=1.0145x-9.3354? (where y is the actual value and x is the measured value)

   The corresponding relationship between the measured value and the actual value of the ultrasonic ranging system after correction is shown in Table 2:

Table 2 Corrected ultrasonic ranging system measured values ​​and actual values ​​Unit: cm

 

  From the corrected data we can see that the measurement error of the system is within ±2%, which meets our measurement requirements.

  5. Conclusion

  When using ultrasonic sensors to measure distance, the main thing is to ensure that the circuit design meets the reliability and stability of the circuit. After experiments and analysis, we believe that using the 6500 series distance module and 600 series ultrasonic sensor to measure distance is simple, economical, and reliable, and the error of the measured data is relatively small.

Keywords:Atmel Reference address:Design of distance measurement system based on ultrasonic sensor

Previous article:Simulation design of liquid crystal temperature display based on Proteus
Next article:A constant current source design based on power amplifier

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号