蔬菜大棚温湿度监测系统毕业论文

2019-01-27 21:05

(此文档为word格式,下载后您可任意编辑修改!)

蔬菜大棚温湿度监测系统

摘要

温湿度控制已成为当今社会研究的热门项目。是工业农业生产过程中必须考虑的情况,作为最常见的被控参数。温度和湿度已经不再是以一个个体的形式出现,而应在系统中一起考虑。广泛应用于实验室、温室大棚、花圃、粮仓乃至土壤等各个领域。而传统的温湿度控制则利用湿度表、毛发湿度表、双金属式测量计和湿度试纸等测试器材,通过人工自己进行检测。对不符合温度和湿度要求的库房进行通风、降温、去湿等操作。这种人工测试方法费时费力,效率低,并且随机性还很大,误差也很大。因此我们需要一种造价低廉、使用方便且计算精确的温湿度控制仪器来进行控制,也符合我们社会发展进步。利用单片机对温、湿度控制,具有控温、湿精度高、功能强、体积小、价格低,简单灵活等优点,很好的满足了工艺要求,给人们的生活带来了极大的方便,也为人们带了很好的利益。

本文通过使用STC89C52单片机、DHT11传感器模块、1602液晶显示屏模块以及继电器控制模块。很简单的实现的温湿度的控制要求。DHT11数字温湿度传感器把采集到的温湿度数据传给单片机,经过单片机的处理,准确的显示到液晶屏上,如果温度超过阀值,将会驱动继电器工作,继电器将驱动负载相应的工作。

关键词:传感器,温湿度,单片机,智能控制

1

Vegetable greenhouse temperature and today's social

studies. Is a factor that must be considered in the industrial and agricultural production process. As the control parameters of the most common. Temperature

and

the system.Widely

used

in laboratory, greenhouse, flower garden, granary andsoil etc.. The

temperature

and , cooling, dehumidification operation. This kind of manual test method

is

time-consuming

and

laborious, low

efficiency. Allrandom. Big error. Hence the need for a low cost, easy to use and the calculation of the temperature and , strong function, small size, low price, the advantages of simplicity and flexibility, good to meet theprocess requirements.

In this paper, by using the STC89C52 SCM, DHT11 sensor module,1602 liquid

crystal

display module

and relay

control module. Simplerealization of the control of temperature and . If the temperature exceeds the threshold, will drive the relay to work. The relay will drive the load corresponding work.

Keywords: Sensor, temperature and =P1^5;

sbit Led_shengwen=P1^4; sbit Key_TH1 = P3^2; sbit Key_TH2 = P3^3; sbit Key_HH1 = P3^4; sbit Key_HH2 = P3^5;

升温灯

降温灯

(3) 常量、变量定义

定义标识

volatile bit FlagStartRH = 0; 开始温湿度转换标志 volatile bit FlagKeyPress = 0; 有键按下 定义温湿度传感器用外部变量 extern U8 U8FLAG,k;

extern U8 U8count,U8temp;

extern U8 U8T_data_H,U8T_data_L,U8RH_data_H,U8RH_data_L,U8checkdata;

extern U8 U8T_data_H_temp,U8T_data_L_temp,U8RH_data_H_temp,U8RH_data_L_temp; extern U8 U8checkdata_temp; extern U8 U8comdata; extern U8 count, count_r; U16 temp;

S16 temperature, = 1; Led_shengwen = 1; TH = 40; HH = 85; keyvalue = 0; keyTH1 = 1; keyTH2 = 1; keyHH1 = 1; keyHH2 = 1; }

定时器0初始化 void Timer0_Init() { }

定时器0中断

void Timer0_ISR (void) interrupt 1 using 0 {

TL0 = 0x06;

TH0 = 0xf8; 定时器赋予初值 每2秒钟启动一次温湿度转换 ET0 = 1; 允许定时器0中断 TMOD = 1; 定时器工作方式选择 TL0 = 0x06;

TH0 = 0xf8; 定时器赋予初值 TR0 = 1; 启动定时器

RHCounter ++; if (RHCounter >= 1000) {

FlagStartRH = 1; }

存入设定值、 void Save_Setting() {

pSave = (char *)&TH; DELAY(500);

地址低位对应低8位,高位对应高8位

wrteeprom(0, *pSave); 存温度上限值TH低8位

RHCounter = 0; }

pSave ++;

wrteeprom(1, *pSave); 存温度上限值TH高8位 DELAY(500);

pSave = (char *)&HH;

wrteeprom(2, *pSave); 存湿度上限值RH低8位 DELAY(500); pSave ++;

wrteeprom(3, *pSave); 存湿度上限值RH高8位 DELAY(500); }

载入设定值、 void Load_Setting() {

pSave = (char *)&TH; *pSave++ = rdeeprom(0); *pSave = rdeeprom(1); pSave = (char *)&HH; *pSave++ = rdeeprom(2); *pSave = rdeeprom(3); if ((TH>99)||(TH<0)) TH = 40; if ((HH>99)||(HH<0)) HH = 85; }

void KeyProcess(uint num) {

switch (num) { case 1:

if (TH<99) TH++;

L1602_char(1, 15, TH10+48); L1602_char(1, 16, TH+48); break; case 2:

if (TH>1) TH--;

L1602_char(1, 15, TH10+48); L1602_char(1, 16, TH+48); break; case 3:

if (HH<99) HH++;

L1602_char(2, 15, HH10+48); L1602_char(2, 16, HH+48); break; case 4:

if (HH>1) HH--;

L1602_char(2, 15, HH10+48); L1602_char(2, 16, HH+48);

}

break; default: break;

Save_Setting(); }

(5) main()函数

void main() {

U16 i, j, testnum; EA = 0;

Timer0_Init(); 定时器0初始化 Data_Init();

EA = 1;

载入温度上限和湿度上限设定值

Load_Setting();

L1602_char(1, 15, TH10+48); L1602_char(1, 16, TH+48); L1602_char(2, 15, HH10+48); L1602_char(2, 16, HH+48); while(1) {

if (FlagStartRH == 1) {

TR0 = 0;

FlagStartRH = 0; TR0 = 1; = 0;

降温

L1602_init();

L1602_string(1,1,\ \L1602_string(2,1,\ \延时

for (i=0;i<1000;i++) for (j=0;j<1000;j++) {;}

L1602_string(1,1,\ \L1602_string(2,1,\ \L1602_string(2,1,\ % HH:\

清屏

L1602_string(1,1,\ C TH:\

温湿度转换标志检查

testnum = RH();

读出温湿度,只取整数部分

else Led_jiangwen = 1;

if (humidity > HH) Led_qushi = 0; else Led_qushi = 1;

键盘查询,在弹起时响应

if ((Key_TH1)&&(keyTH1==0)) {FlagKeyPress = 1; keyvalue = 1;}

去湿

else if ((Key_TH2)&&(keyTH2==0)) {FlagKeyPress = 1; keyvalue = 2;} else if ((Key_HH1)&&(keyHH1==0)) {FlagKeyPress = 1; keyvalue = 3;} else if ((Key_HH2)&&(keyHH2==0)) {FlagKeyPress = 1; keyvalue = 4;}

if (FlagKeyPress == 1) {

KeyProcess(keyvalue); FlagKeyPress = 0; }

}

}

else keyTH1 = 1; else keyTH2 = 1; else keyHH1 = 1; else keyHH2 = 1;

if (!Key_TH1) keyTH1 = 0; if (!Key_TH2) keyTH2 = 0; if (!Key_HH1) keyHH1 = 0; if (!Key_HH2) keyHH2 = 0;


蔬菜大棚温湿度监测系统毕业论文.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2018年新课标人教版二年级语文下册第五单元教案 - 图文

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: