Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 99 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
99
Dung lượng
3,75 MB
Nội dung
A Project Report on MONITOR AND CONTROL OF GREEN HOUSE ENVIRONMENT (Green House Efect ) Submitted in partial fulfillment of the requirements for the award of the DIPLOMA OF ASSOCIATE ENGINEER In ELECTRONICS Submitted By: IMRAN JAVED 10919103 WAQAR HAIDER 10919110 RASHID IQBAL 10919116 ANWAR YASIN 10919132 MUHAMMAD ALI 10919237 Under the esteemed guidance of Mr IMRAN KHAN ELECTRONICS TECHNOLOGY SWEDISH INISTITUTE OF TECHNOLOGIES (AFFLIATED WITH PUNJAB BOARD OF TECHNICAL EDUCATION, LAHORE) CAMPUS-III, COMMERCIAL MARKET, RAWALPINDI 2012 CERTIFICATE DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING This is to certify that the project report entitled MONITOR AND CONTROL OF GREEN HOUSE ENVIRONMENT is Submitted by IMRAN JAVED 10919103 WAQAR HAIDER 10919110 RASHID IQBAL 10919116 ANWAR YASIN 10919132 MUHAMMAD ALI 10919237 In partial fulfillment for the award of the Diploma of Associate Engineer in Electronics It is a record of bonafide work carried out by above mentioned students under the esteemed guidance and supervision of Mr IMRAN KHAN Project Guide Head of the Department ( Mr IMRAN KHAN ) ( Mr IMRAN KHAN ) Project Incharge Head of Department External Examiner ACKNOWLEDGEMENTS We are very grateful to our guide Mr IMRAN KHAN who laid the time bound program for the successful completion of this project He initiated and channeled our thoughts and extended timely suggestions for which we are deeply indebted to him We are thankful to him for his comments and insights in the preparation of this report We express my heart felt gratitude and thanks to the Head of Department of Electronics Mr HAFEEZ AHMED for his technical support and valuable suggestions We expres s my sincere thanks to Mr MAJID KHAN principal of Swedish Institute of Technology, for his enriching thoughts and profound knowledge, which brought our project work to its completion We express my sincere thanks to our microprocessor teacher Mr HAFEEZ AHMED and our lab incharge Mr MUHAMMAD HAFEEZ for providing necessary support in the lab and for helping us in the microcontroller programming We thank sincerely and profusely to all staff members of our College, for their valuable guidance We also express my gratitude to the college Management and to all those who have indirectly helped us in the successful completion of our project Last but not the least We are deeply indebted to our parents for what We are today, because this project w ould not have been a reality without their love and support Yours Sincerely, 3|P ag e ` ABSTRACT Appropriate environmental conditions are necessary for optimum plant growth, improved crop yields, and efficient use of water and other resources Automating the data acquisition process of the soil conditions and various climatic parameters that govern plant growth allows information to be collected at high frequency with less labor requirements The existing systems employ PC or SMS-based systems for keeping the user continuously informed of the conditions inside the greenhouse; but are unaffordable, bulky, difficult to maintain and less accepted by the technologically unskilled workers The objective of this project is to design a simple, easy to install, microcontrollerbased circuit to monitor and record the values of temperature, humidity, soil moisture and sunlight of the natural environment that are continuously modified and controlled in order optimize them to achieve maximum plant growth and yield The controller used is a low power, cost efficient chip manufactured by ATMEL having 8K bytes of on-chip memory It communicates with the various sensor modules in real-time in order to control the light, aeration and drainage process efficiently inside a greenhouse by actuating a cooler, fogger, dripper and lights respectively according to the necessary condition of the crops An integrated Liquid crystal display (LCD) is also used for real time display of data acquired from the various sensors and the status of the various devices Also, the use of easily available components reduces the manufacturing and maintenance costs The design is quite flexible as the software can be changed any time It can thus be tailormade to the specific requirements of the user This makes the proposed system to be an economical, portable and a low maintenance solution for greenhouse applications, especially in rural areas and for small scale agriculturists 4|P ag e ` Contents INTRODUCTION 11 1.1 CURRENT SCENARIO 11 1.1.1 MANUAL SET-UP: 11 1.1.2 PARTIALLY AUTOMATED SET-UP: 11 1.1.3 FULLY- AUTOMATED: 11 1.2 PROPOSED MODEL FOR AUTOMATION OF GREENHOUSE 12 SYSTEM MODEL 14 2.1 BASIC MODEL OF THE SYSTEM 14 2.2 PARTS OF THE SYSTEM: 14 2.2.1 TRANSDUCERS (Data acquisition system): 15 2.2.2 ANALOG TO DIGITAL CONVERTER (ADC): 15 2.2.3 MICROCONTROLLER: 15 2.2.4 ACTUATORS: 15 2.2.5 DISPLAY UNIT: 15 2.3 STEPS FOLLOWED IN DESIGNING THE SYSTEM: 16 HARDWARE DESCRIPTION 19 3.1 TRANSDUCERS: 19 3.1.1 SOIL MOISTURE SENSOR 19 3.1.2 LIGHT SENSOR 20 3.1.3 HUMIDITY SENSOR 22 3.1.4 TEMPERATURE SENSOR 23 3.2 ANALOG TO DIGITAL CONVERTER (ADC 0808) 24 3.2.1 DESCRIPTION 25 3.2.2 FEATURES 25 3.2.3 CONVERSION METHOD USED 26 3.2.4 PIN DIAGRAM OF ADC 0808/0809 27 3.2.5 SELECTING AN ANALOG CHANNEL 28 3.3 CLOCK CIRCUITRY FOR ADC: 30 3.3.1 Functional Description: 30 3.4 MICROCONTROLLER (AT89S52) 31 3.4.1 CRITERIA FOR CHOOSING A MICROCONTROLLER 31 3.4.2 DESCRIPTION: 32 5|P ag e ` 3.4.3 FEATURES: 33 3.4.4 PIN CONFIGURATION 33 3.4.5 BLOCK DIAGRAM 34 3.4.6 PIN DESCRIPTION 34 3.4.7 SPECIAL FUNCTION REGISTERS 37 3.4.8 MEMORY ORGANIZATION 38 3.4.9 WATCHDOG TIMER (One-time Enabled with Reset-out) 39 3.4.10 TIMERS AND COUNTERS 40 3.4.11 INTERRUPTS 41 3.5 LIQUID CRYSTAL DISPLAY 43 3.5.1 SIGNALS TO THE LCD 43 3.5.2 PIN DESCRIPTION 44 3.6 ALARM CIRCUITRY 45 3.7 RELAYS 46 3.8 POWER SUPPLY CONNECTION 49 CIRCUIT SCHEMATIC OF THE SYSTEM 51 SYSTEMS USED IN WORK MODE 53 4.1 DRIP IRRIGATION SYSTEM FOR CONTROLLING SOIL MOISTURE 53 4.2 ARTIFICIAL GROWING LIGHTS FOR CONTROLLING ILLUMINATION 54 4.3 TEMPERATURE CONTROLLERS 55 4.3.1 COOLING EQUIPMENT 55 4.3.2 HEATING EQUIPMENT 55 4.4 HUMIDIFCATION SYSTEMS 55 SOFTWARE 58 5.1 INTRODUCTION TO KEIL SOFTWARE 58 5.1.1 WHAT IS µVision3? 58 5.1.2 STEPS FOLLOWED IN CREATING AN APPLICATION IN uVision3: 58 5.1.3 DEVICE DATABASE 62 5.1.4 PERIPHERAL SIMULATION 63 5.2 PROGRAMMER 63 5.3 ProLoad PROGRAMMING SOFTWARE 64 Flowcharts 66 6.1 FLOWCHART REPRESENTING THE WORKING OF THE SYSTEM 66 6.2 FLOWCHART FOR LCD INITIALIZATION 67 RESULT ANALYSIS 72 6|P ag e ` 7.1 TRANSDUCER READINGS 72 7.1.1 SOIL MOISTURE SENSOR 72 7.1.2 LIGHT SENSOR 73 7.1.3 HUMIDITY SENSOR 73 7.1.4 TEMPERATURE SENSOR 74 ADVANTAGES AND DISADVANTAGES 76 8.1 ADVANTAGES 76 8.2 DISADVANTAGES 76 SCOPE FOR FURTHER DEVELOPMENT 78 10 CONCLUSION 80 11 REFERENCES 82 Books 82 Web Resources 82 12 Source Code: 84 FINAL PROTOTYPE: 99 7|P ag e ` LIST OF FIGURES Figure 2.1: Block diagram of the system …………………………………………………………………………… Figure 3.1 :Soil moisture sensor ………………………………………………………………………………………10 Figure 3.2: Light Dependent Resistor …………………………………………………………………………………11 Figure 3.2.1: Structure of a Light Dependent Resistor ……………………………………………………………….12 Figure 3.3: Light sensor circuit ………………………………………………………………………………….…….12 Figure 3.4: Humidity sensor … ………………………………………………………………………………….……13 Figure 3.5: Humidity sensor circuit …………………………… …………………………………………………….13 Figure 3.6: LM35 temperature sensor …………………………….………………………………………………… 14 Figure 3.7: Temperature sensor circuit ………………………….……………………………………………………15 Figure 3.8: Getting data from the analog world …………………… ……………………………………………….16 Figure 3.9: Block diagram of ADC 0808 …………………………… ………………………………………………17 Figure 3.10: Successive approximation method ………………………………………………………………………18 Figure 3.11: Pin diagram of ADC 0808 ……………………………………… …………………………………… 18 Figure 3.12: ADC 0808 pin details as used for this application ……………………… ……………………………20 Figure 3.13: Timing diagram of ADC 0809 ……………………………………………….………………………….21 Figure 3.14: Clock circuitry for ADC …………………………………………………………………………………21 Figure 3.15: The effect of using a Schmitt trigger ………………………………………… ………………………22 Figure 3.16: Pin diagram of AT89S52 …………………………………………………………… ………………….24 Figure 3.17: Block diagram of the microcontroller ………………………………………………………….……… 25 Figure 3.18: Power-on reset circuit …………………………………………………………………………………….27 Figure 3.19: The AT89S52 oscillator clock circuit ……………………………………………………………………28 Figure 3.20: Internal memory block ………………………………………………………………………………… 30 Figure 3.21: Microcontroller pin details ……………………………………………………………………………….33 Figure 3.22: Address locations for a 2x16 line LCD ………………………………………………………………….34 Figure 3.23: Pin diagram of 2x16 line LCD ………………………………………………………………………… 36 Figure 3.24: Electrical symbol of a buzzer …………………………………………………………………………….36 Figure 3.25: Buzzer circuitry ………………………………………………………………………….……………….37 Figure 3.26: Sugar cube relay ………………………………………………………………………………………….37 Figure 3.27: Different types of Relays …………………………………………………………………….………….38 Figure 3.28: Relay circuitry ……………………………………………………………………………………………39 Figure 3.29: +5V Power supply circuit ……………………………………………………………………………… 40 Figure 3.30: +12V Power supply Circuit ………………………………………………………………………………41 Figure: CIRCUIT SCHEMATIC OF THE SYSTEM ………………………………………………………… …… 42 Figure 4.1: Drip irrigation system ……………………………………………………………………………… ……44 Figure 5.1: Window for choosing the target device ………………………………………………………………… 50 Figure 5.2: Project Workspace Pane ………………………………………………………………………………… 51 Figure 5.3 Project Options Dialog…………………………………………………………………………………… 51 Figure 5.4: “Save All” and “Build All Target Files” Buttons ……………………………………………………….51 Figure 5.5: µVision3 Debugger window …………………………………………………………………………… 52 Figure 5.6: ‘Reset’, ‘Run’ and ‘Step into’ options ………………………………………………………………….53 Figure 5.7: Programming window ………………………………………………………………………………… 55 Figure: FINAL PROTOTYPE …………………………………………………………………………………………90 8|P ag e ` LIST OF TABLES Table 2.1 Importance of the various parameters Table 3.1 Selection of the input channels 19 Table 3.2 Alternate functions of Port-3 26 Table 3.3 Pin description of the LCD 36 Table 7.1 Soil moisture sensor readings 63 Table 7.2 Light sensor readings 64 Table 7.3 Temperature sensor readings 65 9|P ag e ` CHAPTER INTRODUCTION 10 | P a g e ` bit P3_2flag; //functions proto-types void ADC_value(void); void MOIST(void); void LDR_sensor(void); void temp_Sensor(void); int convertBinToDecimal(unsigned char value); void lcdcmd(unsigned char value); void lcddata(unsigned char value1); void msdelay(unsigned int itime); // Delay of 1mesc void humiditySensor(void); void Display(unsigned char[]); void modeStatus(void); void buzzerON(); void buzzer2ON(); // Timer ISR void timer0_isr(void) interrupt { timeCount= timeCount+1; if(timeCount==10000) // 0.1m*10000=1sec { timeCount=0; // Reset the TimeCount after every Second timeout=1; // Set the timeout=1 ( variable to start the Pulse count in the While loop) ET1 = 0; } } void Ext0_isr (void) interrupt // port3.2 =0 { EA=0; P3_2flag=1; EA=1; } 85 | P a g e ` void main(void) { //gobal variables: unsigned int i; buzzerON(); value_binary=0; LDR_Level=0; MOIST_Level=0; cooler=0; sprayer=0; coolerOnOff=0; pump=0; light1=0; light2=0; IE=0x83;// enable timer and int0 interrupts // port pins ADC_data = 0xff; // input port1 freqOut=1; // act as input port ALE=0; // ALE should be low to high OE=0; start=0; // Start of conv should be low to high for(i=0;comm[i]!=0;i++) { lcdcmd(comm[i]); } Display(" WELCOME To $"); lcdcmd(0xc0); //second line in LCD Display("Project GreenBee $"); msdelay(250); lcdcmd(0x01); //clear line in LCD lcdcmd(0x80); //first line in LCD Display(" A Final Year $"); lcdcmd(0xc0); //second line in LCD Display(" Project by: $"); msdelay(175); lcdcmd(0x01); //clear line in LCD 86 | P a g e ` lcdcmd(0x80); //second line in LCD Display("Sekhar, Ravi $"); lcdcmd(0xc0); //first line in LCD Display("Paul & Feroze $"); msdelay(250); lcdcmd(0x01); //clear line in LCD lcdcmd(0x80); //first line in LCD Display(" Initialising$"); lcdcmd(0xc0); //second line in LCD Display(" the Sensors $"); msdelay(2000); while(1) { if(P3_2flag==0) { while(1) { humiditySensor(); if(P3_2flag==1) break; // Soil Moisture: MOIST_Level=0; ADD_A=1; ADD_B=0; ADC_value();//value_binary = ADC_value(); MOIST(); msdelay(1); if(P3_2flag==1) break; // Temperature: ADD_A=0; ADD_B=0; ADC_value(); temp_Sensor(); if(P3_2flag==1) break; 87 | P a g e ` //Light Sensor: LDR_Level=0; ADD_A=1; ADD_B=1; ADC_value(); LDR_sensor(); msdelay(1); if(P3_2flag==1 break; msdelay(50); if(P3_2flag==1) break; msdelay(50); if(P3_2flag==1) break; msdelay(50); if(P3_2flag==1) break; msdelay(50); if(P3_2flag==1) break; msdelay(50); if(P3_2flag==1) break; msdelay(50); if(P3_2flag==1) break; msdelay(50); if(P3_2flag==1) break; msdelay(50); if(P3_2flag==1) break; msdelay(50); if(P3_2flag==1) break; msdelay(50); if(P3_2flag==1) break; } } 88 | P a g e ` if(P3_2flag==1) { modeStatus(); P3_2flag=0; } } } void modeStatus(void) { lcdcmd(0x01); //clear line in LCD lcdcmd(0x80); //first line in LCD if(sprayer==1) Display("SP:ON $"); else Display("SP:OFF $"); lcdcmd(0x88); if(MOIST_Level==1) Display("SM:ON$"); if(MOIST_Level==2) Display("SM:OFF$"); if(MOIST_Level==3) Display("SM:OFF$"); lcdcmd(0xc0); if(cooler==1) Display("C :ON$"); else Display("C :OFF$"); lcdcmd(0xc8); if(LDR_Level==1) Display("LI:OFF $"); if(LDR_Level==2) Display("LI:ON $"); if(LDR_Level==3) Display("LI:ON $"); if(LDR_Level==4) Display("LI:OFF $"); msdelay(3000); 89 | P a g e ` } void humiditySensor(void) { unsigned char DTa[30]="RH:@"; unsigned char DTb[30]="**.* @"; unsigned int count=0; //count=0x00; bit c=0,flag=0; unsigned int i,d,y,z; timeout=0; timeCount=0; TMOD = 0x20; // Set Mode (8-bit timer0 with reload) (.1m/1.085u)=92.16=256-n =>n= 163.83=164d= A4 TH1 = 0xA4; // Reload TL1 to count 100 clocks TL1 = TH1; ET1 = 1; // Enable Timer Interrupts TR1 = 1; // Start Timer Running EA = 1; //Counting the Pulses: while(timeout!=1) { c=freqOut; if(c==1) { if(flag==0) { count = count+1; flag=1; } } else flag=0; } //Checking the Humidity Limits: //LOGIC: //RH% ranges from to 100 through 5k to 10k freq So change in freq = 5K //5K/100 = 50 So for every increment of freq count by 50, there is one increment in RH value in % if (count>4999 && count