Greenhouse temperature and humidity automatic control system based on single-chip microcomputer (full set of data such as proteus simulation)

Contents
1 Preface 1
2 Overall scheme design 3
2.1 Design index requirements of temperature and humidity control system 3
2.2 System design principles 3
2.2.1 Reliability 3
2.2.2 Cost performance 3
2.3 Scheme comparison 4
2.3.1 Scheme 1 4
2.3.2 Scheme 2 4
2.4 Scheme demonstration 5
2.5 Scheme selection 5
3 Unit module design 6
3.1 Unit module function introduction and circuit design 6
3.1.1 SCM minimum system 6
3.1.2 Liquid crystal display module 8
3.1.3 Temperature and humidity sensor module 8
3.1.4 Design of alarm circuit 9
3.1.5 Design of output circuit 10
3.1.6 Design of power supply 12
3.1.7 Design of button circuit 13
3.1.8 Serial communication circuit 14
3.2 List of components 15
3.3 Introduction of key components 17
3.3.1 STC89C52RC 17
3.3. 2 SHT10 temperature and humidity sensor 19
4 System software design 22
4.1 Overall structure of software design 22
4.2 Design flow chart of main modules 24
4.2.1 Main program flow chart 24
4.2.2 SHT10 subroutine flow chart 25
4.2.3 LCD1602 Subroutine Flowchart 27
4.2.4 Output Control Subroutine Flowchart 28
4.2.5 Keyboard Scanning Subroutine Flowchart 29
4.3 Software Design Tools 31
4.3.1 Keil uVision4 31
4.3.2 Proteus 31
5 System Debugging 32
5.1 Use Proteus to build the simulation diagram 32
5.2 Use Keil to debug and compile the program 33
6 Conclusion 36
6.1 System functions 36
6.2 System parameters 36
6.3 System function analysis 36
7 Summary and experience 38
8 Acknowledgments 39 9 References
40 Appendix
1 System schematic diagram 41
Appendix 2 System simulation general diagram 42
Appendix 3 System physical photos 43
Appendix 4 System source program 44
2 Overall scheme design
2.1 Design index requirements of temperature and humidity control system
The greenhouse temperature and humidity automatic control system to be designed in this paper, It is necessary to be able to timely and accurately collect the temperature and humidity in the greenhouse, display it on the LCD1602 liquid crystal display, and then compare it with the set upper and lower limits. If it exceeds the limit, start the temperature and humidity control equipment and pass The buzzer will alarm until the temperature and humidity return to the specified range. In addition, it is also necessary to be able to modify the upper and lower limits of the setting by pressing the button. In order to meet the needs of agricultural production, the design should meet the following indicators:
(1) Working environment: greenhouse;
(2) Temperature measurement error: ±1°C;
(3) Temperature measurement range: 0~+55℃;
(4) Humidity measurement error: ±5%RH;
(5) Humidity measurement range: 0~100%RH;
(6) Modify the upper and lower limits through the keyboard circuit: Yes;
(6) Temperature and humidity alarm: Yes;
2.2 Principles of system design
2.2.1 Reliability
Reliability is a factor that should be given priority in the design process. A control system must be able to work stably and reliably before it can be put into production practice to go. If the reliability of the system cannot meet the standard, the possibility of system failure will increase, causing great losses. This kind of loss not only includes economic and reputation loss, but also may pose a threat to personal safety.
To improve the reliability of the control system, we must pay attention to the following aspects: the selected components must have high reliability; since the power supply is prone to interference, anti-interference measures should be taken for it; the input and output channels In the same way, anti-interference measures should be adopted; when designing circuit boards, reasonable wiring and grounding should be done; software and hardware must be filtered; the system should have its own diagnostic function, etc.
2.2.2 Cost performance
Cost performance is also an important factor to be considered in system design. Products with high cost performance are easier to be accepted by consumers, but the design process should not blindly pursue cost performance. It should be based on product performance requirements. First, meet the performance requirements, and then try to reduce product costs.
2.3 Alternative Comparison
2.3.1 Alternative One
PLC is used as the main controller.
The biggest advantage of using PLC is that PLC uses ladder diagram for programming, the programming language is intuitive, and the difficulty is low, so the development cycle is short and easy to expand. This article is reproduced from http://www.biyezuopin.vip/onews.asp?id=12696 and PLC has strong anti-interference ability and stable and reliable work, which has been proved by long-term industrial control practice.

void main(void)
{
       unsigned char error,checksum; 
	    LcdRw=0;
       s_connectionreset(); 
       welcome();                               //显示欢迎画面
       delay(2000);
		LCD_Initial();
        while(1) 
        { 
          error=0; 
 error+=s_measure((unsigned char*) &humi_val.i,&checksum,HUMI);                                                               
 error+=s_measure((unsigned char*) &temp_val.i,&checksum,TEMP);                                                         
          if(error!=0)
		   s_connectionreset();            //in case of an error: connection reset 
          else 
          { 
		      humi_val.f=(float)humi_val.i;        //converts integer to float
             temp_val.f=(float)temp_val.i;       //converts integer to float
             calc_sht10(&humi_val.f,&temp_val.f);     //计算湿度与温度
			   GotoXY(0,0);//
	          Print("Tep:");
		       GotoXY(0,1);
	          Print("Hum:");
			   temperature=temp_val.f;
		       zhuanhuan(temp_val.f);//转换温度为uchar方便液晶显示
			   GotoXY(5,0);
			   str[5]=0xDF;                      //℃的符号
	          str[6]=0x43;
			   str[7]='\0';
	         Print(str);
			  humidity=humi_val.f;
			  zhuanhuan(humi_val.f);//转换湿度为uchar方便液晶显示
		     GotoXY(5,1);
			  str[5]='%';                                  //%的符号
	         str[6]='\0';                                 //字符串结束标志
     	     Print(str);
          } 

		   keyscan();
		   control();
          //----------wait approx. 0.8s to avoid heating up SHTxx------------------------------       
		  delay_n10us(80000);                  //延时约0.8s
        }
}

insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/sheziqiong/article/details/127459889