作者:电子科技大学 吴学璋 (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.
3 Design and mechanical structure of the push rod
This section will mainly describe the self-designed bread-pushing rod and its operating principle. The process about how the robot pushes the rod in order to throw the bread into the lake.
The rod will stop as soon as the distance between the rod and bread is less than 20 centimeters. The battery will supply the energy to the micro-controller. In this project, mbed is used to perform this function. The energy will make the gear motor rotate, when the gear is activated, it will push the rod ahead and the rod will push the bread forward. And finally after a certain time (we estimated the time that the bread can be pushed away) the motor will rotate in the opposite direction and take back the rod.
Then some details in the process will be discussed. First is about the energy supply. At the beginning, the battery supply the energy to the mbed, but it is not strong enough to drive the motor. So between the mbed and motor we added an inverter to connect them. If a low voltage is given to the input of the inverter, it will output a higher voltage which is strong enough to make the gear rotate. Then it’s about how to push the rod by rotating the gear. The motor will make the gear rotate in clockwise after it accepts the command from the mbed. Then it will push rod ahead until for a certain time and after that the gear will rotate in the opposite direction to take back the rod. Besides, we place a rack which is in series with the rod and its insections are completely matched to the gear.
In the mechanical part, two plastic splines with teeth and a small DC-motor with a 5V supply voltage are the main components used.
There are some basic requirements. The first is the whole bread-pushing part must be easy to control, which means it should be able to be controlled based on simple code instructions, and the structure shall not get stuck itself during the motion process. The second is the part must be firm and reliable, which will bring more flexibility for other parts to error while it doesn’t do so itself. The third is the part shall be modifiable to a certain extent, so that the structure could be fixed or adjusted due to real situations and demands.
Figure 3.1. Figure 3.2.
A graphic of the bread pushing rod Picture of the bread pushing rod
At first, including the final version, there are three main possible solutions, namely, splines and a motor, a mechanical arm, a simple-structured single-use slingshot-like module. However, the mechanical arm is a bit too big for the scale of the body of the car, and hard to be programmed at the same time. Meanwhile, the slingshot structure is resistless to physical impact and vibrations, which will possibly result in high rate of spurious triggering during the advance. Thus, at last, the splines and a motor is chosen as the solution, due to its simplicity of programming with only one motor.
For the assembling of the structure, the supportive parts are self-made, due to the incompatibility of the default module. In practice, the self-made structure is proved to be efficient and good enough to stretch out and draw back.
关键字:超声波测距
引用地址:超声波测距在智能小车中的应用
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.
3 Design and mechanical structure of the push rod
This section will mainly describe the self-designed bread-pushing rod and its operating principle. The process about how the robot pushes the rod in order to throw the bread into the lake.
The rod will stop as soon as the distance between the rod and bread is less than 20 centimeters. The battery will supply the energy to the micro-controller. In this project, mbed is used to perform this function. The energy will make the gear motor rotate, when the gear is activated, it will push the rod ahead and the rod will push the bread forward. And finally after a certain time (we estimated the time that the bread can be pushed away) the motor will rotate in the opposite direction and take back the rod.
Then some details in the process will be discussed. First is about the energy supply. At the beginning, the battery supply the energy to the mbed, but it is not strong enough to drive the motor. So between the mbed and motor we added an inverter to connect them. If a low voltage is given to the input of the inverter, it will output a higher voltage which is strong enough to make the gear rotate. Then it’s about how to push the rod by rotating the gear. The motor will make the gear rotate in clockwise after it accepts the command from the mbed. Then it will push rod ahead until for a certain time and after that the gear will rotate in the opposite direction to take back the rod. Besides, we place a rack which is in series with the rod and its insections are completely matched to the gear.
In the mechanical part, two plastic splines with teeth and a small DC-motor with a 5V supply voltage are the main components used.
There are some basic requirements. The first is the whole bread-pushing part must be easy to control, which means it should be able to be controlled based on simple code instructions, and the structure shall not get stuck itself during the motion process. The second is the part must be firm and reliable, which will bring more flexibility for other parts to error while it doesn’t do so itself. The third is the part shall be modifiable to a certain extent, so that the structure could be fixed or adjusted due to real situations and demands.
Figure 3.1. Figure 3.2.
A graphic of the bread pushing rod Picture of the bread pushing rod
At first, including the final version, there are three main possible solutions, namely, splines and a motor, a mechanical arm, a simple-structured single-use slingshot-like module. However, the mechanical arm is a bit too big for the scale of the body of the car, and hard to be programmed at the same time. Meanwhile, the slingshot structure is resistless to physical impact and vibrations, which will possibly result in high rate of spurious triggering during the advance. Thus, at last, the splines and a motor is chosen as the solution, due to its simplicity of programming with only one motor.
For the assembling of the structure, the supportive parts are self-made, due to the incompatibility of the default module. In practice, the self-made structure is proved to be efficient and good enough to stretch out and draw back.
上一篇:风河VxWorks全新升级尽显Java嵌入式开发优势
下一篇:The Color Detection in Vehicle Robot
推荐阅读最新更新时间:2024-05-03 00:45
超声波测距原理
超声波传感器: 有触发控制端和echo接收端: 触发控制端每当输出一个大于10US的高电平就会驱动传感器发出8个40KHZ的超声波,实现电能-机械能-超声波转换。 ECHO接收端:通过测量接收端高电平的持续时间Th即可计算出离障碍物的距离。 distance=Th*340/2 实现方法: 将单片机的IO配置成输入边缘中断(上升沿和下降沿)同时利用定时器的输入捕获,分别在上升沿和下降沿触发捕获中断,从捕获寄存器中得到2次计数器的差值,差值*定时器定时周期=高电平的持续时间。
[单片机]
基于AT89S52单片机的超声波测距系统电路设计
超声波是一种频率在20KHz 以上的机械波,在空气中的传播速度约为340 m/s(20 C时)。超声波可由超声波传感器产生,常用的超声波传感器两大类:一类是采用电气方式产生超声波,一类是用机械方式产生超声波,目前较为常用的是压电式超声波传感器。由于超声波具有易于定向发射,方向性好,强度好控制,对色彩、光照度不敏感,反射率高等特点,因此被广泛应用于无损探伤,距离测量、距离开关、汽车倒车防撞、智能机器人等领域。 本设计的整体框图如图所示,主要由超声波发射,超声波接收与信号转换,按键显示电路与温度传感器电路组成。超声波测距是通过不断检测超声波发射后遇到障碍物所反射的回波,从而测出发射和接收回波的时间差T,然后求出距离S=CT/2,
[单片机]
7-基于51单片机的超声波测距及温度补偿
具体实现功能 系统由STC89C52单片机+超声波测距传感器(HC-SR04)+DS18B20温度传感器+LCD1602液晶显示屏+按键+蜂鸣器+电源构成 具体功能:1、LCD1602液晶显示测量的距离和温度; 2、测量范围0.02m~4m,精度为0.01m; 3、可以设置距离报警上下限值;按键功能:加键,减键,设置键 4、超过设定的报警上下限值则开始声光报警。 设计背景 单片机技术的迅速兴起与蓬勃发展,其稳定、安全、高效、经济等优点十分突出,所以其应用也十分广泛。单片机已经无处不在、与我们生活息息相关,并且渗透到生活的方方面面,如空调、VCD机、手机、微波炉、自动洗衣机及汽车电子设备等。单片机的特点是体积较小
[单片机]
模块学习(四)——超声波测距
今天想着把测距模块全部一网打尽了,把点对点和点对面两种测距全部搞定,于是有了这篇关于超声波模块的博客分享,主要还是分享代码,原理啥的网上都有,这次是基于MSP430F5529的driverlib库,没有找到开源的代码就自己分享一下了! 1.基本原理 还是稍稍讲一下原理,不然等下可能代码看不懂。两个引脚,一个TRIG,一个ECHO,就是触发和回响,顾名思义,trig是用来触发启动超声波模块的,echo模块是用来回收超声波的。此次使用的是US-100超声波模块,其实和常见的HC-SR04/5系列是一样的,代码均可用。 基本原理 trig引脚给一个大于10us的高电平脉冲,即会启动超声波模块。 启动之后,模块内部会发送一段8
[单片机]
超声波测距仪的工作原理
1、 超声波发生器 为了研究和利用超声波,人们已经设计和制成了许多超声波发生器。总体上讲,超声波发生器可以分为两大类:一类是用电气方式产生超声波,一类是用机械方式产生超声波。电气方式包括压电型、磁致伸缩型和电动型等;机械方式有加尔统笛、液哨和气流旋笛等。它们所产生的超声波的频率、功率和声波特性各不相同,因而用途也各不相同。目前较为常用的是压电式超声波发生器。 2、压电式超声波发生器原理 压电式超声波发生器实际上是利用压电晶体的谐振来工作的。超声波发生器内部结构如图1所示,它有两个压电晶片和一个共振板。当它的两极外加脉冲信号,其频率等于压电晶片的固有振荡频率时,压电晶片将会发生共振,并带动共振板振动,便产生超声波。反之,如果两电
[测试测量]
基于51单片机的超声波测距系统的研究与设计
在日常生产生活中,很多场合如汽车倒车、机器人避障、工业测井、水库液位测量等需要自动进行非接触测距。超声波是指频率大于20 kHz的在弹性介质中产生的机械震荡波,其具有指向性强、能量消耗缓慢、传播距离相对较远等特点,因此常被用于非接触测距。由于超声波对光线、色彩和电磁场不敏感,因此超声波测距对环境有较好的适应能力,此外超声波测量在实时、精度、价格也能得到很好的折衷。 为此,文中尝试以单片机AT89S52为核心,利用一对40 kHz压电超声传感器设计一款体积较小、价格低廉、精度较高、具有温度补偿、实时LCD显示和报警的超声波测距仪。 1 超声波测距原理 超声波传感器分机械方式和电气方式两类,它实际上是一种换能器,在发射端
[单片机]
简单的单片机超声波测距板
这款简单的单片机超声波测距板,硬件电路的设计主要包括单片机系统及显示电路、超声波发射电路和超声波接收电路三部分。单片机采用AT89C2051。采用12MHz高精度的晶振,以获得较稳定时钟频率,减小测量误差。单片机用P3.5端口输出超声波换能器所需的40kHz的方波信号,P3.7端口监测超声波接收电路输出的返回信号。显示电路采用简单实用的3位共阳LED数码管,段码输出端口为单片机的P1口,位码输出端口分别为单片机的P3.2、P3.1、P3.0口,数码管位驱运用PNP三极管S9012三极管驱动。测量范围25-300厘米,精度1厘米。 焊好的实物图 原理图 ; 基于AT89C2051单片机超声波
[单片机]
单片机超声波测距原理图
这是一款单片机超声波测距原理图,这款单片机超声波测距板电路简单,制作容易,无需进行调试,电路焊焊接好后,下装程序后即可工作。 #include REG2051.H #define csbout P3_5 //超声波发送 #define csbint P3_7 //超声波接收 #define csbc=0.034 #define bg P3_4 unsigned char csbds,opto,digit,buffer ,xm1,xm2,xm0,key,jpjs,ki;//显示标识 unsigned char convert ={0x3F,0x06,0x5b,0x4f,0x66,0x6d
[单片机]