数字身高体重测量仪设计方案

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

数字身高体重测量仪设计
方案
1.1 选题背景及目的
随着社会的发展,人们生活水平不断提升,与身体状况相关的方面越来越得到人们的关注。

而身高与体重的变化则是身体状况最为直接的表现,因此身高体重便成为必要的测量内容。

身高体重测量仪现以不止用于医疗、体检部门,而是可以广泛应用于大众的仪器,因此身高体重测量仪的研究和设计有非常广阔的前景。

本设计的身高体重一体化测量仪可以同时测量身高和体重数据,并实时的在屏幕上显示,大大提高了使用效率。

本设计的仪器系统功耗低,运行情况良好而可靠,能利用最少的资源进行高精度的测量,信息性能可靠,操作便利,可以方便的获取结果,在实际的使用中获得了理想的效果,有重要的研究意义。

身高的测量使用非接触式的超声波来完成。

超声波指向性强,能量消耗缓慢,在介质中传播的距离较远,因此超声波经常用于障碍物的距离测量。

由于超声波可做到无接触检测距离,这一特性用在人体或其它物体高度的测量上会变得非常方便。

而且超声波传感器具有结构简单、体积小、信号处理可靠等特点。

因此本设计也是利用超声波来测量高度。

体重的测量采用应变式压力传感器做成电子称来测量重量。

和传统秤相比较,电子秤利用新型传感器、高精度AD转换器件、单片机设计实现,具有精度高、功能强等特点,因此电子称逐渐取代传统型的机械杠杆测量秤,成为测量领域的主流产品[1]。

本课题设计的电子
秤具有基本称重、显示功能。

该电子秤的测量范围为0-200Kg,测量精度达到1kg,有高精度,低成本,易携带的特点。

1.2 总体方案设计与论证
1.2.1 设计任务
(1)题目:数字身高体重测量仪
(2)测量要求:
超声波测高精度±1cm,测量范围2cm-4m
称重精度1kg,测量范围1kg-200kg
要求测量准确,能同时在显示屏上显示出来。

1.2.2 设计内容
外围设备:(1)51单片机最小系统开发板
(2)STC89C52主芯片
(3)超声波测距模块
(4)压力传感器称重模块
(5)AD转换模块
(6)1602液晶显示模块
1.2.3 方案论证与选择
方案一:采用FPGA控制,超声波测距,电容式传感器称重,数码管显示数值。

方案二:采用51单片机控制,超声波测距,应变式传感器称重,1602液晶显示数值。

以上两个方案主要是控制芯片,称重传感器和显示设备的选择问
题。

现就各个选择做以下论证。

FPGA功能强大,端口多,适于多从控制,但数据处理较复杂,且价格昂贵;51单片机设计简单,易于控制,价格便宜,且能完成要求的所有工作,因此选择51单片机控制。

电容式传感器耗电量少,造价低,但准确度只有1/200~1/500;电阻应变式传感器的称量范围为300g至数千kg,计量准确度达1/1000~1/10000,结构较简单,可靠性较好,因此选择电阻应变式传感器,且采用全桥式等臂电桥电路。

采用数码管现实的话,需要两组数码管分别显示身高和体重数值,消耗功率大,且占用较多的I/O口资源;采用1602液晶显示,可以分两行同时清晰直观地显示身高体重结果及必要的信息,因此选择1602液晶显示作为显示屏。

综上所述,选择方案二更为合理、经济。

2 硬件电路设计
2.1 主控电路
我们主控制电路采用STC89C52芯片,STC89C52RC单片机是宏晶科技推出的新一代高速/低功耗/超强抗干扰的单片机,指令代码完全兼容传统8051单片机,12时钟/机器周期和6时钟/机器周期可以任意选择[2]。

主要特性如下[3]:
1.工作电压:5.5V~3.3V(5V单片机)/3.8V~
2.0V(3V单片机)
2.增强型8051单片机,6时钟/机器周期和12时钟/机器周期可以任意选择,指令代码完全兼容传统8051.
3.工作频率范围:0~40MHz,相当于普通8051的0~80MHz,实际工作频率可达48MHz
4.片上集成512字节RAM
5.用户应用程序空间为8K字节
6.具有EEPROM功能
7. ISP(在系统可编程)/IAP(在应用可编程),无需专用编程器,无需专用仿真器,可通过串口(RxD/P3.0,TxD/P3.1)直接下载用户程序,数秒即可完成一片
8.通用I/O口(32个),复位后为:P1/P2/P3/P4是准双向口/弱上拉,P0口是漏极开路输出,作为总线扩展用时,不用加上拉电阻,作为I/O口用时,需加上拉电阻。

9.共3个16位定时器/计数器。

即定时器T0、T1、T2
10.外部中断4路,下降沿中断或低电平触发电路,Power Down模式可由外部中断低电平触发中断方式唤醒
11.具有看门狗功能
12.工作温度范围:-40~+85℃(工业级)/0~75℃(商业级)
13.通用异步串行口(UART),还可用定时器软件实现多个UART
14. PDIP封装
其管脚定义如图2.1所示。

图2.1 STC89C52 管脚图
2.2 超声波测高模块电路
2.2.1 超声波传感器及其测高原理
超声波是通过不断检测超声波发射后遇到障碍物所反射的回波,从而测出发射和接收回波的时间差t,然后求出距离S=Ct/2,式中的C为超声波波速。

利用超声波测高前先用超声波测出发射头与地面的高度H1并存入单片机,然后将被测物体移入测量区内测得上表面距离H2,用单片机算出两者之差就是被测物体的实际高度。

超声波测高系统原理如图2.2所示。

图2.2 超声波测高原理图
我们使用的是模块化的超声波HC-SR04测距,HC-SR04超声波测距模块可提供2cm-400cm的非接触式距离感测功能,测距精度可达高到3mm;模块包括超声波发射器、接收器与控制电路[4]。

其基本工作
原理如下:
(1)采用IO口TRIG触发测距,给至少10us的高电平信号;
(2)模块自动发送8个40khz的方波,自动检测是否有信号返回;
(3)有信号返回,通过IO口ECHO输出一个高电平,高电平持续的时间就是超声波从发射到返回的时间。

测试距离=(高电平时间*声速(340M/S))/2;
2.2.2 超声波传感器电气参数及其时序图
超声波测距模块电气参数如下表2.1所示:
表2.1 电气参数
超声波时序图如图2.3所示:
图2.3 超声波时序图
以上时序图表明我们只需要提供一个10uS以上的脉冲触发信号,该模块内部将发出8个40KHZ周期电平并检测回波。

一旦检测到有回波则输出回响信号。

回响信号的脉冲宽度与所测得距离成正比。

由此通过发射信号到收到的回响信号时间间隔可以计算得到距离。

在本设计中单片机的P3.3脚提供一个16us的高电平给TRIG口,通过模块自动测距接受ECHO的回响高电平信号给P3.2脚,因此用ECHO 高电平持续时间t/58就是超声波测得的距离S(cm)。

HC-SR04模块实物图如图2.4所示:
图2.4 HC-SR04模块
2.3 压力传感器称重模块
2.3.1 压力传感器
称重传感器采用200kg的应变
式压力称重传感器YZC-1B,其内部
为4个应变片构成的电桥形式。


测量原理如图2.5所示。

当垂直正
压力P作用于梁上时,梁产生形变,图2.5 传感器受力工作原理
电阻应变片R1、R2受压弯拉伸,阻值增加;R3、R4受压缩,阻值减小。

电桥失去平衡,产生不平衡电压,不平衡电压与作用在传感器上的载菏P成正比,从而将非电量转化成电量输出[5]。

R1、R2、R3和R4组成惠更斯电桥,将2对电阻应变片的阻值变化转变成输出电压,其工作原理如图2.6所示。

图2.6 测量电桥原理
传感器实物图如下图所示:
图2.7 称重传感器
2.3.2 称重AD转换芯片
HX711是一款专为高精度称重传感器而设计的24位A/D转换器芯片。

与同类型其它芯片相比,该芯片集成了包括稳压电源、片内时钟振荡器等其它同类型芯片所需要的外围电路,具有集成度高、响应速度快、抗干扰性强等优点、降低了电子秤的整机成本,提高了整机的性能和可靠性。

该芯片与后端MCU芯片的接口和编程非常简单,所有控制信号由管脚驱动,无需对芯片内部的寄存器编程。

输入选择开关可任意选取通道A或通道B,与其内部的低噪声可编程放大器相连。

通道A的可编程增益为128或64,对应的满额度差分输入信号幅值分别为±20mV或±40mV。

通道B则为固定的64增益,用于系统参数检测[6]。

芯片内提供的稳压电源可以直接向外部传感器和芯片内的A/D转换器提供电源,系统板上无需另外的模拟电源。

芯片内的时钟振荡器不需要任何外接部件。

上电自动复位功能简化了开机的初始化
过程。

图2.8为HX711芯片应用于体重测量的一个参考电路图。

该方
案使用内部时钟振荡器(XI=0),10Hz的输出数据速率(RATE=0)。

电源(2.7~5.5V)直接取用与MCU 芯片相同的供电电源。

通道A与传感器相连,通道B通过片外分压电阻与电池相连,用于检测电池电压。

图2.8 HX711外部管脚图
HX711主要电气参数如表2.2所示。

表2.1 HX711电气参数表
参数条件及说明最小值典型值最大值单位满额度差分输入范围V(inp)-V(inn) ±0.5(AVDD/GAIN)V 输入共模电压范围AGND+0.6 AVDD-0.6 V
输出数据速率使用片内振荡器,RATE=0 10
Hz 使用片内振荡器,RATE=DVDD 80
外部时钟或晶振,RATE=0 fclk/1,105,920
外部时钟或晶振,RATE=DVDD fclk/138,240
输出数据编码二进制补码800000 7FFFFF(HEX)
输出稳定时间(1)RATE=0 400 mv
RATE=DVDD 50
输入零点漂移增益=128 0.2
增益=64 0.8
输入噪声增益=128,RATE=0 50 nV(rms
)
增益=128,RATE= DVDD 90
温度系数输入零点漂移(增益=128)±7 nV/℃
增益漂移(增益=128)±3 ppm/℃输入共模信号抑制比增益=128,RATE=0 100 dB
电源干扰抑制比增益=128,RATE=0 100 dB 输出参考电压(VBG) 1.25 V 外部时钟或晶振频率 1 11.0592 30 MHz 电源电压DVDD 2.6 5.5 V
AVDD,VSUP 2.6 5.5
模拟电源电路(含稳压电路)正常工作1600 uA 断电0.3
数字电源电路正常工作100 uA
断电0.2
2.3.3 称重部分AD转换基本原理
如图2.9所示HX711内部方框图,HX711可以在产生VAVDD和AGND
电压,即711模块上的E+和E-电压。

该电压通过VAVDD=VBG(R1+R2)/R2
计算。

VBG为模块儿基准电压 1.25vR1=20K,R2=8.2K,因此得出VAVDD=4.3V。

在4.3V的供电电压下200Kg的传感器最大输出电压是4.3*2mV/V=8.6mV,经过128倍放大后,最大电压为8.6mV*128=1100.8mV。

经过AD转换后输出的24bit数字值最大为:1100.8mV*2^24/4.3V≈2147483。

假设重力为AKg,(A<200Kg),测量出来的AD值为y.200Kg传感器输出,发送给AD模块的电压为AKg*8.6mV/200Kg=0.043AmV,经过128倍增益后为128*0.043A=5.504A mV,转换为24bit数信号为5.504A mV*2^24/4.3V ≈21474.83A,所以y=21474.83A/100≈214.75A,得出A=y/214.75Kg。

所以程序中AD转换公式为:
Weight=(unsigned int)(float)Weight/215
图2.9 HX711内部方框图
现附录HX711接口电路图如下[7]:
图2.10 HX711接口电路图
2.3.4 称重传感器重量标定
为了检验称重传感器测量值与实际重量之间的误差,我对称重传感器进行了重量的标定。

用不同重量的砝码置于称重传感器上,观察测量出来的数据并进行记录,制成图2.11的曲线图,以及表2.3所示实际重量与测量显示值得对比表格。

20406080100120140
图2.11 重量标定曲线图
表2.3 对比表
由标定的曲线图可以看出,YZC-1B 称重传感器在3kg 以内称重值不稳定,在3kg-150kg 内测量出的称重值与实际值基本上相同。

因为人体正常体重都是位于这一段内,所以称重传感器能基本满足适用要求。

2.4 LCD1602液晶显示模块 2.4.1 LCD1602介绍
1602液晶也叫1602字符型液晶,它是一种专门用来显示字母、数字、符号等点阵型液晶模块它有若干个5*7或者5*11等点阵字符位组成,每个点阵字符位都可以显示一个字符。

每位之间有一个
点距的间隔,每行之间也有间隔起到了字符间距和行间距的作用。

1602LCD是指显示的内容为16X2,即可以显示两行,每行16个字符液晶模块(显示字符和数字)。

目前市面上字符液晶绝大多数是基于HD44780液晶芯片的,控制原理是完全相同的,因此基于HD44780写的控制程序可以很方便地应用于市面上大部分的字符型液晶[10]。

图2.12 1602显示电路
2.4.2 LCD1602主要技术参数及其时序图
显示容量:16×2个字符
芯片工作电压:4.5—5.5V
工作电流:2.0mA(5.0V)
模块最佳工作电压:5.0V
字符尺寸:2.95×4.35(W×H)mm
其引脚功能见表2.4所示:
表2.4 1602引脚接口说明表
第6脚:E端为使能端,当E端由高电平跳变成低电平时,液晶模块执行命令,在单片机中连接P2.5脚。

第7~14脚:D0~D7为8位双向数据线,在单片机中连接P0口。

第15脚:背光源正极。

第16脚:背光源负极。

1602读写操作时序如图2.13和2.14所示[8]:
图2.13 读操作时序
图2.14 写操作时序
3 系统软件设计
3.1 单片机初始化程序设计
本设计的软件编译环境为Keil uVision4,这种编译环境支持C 语言编程。

编译的模块包括单片机初始化模块,超声波测高模块,测
体重模块,液晶显示模块。

初始化函数模块主要包括定时器及中断的初始化,加上液晶显示的初始化程序。

定时器使用单片机内部定时器0,设置定时器0为方式1,初值低8位TL0=0x00,高8位TH0=0x00,启动定时器0和开启定时器0中断。

液晶显示初始化使用标准初始化过程,其初始化过程如下所示:
延时15mS,写指令38H(不检测忙信号),延时5mS,写指令38H(不检测忙信号),延时5mS,写指令38H(不检测忙信号),(以后每次写指令、读/写数据操作均需要检测忙信号),写指令38H:显示模式设置,写指令08H:显示关闭,写指令01H:显示清屏,写指令06H:显示光标移动设置,写指令0CH:显示开及光标设置。

3.2 超声波测高模块程序设计
超声波测高部分先初始化定时器和中断,外设置一个中断溢出标志flag,根据flag标志位和回响信号ECHO的状态来开启或关闭定时器中断并计数,由此算出距离值。

超声波测高部分程序流程图如图3.1所示。

图3.1 超声波测高部分程序流程图
3.3 测体重程序设计
压力传感器称体重模块核心部分是AD转换,在AD转换编程中,当数据输出管脚ADDO为高电平时,表明AD转换器还未准备好输出数据,此时串口时钟输入信号ADSK应为低电平。

当ADDO从高电平变低电平后,ADSK输入24个时钟脉冲。

第一个时钟脉冲的上升沿将读出输入24位数据的最高位,直到第24个时钟脉冲完成,24位输出数据从最高位至最低位逐位输出完成。

测体重部分程序流程图如图3.2所示。

图3.2 测体重部分程序流程图
3.4 液晶显示模块程序设计
液晶显示部分是整个实验可以读取结果的必要部分,因此也是整个程序的中心部分。

我们使用的LCD1602液晶显示部分程序流程图包括下图3.3所示部分。

图3.3 液晶显示模块程序流程图
结论
本次设计基本上达到了设计要求,使用非接触式的超声波测量距离,通过压力传感器称重输出电压经过AD转换可以实现人体重量的测量,使用1602液晶可以完整显示身高体重测量值。

在后期完善中,把超声波传感器定位于2.5m高度,就可以测量出人体高度;称重传感器经过重量标定,就可以比较准确的称出重量。

不过本设计依然存在不足之处,比如说超声波测距太灵敏,人体只要稍微动一下就会引起测量高度的微小变化,无法得出稳定数值;称重部分称重精度要求达到0.5kg,实际上为了称出来的数据精准,精度只有1kg。

如果需要精度和准确度都达到要求,选择的硬件已经可以满足要求,只需要在程序部分再设计一下。

希望在今后的学习中进一步完善,使系统功能更加可靠。

参考文献
[1] 何力民. 单片机高级教程[M]. 北京:北京航空大学出版社,2008:18-19.
[2] 张文灼,MCS-51单片机程序设计[M]. 北京:机械工业出版社,2006:76-77.
[3] 李林功,吴飞青,王兵等.单片机原理与应用[M].北京:机械工业出版社,2007:12.
[4] 赵广涛,基于超声波传感器的测距系统设计[D]. 微计算机信息,2006.
[5] 陈杰,黄鸿. 传感器检测与技术[M]. 北京:高等教育出版社,2002:108.
[6] 浦方华,田作华. 一种基于HX711的高精度电子称重仪[A]. 上海交通大学,电子信息与电气工程学院. 上海,2002:40.
[7] 赵承利. Protel DXP电路设计(基础、案例篇)[M]. 北京:中国铁道出版社,2009:100.
[8] Yam RCM,Tse PW,Li L,Tu P.Intelligent predictive decision support system for condition-based maintenance[J].International Journal of Advanced Manufacturing Technology,2001,17(5).
附录附录A 设计实物图
附录B 设计总程序
#include<reg52.h> //包含头文件,一般情况不需要改动,头文件包含特殊功能寄存器的定义
#include<intrins.h>
#include<stdlib.h>
#include<stdio.h>
#define uchar unsigned char
#define uint unsigned int
#define ulong unsigned long
sbit RS = P2^3; //控制端口sbit RW = P2^4;
sbit EN = P2^5;
sbit TRIG=P3^3;
sbit ECHO=P3^2;
sbit ADDO = P3^5;
sbit ADSK = P3^4;
#define DataPort P0 //数据端口
#define RS_CLR RS=0
#define RS_SET RS=1
#define RW_CLR RW=0
#define RW_SET RW=1
#define EN_CLR EN=0
#define EN_SET EN=1
bit flag; unsigned int Timeout;
unsigned char frq;
//函数定义声明
void show_temp();
void delay()
{
unsigned int i;
for(i=0;i<10;i++);
}
/*------------------------------------------------
uS延时函数,含有输入参数unsigned char t,无返回值
unsigned char 是定义无符号字符变量,其值的范围是
0~255 这里使用晶振12M,精确延时请使用汇编,大致延时
长度如下 T=tx2+5 uS
------------------------------------------------*/
void DelayUs2x(unsigned char t) {
while(--t);
}
/*------------------------------------------------
mS延时函数,含有输入参数unsigned char t,无返回值
unsigned char 是定义无符号字符变量,其值的范围是
0~255 这里使用晶振12M,精确延时请使用汇编
------------------------------------------------*/
void DelayMs(unsigned char t) {
while(t--)
{
//大致延时1mS
DelayUs2x(245);
DelayUs2x(245);
}
}
/*------------------------------------------------
判忙函数
------------------------------------------------*/
bit LCD_Check_Busy(void)
{
DataPort= 0xFF;
RS_CLR;
RW_SET;
EN_CLR;
_nop_();
EN_SET;
return (bit)(DataPort & 0x80); }
/*------------------------------------------------
写入命令函数
------------------------------------------------*/
void LCD_Write_Com(unsigned char com)
{
while(LCD_Check_Busy()); //忙则等待
RS_CLR;
RW_CLR;
EN_SET;
DataPort= com;
_nop_();
EN_CLR;
}
/*------------------------------------------------
写入数据函数
------------------------------------------------*/
void LCD_Write_Data(unsigned char Data)
{
while(LCD_Check_Busy()); //忙则等待
RS_SET;
RW_CLR;
EN_SET;
DataPort= Data;
_nop_();
EN_CLR;
}
/*------------------------------------------------
清屏函数
------------------------------------------------*/
void LCD_Clear(void)
{
LCD_Write_Com(0x01);
DelayMs(5);
}
/*------------------------------------------------
写入字符串函数 ------------------------------------------------*/
void LCD_Write_String(unsigned char x,unsigned char y,unsigned char *s)
{
if (y == 0)
{
LCD_Write_Com(0x80 + x); //表示第一行
} else { LCD_Write_Com(0xC0 + x); //表示第二行 } while (*s) { LCD_Write_Data( *s); s ++; } } /*------------------------------------------------ 写入字符函数 ------------------------------------------------*/ void LCD_Write_Char(unsigned char x,unsigned char y,unsigned char Data) { if (y == 0) { LCD_Write_Com(0x80 + x); } else { LCD_Write_Com(0xC0 + x); } LCD_Write_Data( Data); }
/*------------------------------------------------
初始化函数
------------------------------------------------*/
void LCD_Init(void)
{
LCD_Write_Com(0x38); /*显示模式设置*/
DelayMs(15);
LCD_Write_Com(0x38);
DelayMs(5);
LCD_Write_Com(0x38);
DelayMs(5);
LCD_Write_Com(0x38);
LCD_Write_Com(0x08); /*显示关闭*/
LCD_Write_Com(0x01); /*显示清屏*/
LCD_Write_Com(0x06); /*显示光标移动设置*/
DelayMs(5);
LCD_Write_Com(0x0C); /*显示开及光标设置*/
}
void Timer0(void) interrupt 1 {
flag=1;
} /******************************* HIGHT
******************************** /
void HIGHT(void)
{
long S;
unsigned int i;
TRIG=1;
i=2;
while(i>0)
i--;
TRIG=0;
TR0=0;
TL0=0;
TH0=0;
Timeout=0;
while((ECHO==0)&&((Timeout++) <50000));
flag=0;
TR0=1;
Timeout=0;
while((ECHO==1)&&((Timeout++) <50000));
TR0=0;
S=((TH0*256+TL0)*1)/58;
if(flag==1||S>400)
{
LCD_Write_Char(0,0,'H');
/* LCD_Write_Char(1,0,'i');
LCD_Write_Char(2,0,'g');
LCD_Write_Char(3,0,'h');*/
LCD_Write_Char(1,0,':');
LCD_Write_Char(2,0,'-');
//在第1行的第1列显示百位
LCD_Write_Char(3,0,'-'); //在
第1行的第2列显示十位
LCD_Write_Char(4,0,'-'); //在第1行的第3列显示个位
LCD_Write_Char(5,0,'c'); //在
第1行的第2列显示十位
LCD_Write_Char(6,0,'m');
}
else
{
//**给1602显示寄存器赋值(0-255)**
//***1602液晶显示0-255***
LCD_Write_Char(0,0,'H');
/* LCD_Write_Char(1,0,'i');
LCD_Write_Char(2,0,'g');
LCD_Write_Char(3,0,'h');*/
LCD_Write_Char(1,0,':');
LCD_Write_Char(2,0,S/100+'0'); //在第1行的第1列显示百位LCD_Write_Char(3,0,(S%100)/10+'0
'); //在第1行的第2列显示十位
LCD_Write_Char(4,0,S%10+'0'); //在第1行的第3列显示个位
LCD_Write_Char(5,0,'c');
LCD_Write_Char(6,0,'m');
}
i=9000;
while(i>0) i--;
}
/*******************************
******
WEIGHT
********************************
******/
unsigned long get_ADValue(void)
{
uchar i;
unsigned long value=0;
ADDO=1;//51 CPU I/O input enable
ADSK=0;//enable AD
while (ADDO);
_nop_();//delay T1>0.1us
for (i=0;i<24;i++)
{
ADSK=1;
_nop_();//delay T3>0.2us
if (ADDO)
value++;
value=value<<1;
ADSK=0;
_nop_();//delay T4>0.2us }
ADSK=1;
_nop_();//delay T3>0.2us
ADSK=0;
_nop_();//delay T4>0.2us
value=value&0x007FFFFF;
return (value);
}
/*------------------------------------------------
主函数
------------------------------------------------*/
void main(void)
{
unsigned long num;
float num_f;
LCD_Init();
LCD_Clear();//清屏
TMOD&=0xF0; //将TMOD的低4位定时器0控制部分清零 TMOD|=0x01; //设置定时器0为方式1
TL0=0x47; //设置定时器0初值低8位
TH0=0xFF; //设置定时器0初值高8位
TR0=0; //启
动定时器0
ET0=1;
//Timer0中断
EA=1;
while (1)
{
HIGHT();
num=get_ADValue();
num_f=num/100;
num=(num_f/380);
if(num>200)
{num=0;
LCD_Write_Char(0,1,'w');
LCD_Write_Char(1,1,'e');
LCD_Write_Char(2,1,'i');
LCD_Write_Char(3,1,'g');
LCD_Write_Char(4,1,'h');
LCD_Write_Char(5,1,'t'); LCD_Write_Char(6,1,':');
LCD_Write_Char(7,1,'0');
LCD_Write_Char(8,1,'0');
LCD_Write_Char(9,1,'0');
LCD_Write_Char(10,1,'k');
LCD_Write_Char(11,1,'g');
}
else
{LCD_Write_Char(0,1,'w');
LCD_Write_Char(1,1,'e');
LCD_Write_Char(2,1,'i'); LCD_Write_Char(3,1,'g'); LCD_Write_Char(4,1,'h');
LCD_Write_Char(5,1,'t'); LCD_Write_Char(6,1,':');
LCD_Write_Char(7,1,num/100+'0');
LCD_Write_Char(8,1,(num%100)/
10+'0');
LCD_Write_Char(9,1,num%10+'0');
LCD_Write_Char(10,1,'k'); LCD_Write_Char(11,1,'g');
}
DelayMs(1000); } }
附录C 英文文献翻译
Process Monitoring of Fluid Systems Based
on Ultrasonic Sensors
P. Hauptmann
Technical University "Otto von Guericke" Magdeburg, Sektion A utomatisierungstechnik undElektrotechnik, 3010 Magdeburg,
GDR
Abstract
The possibilities of the application of ultrasonic sensors
for the process monitoring in fluids are described. As an example results of measure- ments during polymerisation processes are shown. The ultrasonic velocity v is the measuring parameter. A pulse travelling method is used. The fundamentals of uhrasound, necessary for the design of ultrasonic devices and the interpretation of the results, are summarised. A smart ultrasonic system .for process monitoring on the basis of velocity and attenuation measurements is explained. The limitations of the ultra-
sonic principle for industrial applications are shown.
1. INTRODUCTION
Various applications for ultrasonics in science, technology, medicine, and other fields have been known for a long time. The fact that considerable advances have been made in the last 10 years in the use of ultrasound, demonstrates its capabilities and usefulness. On the other hand, appropriate studies into the use of ultrasonics for monitoring industrial processes are scarcely known. Papadakis first summarised the most important results in this field in 1976. Although ultrasonic measuring methods were used in several areas of industrial endeavour at that time, they were restricted to characterising piezoelectric and magneto- strictive materials for use as ultrasonic generators and sensors, the investigation of ultrasonic delay lines produced by the electronics industry
and for nondestructive testing/evaluation/ inspection. New possibilities for the application of ultrasonic methods for industrial purposes came about with the development of microcomputers. As well as new sensors based on semiconductor materials or fibre optics the so-called classical transducers were regenerated to renaissance as sensors. Ultrasonic sensors are included in the latter category and can work as condition sensors or position-monitoring sensors.
In the following a novel principle of ultrasonic sensor application for process monitoring in liquid homogenous or heterogeneous systems is presented. As an example, results taken during polymerisation processes are shown. The technique applied is illustrated and its limitations are shown. It can be expected that many other applications of the same technique are possible. In connection with other sensors more detailed information about the process investigated will be given along with how process control can be achieved.
2. FUNDAMENTALS
The complete study of elastic travelling waves can be subsumed under two questions: 1. How
fast do they travel?, 2. How fast do they decay? The engineer wants to know how to use these properties. Therefore he has to study the ultrasonic velocity and attenuation rates for different materials.
Ultrasonic velocity and attenuation are defined by the equation:
p = p(x, t) = p0*e^j(wt-kx) (1) for an ultrasonic wave propagation in the x-direction with a complex wave number kx and an angular frequency o9 = 2nf t is the time and p is the sonic alternating amplitude. The complex wave number kx can be written in the form:
k x = (w/v - m) (2) where v the phase velocity of the sonic wave and a~the attenuation coefficient. These are the measurable quantities and their values are dependent on the material being used and its structure. Measurements of v and &can provide interesting information about processes or the properties of particular materials. The phase velocity v yields the appropriate elastic modulus M of the mode being propagated. The relationship is:
v = (M/a) 1/2 (3)
a is the unperturbed density. For fluids the modulus M is the bulk modulus Kand the waves are longitudinal. For solids, M is an appropriate combination of the elastic moduli of the solid itself. The combination depends on the mode of propagation, and the mode in turn depends on the interaction (or lack of interaction) of the wave with the boundaries of the solid. In isotropic solids as well as a longitudinal wave with:
(4)
a transverse wave also appears with a propagating velocity
(5)
where G is the shear modulus.
The moduli of materials are influenced by many physical phenomena, which may, in turn, be studied by measuring the ultrasonic wave velocities.
The attenuation coefficient yields information about absorption and diffusion processes occuring in the specimen. It depends in a relatively complex manner on the material properties of the transmitting medium.
For a simple, homegenous liquid the following equation applies:
(6)
where 1/s is the she~ir viscosity, k is the thermal conductivity and ;( is the ratio of the specific heats at i.e. at constant volume and constant pressure. Relax appears in the case of relaxation processes and this contribution can be much higher than the viscous part (determined by r/s) and the thermal part (determined by k). If relaxational effects are absent it is obvious that the attenuation increases with the square of the frequency. This behaviour is very important for many technological applications and has to be taken into consideration in industrial equip- ment. Because in liquids the ratio X is nearly 1 the second term in equation plays an unimportant role.
Very often heterogeneous systems occur in technical
processes. They are complicated multiphase or multicomponent systems and can appear in the form of suspensions or emulsions and sometimes contain partially dissolved gases. The sonic parameters depend, in a complex way, on the material parameters of the different phases or components. When there are diffusion centres in the system (i.e~ such as solid spheres or gas bubbles) then the following equation can be used to determine the attenuation.
(7)
R is the radius of the solid spheres or gas bubbles. A very high attenuation may occur at higher frequencies (for particles in the Ixm-range this happens at frequencies higher than 10MHz). Under such conditions measurement under industrial conditions can be impossible.
In gases, the thermal effects (second term in equation (6)) are not negligible and a very high attenuation appears in the ultrasonic frequency range. This can be very troublesome for measurements in heterogeneous systems.
In solids, except for many polymers, the attenuation is in general relatively small. But, if there are diffusing centres or boundary surfaces, a considerable attenuation which depends on frequency in a complete way can occur.
The previously described behaviour of the different phases can enable conclusions to be made about the most useful frequency range for the technological applications of
ultrasound. For solids and liquids this range is from 500kHz to 5MHz, for gases it is from I kHz to 100kHz.
The acoustic impedance, defined as av, plays a dominant role in the description of sound propagation in different materials and the sound behaviour at the specimen/bond/ transducer interface. In the case of a perpendicular incident of a sound wave at the boundary of two materials with Z~ = ~r I v t and Z2 = a2v2 the following equations can be used to calculate the intensity reflexion coefficient R and the intensity transmission coefficient T
A knowledge of this behaviour is necessary for all methods when working in the echo mode.
Travelling waves are generally introduced into the specimen by piezoelectric transducers which effectively are the sensor elements. At this time ferroelectric ceramics are most common but sometimes, for special applications the classical material quartz is used. In new development polymer foils from PVDF or PVF 2 plan an interesting role and appropriate sensor construction can be realised with these polymers. The most important characteristics of the ultrasonic sensors so described are their resonant frequency, band width and the efficiency of the conversion of the electrical signal into the mechanical displacement and amplitude of the sound wave. The last property can be influenced, not only by the
sensor material used but also by different attenuation materials on the reverse side of an ultrasonic sensor. At frequencies lower than 1 MHz the structure of the sound field has to be taken into consideration.
3. INDUSTRIAL APPLICATIONS
Measuring methods
For process monitoring pulse methods are mostly applied. An electrical signal interacts with the transduction devices (the ultrasonic sensor) to produce a mechanical displacement. This mechanical wave is introduced into the specimen or the process medium either immediately or after some delay which can be encountered in an intermediate propagation medium. Echoes from the specimen may be received by the same transducer for the pulse-echo operating method, or the signal passing through the specimen may be received by another transducer in the through-transmission operating mode. Using equations (1) and (2) the following is valid:
x is the path length travelled by the ultrasonic wave in the medium and t the corresponding time for it so to pass. Uo and U are the voltage amplitudes sensed at positions x = 0 (Uo) and x (U) and are proportional to the sonic alternating pressure p.
The velocity measurement is reduced to a pure time measurement if the fixed distance of the transducers is known.
Such a time measurement can relatively easily be obtained with high accuracy (up to 10-5). A digital signal can be obtained and on-line measurement is possible.The determination of the ultrasonic attenuation during processes is more difficult when a method with fixed transducer distance is used, as is common in industrial applications. Then changes of the impedance of the medium influence the amplitude of the receiver signal. If these changes are unknown the attenuation investigation gives incorrect values. Therefore, only inaccurate relative conclusions can be made. Very often methods with variable transducer distances are applied in laboratories and then the problem does not exist but the precision of measurement is not great. It is for this reason that velocity measurement is used in most cases for technological applications.
Known Industrial Applications of Ultrasound
There are two major fields of industrial application of ultrasound: (a) non-destructive testing/evaluation/inspection, and (b) process on line monitoring. On line process control allows the making of continuous corrections if the monitored parameter shows deviations from the desired value. The parameter of interest may not be measured directly; often another parameter functionally related to it allows more convenient measurement, i.e. measurement of ultrasonic propagation velocity or
attenuation.
In many industrial processes a knowledge of the flow velocity is important. For this aim ultrasonic Doppler Flowmeters are very often applied (Figure l(a)) and they are reliable and accurate devices.19] They have also found wide application in medicine. In the last few years more and more correlation techniques have been introduced for industrial applications. Ultrasound plays an important role as a sensor in these cores (Figure l(d)). On the basis of the cross correlation function the flow velocity in liquids can be determined. ~l~ Two other types, the vortex shedding type (Figure I(c)) and the sing-around version (wave transit-time differences) (Figure 1 (b)) use also ultrasonics to detect flow dependant phenomena. A new ultrasonic sensor system for high sensitive flow measurement is described in it31 Ultrasonic transducers on the basis ofinterdigital structures and a new double-looked-loop principle for the detection are applied.
Very often ultrasonic sensors are applied for liquid level measurements in tanks. These methods are applicable not only for liquids.ill] Several methods are known in which the concentration in liquid binary systems are determined on line. This is possible when the ultrasonic velocity is a strong function of concentration in liquid mixtures, emulsions or solutions. The chemical, food or pharmaceutical industry can use this principle.
In gaseous systems ultrasonic sensors are applied as distance sensors for robotics or as temperature sensors for combustion processes. As passive sensors ultrasonic transducers act by acoustic emission. Many other examples could be cited. A summary is given in[12]
Ultrasonics for Polymerisation Monitoring
Polymerising systems are complicated and can be heterogeneous multicomponent or multiphase. The ultrasonic parameters give overall information about the state of such systems. Although the velocity reacts very sensitively to material or phase changes this information is unspecific, If one wants to get a quantitative statement on an interesting value, for instance the conversion, the components of the system have to be investigated in detail in order to understand their influence or to find empirical relationship. Detailed results from investigations during several polymerisations are given in Ir。

相关文档
最新文档