基于单片机的超声波测距电路的研究毕业论文.doc
《基于单片机的超声波测距电路的研究毕业论文.doc》由会员分享,可在线阅读,更多相关《基于单片机的超声波测距电路的研究毕业论文.doc(66页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、 基于单片机的超声波测距电路的研究毕业论文目录设计总说明:.3ABSTRACT:.5第一章:超声波测距原理论述71.1 超声波介绍71.2 超声波测距系统概述91.3 超声波测距的基本原理111.4 本课题的容和任务12第二章 AVR单片机介绍132.1ATmega16结构框图162.2 AVR CPU 核192.3 AVR ATmega16存储器。192.4 AVR ATmega16系统时钟192.5 系统控制和复位202.6 看门狗定时器202.7 ATmega16 的中断向量(外部中断)202.8 具有PWM功能的8位定时器/ 计时器212.9 比较输出模式和波形产生222.10 T/C
2、0 与T/C1 的预分频器242.11 串行外设接口 SPI242.12 串行外设接口USART252.13 模数转换器252.14 JTAG 接口和片上调试系统26第三章硬件电路的设计263.1 电源电路设计263.2 复位电路设计273.3 时钟电路设计273.4 数码管显示电路283.5 报警电路设计303.6 温度补偿电路313.6.1 温度计算333.6.2 DSl820工作过程命令333.6.3时序333.6.4写时间隙343.6.5读时间隙343.6.6多路测量343.7在线通信电路设计35第四章,超声波发射电路与接收电路的设计364.1 超声波发射电路364.1.1压电陶瓷超声
3、波传感器介绍364.1.2发射电路原理图分析384.2 超声波接收电路394.2.1 LC震荡选频电路设计:394.2.2比较电路的设计404.2.3 接收电路原理图分析40第五章软件设计435.1主程序流程图435.2发射子程序设计445.3温度测量子程序445.4测量子程序465.5计算子程序465.6显示驱动子程序475.7报警子程序47第六章设计心得49致谢50参考文献51附录521设计理论:本设计应用基于声波的反射。声波在其传播的介质中被定义为纵波。当声波受到尺寸大于其波长的目标物阻挡时就会发生反射;反射波称为回声。如果声波在介质中传播的速度是已知的,而且测量到声波从声源到达目标然后
4、返回声源的时间,从声源到目标的距离就可以精确地计算出来。这就是本应用的测量原理。这里声波传播的介质就是空气,采用不可见的超声波。 假设室超声波的速度是340m/s则可以通过计算超声波通过时间来计算距离,但是实际温度对超声波影响很大,通过可以研究,速度和温度(T为绝对温度)存在一下关系:由于超声波通过的距离是2倍的实际距离,则实际距离是d/2,所以2 电路描述:本设计用来发射和接收超声波的设备是40hz压电陶瓷超声波传感器,AVR ATMEGA16单片机驱动超声波发射器40hz的方波来源于晶振,波接收器接收回波 由于AVR ATMEGA16单片机的计时器计算40khz的分辨率是25us 是完全胜
5、任我们的设计,我们系统的稳定性来源于晶振的工作。被超声波接收器超声波通过一个运算放大器放大对输入a放大,相对输入a输出超声波的同时触发单片机计时器timer1 ,捕获的回波被精确计算时间来计算距离。计数器从超声波发射开始计时到收到回波停止,时间被精确记录,我们可以通过DS18B20 芯片来确定室温,精确的确定超声波的速度,二者的距离通过 AVR ATMEGA16精确的计算同时在3个数码管上显示出来,一旦显示出来,单片机就进入休眠状态来节省电力能源。这篇设计的主要电路分析。传感器的输出驱动电路直接由9V 电池供电并提供驱动超声波发射器由一个二进制非门CD4049电路实现的。其中一个非门用来为驱动
6、器的一侧提供180 度的相移信号。另一侧由相信号驱动。这种结构使输出端的电压提高了一倍,为发射传感器提供了足够的电压。两个门并联连接以便每一侧能够为传感器提供足够的驱动电流。电容耦合阻断了到传感器的直流通路。因为CD4049 工作于9V 而AVR ATMEGA16工作于Vcc=5V。 AVR ATMEGA16和输出驱动器之间的逻辑电平是不匹配的,可以双极性晶体管就作为这两种逻辑电平之间的转换器。 由LC选频放大器对超声波接收器接收的回波在40KHz 时提供充分的高增益。选择并丢弃除了40KHz 之外的频率。运算放大器的输出端连接到比较器LM393的输入端。 比较器LM393 的参考电平部选择为
7、0V。当接收到回声时电压高于参考电平从而触发比较器的输出。然后触发单片机的INT0.本文在了解超声波测距原理的基础上,完成了基于时差测距原理的一种超声波测距系统的硬件设计,其中为了进一步提高系统测量精度和系统稳定性,在硬件上增加了温度传感器测温电路,采取声速预置和媒质温度测量相结合的方法对声速进行修正,降低了温度变化对测距精度的影响。针对噪声环境中超声波测距的情况,本文讨论了一种基于时延的估计方法,可有效地降低噪声对测距的干扰,有利于提高超声波测距系统的测量精度。关键词:超声波测距 AVR atmega16 DS18B20 ABSTRACT: In different occasions ,
8、the demands of the precision on ultrasonic distance measuring system are different .Usually , the error of the ultrasonic distance measuring system is large , so they cannot be satisfied with the demands in some occasions. This article takes temperATure account into the ult rasonic distance measurin
9、g system and makes it have higher precision han before and increases the function of broadcasting the result . It can apply in more occasions and be felt more convenient .This design application report describes a distance-measuring system based on ultrasonic sound utilizing the AVR atmega16 ultralo
10、w-power microcontroller. The system transmits a burst of ultrasonic sound waves towards the subject and then receives the corresponding echo. The time taken for the ultrasonic burst to travel the distance from the system to the subject and back to the system is accurately measured by the AVR atmega1
11、6. Assuming the speed of sound in air at room temperature to be 340m/s, the AVR atmega16 computes the distance between the system and the subject and displays it using a three-digit static LED driven by its integrated LED driver. The distance is displayed in inches with an accuracy of 1 cm. The mini
12、mum distance that this system can measure is 1cm and is limited by the transmitters transducer settling-time. The maximum distance that can be measured is 4m. The amplitude of the echo depends on the reflecting material, shape, and size. Sound-absorbing targets such as carpets the maximum measurable
13、 range is lower for such subjects. If the amplitude of the echo received by the system is so low that it is not detectable by the Comparator the system goes out of range. This is indicated by displaying the error message 1 Theory of Operation This application is based on the reflection of sound wave
14、s. Subjects whose Dimensions are larger than the wavelength of the impinging sound waves reflect them; the reflected waves are called the echo. If the speed of sound in the medium is known and the time taken for the sound waves to travel the distance from the source to the subject and back to the so
15、urce is measured, the distance from the source to the subject can be computed accurately. This is the measurement principle of this application. Since it is inaudible to humans. Assuming that the speed of sound in air is v=340m/s at room temperature and that the measured time taken for the sound wav
16、es to travel the distance from the source to the subject and back to the source is seconds,as we know:The distance d is computed by the formula Since the sound waves travel twice the distance between the source and the subject, the actual distance between the source and the subject will be d/2.2 Cir
17、cuit DescriptionThe devices used to transmit and receive the ultrasonic sound waves in this application are 40-kHz ceramic ultrasonic transducers. AVR ATMEGA16 drives the transmitter transducer with 40-kHz square-wave signal derivedfrom the crystal oscillator, and the receiver transducer receives th
18、e echo. The Timer1in the AVR is configured to count the 40-kHz crystal frequency such that the time measurement resolution is 25 s, which is more than adequate for this application. The measurement time base is very stable as it is derived from a quartz-crystal oscillator. The echo received by the r
19、eceiver transducer is amplified by an operational amplifier and the amplified output is fed to the Comparator_A input. The Comparator_A senses the presence of the echo signal at its input and triggers a capture of Timer_A count value to capture compare register timer1. The capture is done exactly at
20、 the instant the echo arrives at the system. The captured count is the measure of the time taken for the ultrasonic burst to travel the distance from the system to the subject and back to the system. The distance in inches from the system to the subject is computed by the AVR ATMEGA16 using this mea
21、sured time and displayed on a two-digit static LED. Immediately after updating the display, the AVR goes to sleep mode to save power. The circuit schematic diagram of this application. The output drive circuit for the transducer is powered directly from the 9-V battery and providesdrive to the ultra
22、sonic transmitter. The is achieved by a bridge configuration withhex inverter gates CD4049. One inverter gateis used to provide a-degrees phase-shifted signal to one arm of the driver. The other arm isdriven by the in-phase signal. This configuration doubles the voltage swing at the output andprovid
23、es the required to the transmitter transducer. Two gates are connected in parallelso that each arm can provide adequate current drive to the transducer. Capacitors block the dc to the transducer. Since the CD4049 operates on 9-V and the AVR ATMEGA16 operates ona VCC of 5 V, there is a logic level mi
24、smatch between the AVR ATMEGA16 and the output driver circuit.Bipolar transistor acts as a logic-level shifter between these two logic levels.Operational amplifier NPNis made of by Circuit ,This amplifier has a high-gain bandwidth andprovides sufficiently high gain at 40 kHz. The amplified ultrasoni
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 基于 单片机 超声波 测距 电路 研究 毕业论文
限制150内