毕业设计基于AT89S52单片机的风速测量仪的设计.doc
基于AT89S52单片机的风速测量仪的设计综述风,特别是井下安全生产中具有重要参考意义,作为气象环境中最活跃的因素,对战争的胜败,武器性能的发挥有着举足轻重的影响风能的利用,也要求人们对风速资源进行长时间的准确监测。当前,风速测量的仪器主要有热线式、热膜式、以及风杯式三种。这几种原理的风速仪测量精度低、范围小、测量周期长、持续工作时间短,且测量结果易受外部环境因素的影响。因此不能满足高效、快速、准确的现代化军事和长时间工作、智能化数据处理的风场监测的需求。本设计采用压电式超声波换能器,使用AT89S52单片机作为控制器,完成了超声波风速测量仪的软硬件设计。采用汇编语言编程的方法,实现了测量结果的计算和显示。设计完成后能做到,LED数码显示清晰稳定,测量结果稳定可靠,测距仪最大误差不超过0.05m/s。系统硬件电路的设计 硬件电路的设计主要包括单片机系统及显示电路、键盘,温度补偿电路,超声波发射电路和超声波检测接收电路三部分。单片机采用89S52或其兼容系列。采用11.0592MHz高精度的晶振,以获得较稳定时钟频率,减小测量误差。系统采用555定时器产生145kHz的方波信号,利用计数T1口监测超声波接收电路整形滤波后输出的返回信号。显示电路采用简单实用的4位共阴极LED数码管,段码用电阻器驱动,位码用PNP三极管8550驱动。超声波发射电路发射电路主要由555定时器,74LS123构成的单稳态触发电路、放大环节,和超声波发射换能器T构成,LM555多谐振荡器端口3输出的145kHz的方波信号一路经触发电路,放大电路后送到超声波换能器两端,可以提高超声波的发射强度。输出端采用加入耦合电容C4,用以提高发射驱动能力。上位电阻R6一方面可以提高三极管的放大输出能力,另一方面可以增加超声波换能器的阻尼效果,缩短其自由振荡时间。压电式超声波换能器是利用压电晶体的谐振来工作的 。超声波换能器内部结构在下文中有介绍,它有两个压电晶片和一个换能板。当它的两极外加脉冲信号,其频率等于压电晶片的固有振荡频率时,压电晶片会发生共振,并带动共振板振动产生超声波,这时它就是一个超声波发生器;反之,如果两电极间未外加电压,当共振板接收到超声波时,将压迫压电晶片作振动,将机械能转换为电信号,这时它就成为超声波接收换能器了。超声波发射换能器与接收换能器在结构上稍有不同,使用时应分清器件上的标志T和R。超声波检测接收电路压电式超声波换能器S将收到的超声信号转换成电信号,并经R7、R8、R9、C5、C6和1/4 LM324组成的选频放大电路放大后,送检波电路Dl、C7、R10进行包络检波,检出涡街信号。涡街信号在电压比较器和RC滤波电路构成的整形滤波环节中与输入的基准电压1/2Vcc作比较,被整形为与风速成正比的矩形波,信号周期随检波信号变化而变化。超声波风速测量仪的软件设计主要由主程序,超声波接收程序及显示,键盘子程序,温度补偿子程序组成。我们知道汇编语言程序则具有较高的效率且容易精细计算程序运行的时间,而超声波风速测量仪的程序要求精细计算(单位时间内的整形完成的超声波矩形方波个数时),所以控制程序采用汇编语言混合编程。超声波测距仪的算法设计 超声波风速传感器是利用穿过空气的超声波被旋涡调制,从已调波中检出旋涡频率来测定风速的。F、S为一对谐振频率相同的超声波换能器,F为发射换能器,发射145 kHz等幅超声波;S为接收换能器,接收被旋涡调制了的声波。当无旋涡时,接收换能器S接收到等幅波信号;有旋涡时,由于旋涡内部的压力梯度和旋涡的旋转运动,导致了超声波的折射、反射和吸收效应,使接收到的信号幅度减小。旋涡通过声束后,接收到的信号又恢复常态。因此,超声波幅度变化频率与旋涡的频率一致,从接收换能器上检测出超声波束幅度变化次数即可测得风速值。基本计算公式为:f旋涡频率,Hz ;v气流速度,ms ;d旋涡发生体直径,mm;St斯特拉哈尔系数(雷诺数在20050 000范围内,St为常数)。超声波旋涡式风速传感器与其它形式的风速传感器相比具有如下优点:(1)无可动部件,无机械磨损,性能稳定,使用寿命长;(2)输出本身就是与风速成线性关系的脉冲频率信号,没有零点漂移,且敏感元件灵敏度变化不会直接影响输出,测量精度高;(3)输出信号不受流体特性(温度、湿度、压力、成份、密度、粘度、矿尘等)影响。此类传感器在煤矿安全监控系统中有着广泛的应用前景。关键词:风速测量;卡曼涡街;单片机AT89C52;温度补偿The Design of Ultrasonic Wind Meter Based on SCMSummary: Wind, especially mine safety has important reference value, as the meteorological environment, the most active factor, the victory of the war, weapons performance to play a decisive effect on the use of wind energy, wind resources also requires that there be lengthyaccurate monitoring.At present, the wind speed measurement apparatus main hot wire, hot-film, and the wind cup of three.This principle of wind speed measured several low precision, range of small, measuring cycle is long, continuous working hours, and the measurement results vulnerable to external environmental factors.Can not meet the efficient, rapid and accurate modern military and long working hours, intelligent data processing, the demand for wind monitoring. This design uses piezoelectric ultrasonic transducer, using AT89S52 MCU as controller to complete the ultrasonic velocity meter hardware and software design.Assembly language programming method used to achieve the measurement results of the calculation and display.Design can be completed, LED digital display clear and stable, reliable measurements, range finder error is less than 0.05m / s. System hardware design The hardware design includes single chip systems and display circuit, keyboard, temperature compensation circuit, ultrasonic transmitter and ultrasonic receiver circuit of three parts.Microcontroller 89S52 or compatible with Series.11.0592MHz crystal with high precision in order to obtain a stable clock frequency, reducing measurement error.System uses the 555 timer 145kHz square wave signal generated using the count of T1 port monitoring ultrasonic receiver circuit to return plastic filtered output signal.Display circuit using a simple and practical four common cathode LED digital tubes, with 74HC244 driver code segment, bit code with the PNP transistor 8550 drives. Ultrasonic transmitter Transmitter mainly by the 555 timer, 74LS123 monostable trigger circuit formed, enlarged links, and ultrasonic emission transducer T form, LM555 Multivibrator Port 3 output 145kHz square wave signal all the way through trigger circuit, amplifier circuitultrasonic transducer is sent to both ends, can increase the emission intensity ultrasound.By adding the output coupling capacitor C4, launching drives to increase capacity.Upper resistor R6 on the one hand can increase the output capacity of the amplification transistor, on the other hand can increase the ultrasonic transducer damping effect, shorten the time of its free oscillations.Piezoelectric ultrasonic transducers is the use of piezoelectric crystal resonance to the work.The internal structure of ultrasonic transducers are introduced below, it has two chips, and a piezoelectric transducer plate.When it's poles plus pulse signal, the frequency is equal to the natural oscillation frequency of the piezoelectric chip, the piezoelectric resonance occurs, and promote the vibration of ultrasonic resonance board, then it is an ultrasonic generator; the other hand, if the two electrodesno applied voltage, when the board receives the ultrasonic resonance, it will be pressure for piezoelectric vibration, the mechanical energy is converted to electrical signals, then it becomes an ultrasonic receiver transducer.Ultrasonic emission transducer and receiver transducer is slightly different in structure, use the device on the signs should be to distinguish between T and R. Ultrasonic detection receiving circuit Piezoelectric ultrasonic transducer S will receive the ultrasonic signals into electrical signals, and by R7, R8, R9, C5, C6, and 1 / 4 LM324 amplifier circuit composed of frequency selective amplification, the submission wave circuits Dl, C7, R10 Enveloping, vortex signal detection.Vortex signal in the hysteresis voltage comparator and RC rate than plastic filter circuit composed of the input links of the reference voltage 1/2Vcc comparison with the wind speed is proportional to the plastic rectangular wave signal period varies with the detection signal. Ultrasonic wind speed measuring instrument software design mainly by the main program, ultrasonic receiving procedures and display, keyboard subroutine, temperature compensation subprogram.We know the assembly language program is a high efficient and easy to run precise calculation of the time, and ultrasonic velocity measurement instrument procedures require precise calculations (per unit time to complete the ultrasonic plastic rectangle when the number of square wave), the control programMixed programming using assembly language. Ultrasonic Range Finder Algorithm Ultrasonic wind sensor is the use of ultrasound through the air by the vortex modulation, has been transferred from the vortex frequency waves were detected to determine wind speed.F, S is a pair of the same resonant frequency ultrasonic transducer, F for the launching transducer, emission 145 kHz ultrasonic amplitude; S transducer for the receiver to receive sound waves modulated by the vortex.When no vortex, the receiving transducer receives the amplitude S wave signal; a vortex, because of the pressure gradient within the vortex and the vortex rotation, leading to ultrasonic refraction, reflection and absorption effects, so that the received signal amplitudereduced.Vortex through the beam, the received signal is back to normal.Therefore, the ultrasonic frequency and amplitude changes in the frequency of vortex line, from the receiving transducer to detect changes in frequency ultrasonic beam amplitude can be measured wind speed values.Basic formula is:f = St * v / d f - vortex frequency, Hz; v - flow velocity, m / s; d - bluff body diameter, mm; St - coefficient (Reynolds number in the range of 200 to 50 000, St is a constant). Ultrasonic vortex wind speed sensor and compared to other forms of wind speed sensor has the following advantages:(1) no moving parts, no mechanical wear, stable performance, long life;(2) The output itself is a linear relationship between wind velocity and pulse frequency signals, no zero drift, and the sensor sensitivity change would not directly affect output, high accuracy;(3) The output signal from fluid properties (temperature, humidity, pressure, composition, density, viscosity, mineral dust, etc.) affected.Such sensors in coal mine safety monitoring system has wide application prospects.Key words: wind speed measurement; Karman vortex street; SCM AT89C52; temperature compensation目录综述.ISummary.IV第一章 绪论.1 1.1课题的背景和意义及任务.1 1.1.1 课题的背景意义.1 1.1.2 课题的任务.1 1.2 国内外超声波风速仪的现状.1 1.2.1 国外风速仪的现状.1 1.2.2 国内测距仪的现状.2 1.3 超声波风速仪的研究内容.3第二章 超声波风速仪测量原理及其总体设计.4 2.1 超声波风速仪原理.4 2.1.1 风速测量原理.4 2.1.2 超声波风速测量的理论分析.5 2.2 超声波传感器工作原理.6 2.2.1 超声波传感器基本结构及工作原理.6 2.2.2 超声波传感器的基本特性.7 2.3 超声波测距的总体设计.9 2.3.1总体设计思想.9 2.3.2工作过程.10第三章 系统结构及其硬件设计.11 3.1 单片机系统及复位电路设计.11 3.1.1 单片机AT89S52的结构.11 3.1.2 单片机系统及复位电路设计.16 3.2 报警电路.17 3.3 显示电路设计.18 3.4 超声波发射电路设计.18 3.4.1 LM555定时器.19 3.4.2 74LS123单稳态触发电路.20 3.4.3 三极管放大电路.22 3.4.4 超声波发射换能器.22 3.5 超声波检测接收电路设计.23 3.5.1 多反馈型滤波器.24 3.5.2 包络检波,OPA积分器,RC高通滤波.25 3.5.3 电压比较器的施密特接法.28 3.6 键盘.30第四章 软件设计.32 4.1 主程序.32 4.2 超声波接收子程序.34 4.3 显示子程序.36 4.4 键盘子程序.37 4.5 计算子程序.39第五章 抗干扰处理.41 5.1 硬件抗干扰处理.41 5.2 软件抗干扰处理.43总结.44参考文献.45致谢.46附录A.47附录B.52第一章 绪论1.1课题的背景和意义及任务1.1.1 课题的背景意义 计量是工业生产的眼睛。流量计量是计量科学技术的重要组成部分,它与国民经济、国防建设、学研究有着密切的关系。工业生产过程是流量测量与仪表应用的一大领域,流量与温度、压力和物位一起统称为过程控制中的四大参数,人们通过这些参数对生产过程进行监视与控制。对流体流量进行正确测量和调节是保证生产过程安全经济运行、提高产品质量、降低物质消耗、提高经济效益、实现科学管理的基础。 利用超声波风速流量计来测量生产过程中的重要参数-风速,特别是使井下通风量得到保证,保证安全生产。此外在环境保护领域,流量测量仪表也扮演着重要角色。人们为了控制大气污染,必须对污染大气的烟气以及其他温室气体排放量进行监测。 本设计提供基于卡曼涡街原理的超声波风速测量装置,该装置利用了发射接收一体化的超声波传感器和单片机微处理器。超声波传感器在流动空气介质中收,发超声波,检测频率发生变化的矩形方波,通过计算式来求得风速。1.1.2 课题的任务设计一个超声波风速测量仪,要求测量范围在0.10m/s100m/s,测量精确度0.05m/s,能够清晰稳定地显示测量结果。1.2 国内外超声波风速测量仪的现状1.2.1 国外