您的位置 首页 硬件

超声波测距如安在智能小车中进行使用?

作者:电子科技大学 吴学璋 (Xuezhang Wu)AbstractThis report covers details about the design and part of the codes

作者:电子科技大学 吴学璋 (Xuezhang Wu)

Abstract

This report covers details about the design and part of the codes of the ultrasonic distance measurement and locating objects, which is part of a self-design robot project.

Distance detecting and bread pushing part

This part will discuss the distance test component, HCSR04 ultrasonic module, its application in our design and our working on bread push part.

1 Description of ultrasonic module HCSR04

The ultrasonic wave is used to measure the distance between the robot and the bread. By the reflecting the character of the ultrasonic wave, the distance between the ultrasonic module and the obstacle can be calculated by the formula

,

where L is the distance between bread and car, C is the speed of the ultrasonic wave in the air and T is the time difference of launching and receiving ultrasonic wave. However, error is inevitable by using this method because the robot is moving. When the module is working, the position of the car is not fixed. So, the measured time from the module is smaller than true time.

But in this experiment, the speed of the ultrasonic wave is much larger than the speed of the car thus the time between launching and receiving is so short that can be ignored.

In our design, the module chosen to launch and receive ultrasonic wave is HC-SR04. The picture of the module can be shown as below.

Figure 1.1. A picture of HCSR04 module

The module is IO trigger type. The triggering condition of the module is at least 10 microsecond high level signal. After being triggered, the module will launch eight 40 kHz square wave. When the module receive the back coming ultrasonic wave, it will get a continue high level as the output signal, the time for this high level is the time T mentioned in the last paragraph.

Figure 1.2. The time sequence of ultrasonic wave

The design processing picture is shown as below, the most important point should be mentioned is 30 ms in the processing. By the specification of the module, the minimum value of the triggering signal’s period is 60 ms. To avoid the next launching ultrasonic wave influences the echo of the last ultrasonic wave. The time between launching and receiving must smaller than 30 ms.

Figure 1.3. The diagram of he working logic of ultrasonic distance testing (display E means unable to measure the distance and shows error)

2 Bread locating procedure

This section will mainly describe how the bread is detected and pushed into the lake. At the beginning, our robot is moving along the fence which is facing the left side of the bread. The distance between the bread and the robot is measured by a ultrasonic equipment–HCSR04. The module emits a ultrasonic signal from the emitter. If the receiver can get the signal after some time, the distance can be measured through some mathematical method. As long as the distance is smaller than 20 cm, the robot will stop running ahead and turn left and moving straight ahead for one second, then it will turn right and moving straight ahead for one second, and then turn right and moving forward.

This means the robot changes its original position into the new position which is facing the front side of the bread. While the vehicle moving forward towards the bread, the ultrasonic equipment starts to measure a new distance between the bread and the vehicle. When the distance is smaller than 20cm, the vehicle will stop and the pushing rod will operate to push the bread into the lake and then it will moving backward. After this, the robot will turn left and finish the rest of the journey.

The code for ultrasonic distance measurement is shown below.

Figure 2.1. A screenshot of code fragment of ultrasonic distance measuring

One thing that should be mentioned is that the distance is set to 100 cm after the vehicle judges the distance is smaller than 20 cm. This is to disable the ultrasonic equipment so that the vehicle will not be disturbed by the environment during the turning. And we star the ultrasonic equipment again when the vehicle complete the turning.

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/qianrushi/yingjian/147549.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部