ACKNOWLEDGEMENT “In the name of Allah Almighty, who is the most Merciful.” We are highly indebted to Engr. Osama Bin Naeem for his supervision as well as for providing necessary guidance regarding the project & also for his support in completing it. Our thanks and appreciations also go to our colleagues and people who have willingly helped us out with their abilities in developing the project. Department of Electrical Engineering 2017-EE-601 2017-EE-602 2017-EE-605 2017-EE-618 P a g e 1 | 17 Table of Contents ACKNOWLEDGEMENT ............................................................................................................................................................. 1 ABSTRACT ................................................................................................................................................................................ 3 KEYWORDS .............................................................................................................................................................................. 4 INTRODUCTION ....................................................................................................................................................................... 5 PROBLEM STATEMENT ............................................................................................................................................................ 6 BLOCK DIAGRAM ..................................................................................................................................................................... 7 CIRCUIT DIAGRAM .................................................................................................................................................................. 7 EQUIPMENT REQUIRED........................................................................................................................................................... 8 STM32 MICROCONTROLLER ............................................................................................................................................... 8 MOISTURE SENSOR ............................................................................................................................................................. 8 CAPACITOR FILTER .............................................................................................................................................................. 8 RELAY MODULE ................................................................................................................................................................... 9 DC PUMP ............................................................................................................................................................................. 9 WORKING .............................................................................................................................................................................. 10 FLOW CHART ......................................................................................................................................................................... 10 PROPOSED ALGORITHM........................................................................................................................................................ 11 PIN CONFIGURATION OF STM32........................................................................................................................................... 15 CONCLUSION ......................................................................................................................................................................... 15 FUTURE SCOPE ...................................................................................................................................................................... 16 REFERENCE ............................................................................................................................................................................ 17 P a g e 2 | 17 ABSTRACT With the advancement of automation technology, life is getting simpler and easier in all aspects. In today’s world Automatic systems are being preferred over manual system. Automatic system is a growing system of everyday object from industrial machine to consumer goods that can complete tasks while a person is busy with other activities. Today, the farmers are suffering from the lack of rains and scarcity of water. The main objective is to provide an automatic irrigation system thereby saving time, money & power of the farmer. The traditional farmland irrigation techniques require manual intervention. With the automated technology of irrigation the human intervention can be minimized. Whenever there is a change in temperature and humidity of the surroundings these sensors sense the change in temperature and humidity and gives an interrupt signal to the micro-controller. The project is designed to develop an automatic irrigation system which switches the pump motor ON/OFF on sensing the moisture content of the soil. In the field of agriculture, use of proper method of irrigation is important. The advantage of using this method is to reduce human intervention and still ensure proper irrigation. The project uses stm32 microcontroller which is programmed to receive the input signal of varying moisture condition of the soil through the sensing arrangement. This is achieved by using an op-amp as comparator which acts as interface between the sensing arrangement and the microcontroller. Once the controller receives this signal, it generates an output that drives a relay for operating the water pump. An LCD display is also interfaced to the microcontroller to display status of the soil and water pump. The sensing arrangement is made by using two stiff metallic rods inserted into the field at a distance. Connections from the metallic rods are interfaced to the control unit. P a g e 3 | 17 KEYWORDS Soil Moisture, smart irrigation, sensor based system, intelligent switching, agriculture, microcontroller, stm32 P a g e 4 | 17 INTRODUCTION In the fast paced world human beings require everything to be automated. Our life style demands everything to be remote controlled. Apart from few things man has made his life automated. In the world of advance electronics, life of human beings should be simpler. Hence to make life simpler and convenient, we have made “AUTOMATIC IRRIGATION SYSTEM”. A model of controlling irrigation facilities to help millions of people. This model uses sensing arrangement technology with microcontroller to make a smart switching device. In Pakistan, agriculture is the need of most of the people livelihood and it is one of the main sources of livelihood. Agriculture also has a major impact on economy of the country. The consumption of water increases day by day that may leads to the problem of water scarcity. Now a days, farmers are struggling hard in the agriculture field and the task of irrigating field is becoming quite difficult for the farmers due to lack of regularity in their work and negligence because sometimes they switch on the motor and then forget to switch off which may leads to wastage of water. Similarly, they even forget to switch ON the motor, which again leads to damage to the crops. To overcome this problem, we have implemented a new technique by using microcontroller. In this project we are using soil moisture sensor which is used to sensing moisture level whether the soil is dry or wet. Water is a very precious resource and must be properly utilized. Agriculture is one of those areas which consume a lot of water. Irrigation is a time consuming process and must be done on a timely basis. The aim is to develop an smart irrigation system which measures the moisture of the soil and automatically turns on or off the water supply system. The effects of the applied amount of irrigation water, irrigation frequency and water use are particularly important. To improve water efficiency there must be a proper irrigation scheduling strategy. So our project devices a simple system, using a microcontroller to automate the irrigation and watering of crops with minimal manual interventions. P a g e 5 | 17 PROBLEM STATEMENT In the case of traditional irrigation system water saving is not considered. Since, the water is irrigated directly in the land, plants under go high stress from variation in soil moisture, therefore plant appearance is reduced. The absence of automatic controlling of the system result in improper water control system. The major reason for these limitations is the growth of population which is increasing at a faster rate. At present there is emerging global water crisis where managing scarcity of water has become a serious job. This growth can be seen in countries which have shortage of water resources and are economically poor. So, this is the serious problem in agriculture area. So, we want to design an Smart Irrigation System which is based on microcontroller that operate automatically by sensing the moisture content of the soil and turn ON/OFF the pump using relay without the intervention of farmer and hence save water. P a g e 6 | 17 BLOCK DIAGRAM Charger Relay module Voltage regulator Pump LCD STM32 Soil moisture sensor Microcontroller Figure 1 CIRCUIT DIAGRAM Figure 2 P a g e 7 | 17 EQUIPMENT REQUIRED STM32 MICROCONTROLLER The STM32 family of microcontrollers from STMicroelectronics is based on the ARM Cortex-M 32-bit processor core. The STM32 series are some of the most popular microcontrollers used in a wide variety of products. They also have an excellent support base from multiple microcontroller development forums. The STM32 microcontrollers offer a large number of serial and parallel communication peripherals which can be interfaced with all kinds of electronic components including sensors, displays, cameras, motors, etc. All STM32 variants come with internal Flash memory and RAM. The range of performance available with the STM32 is quite expansive. Some of the most basic variants include the STM32F0 and STM32F1 sub-series that start with a clock frequency of only 24 MHz, and are available in packages with as few as 16 pins. At the other performance extreme, the STM32H7 operates at up to 400 MHz, and is available in packages with as many as 240 pins. MOISTURE SENSOR A soil moisture sensor is the part of the system that is in contact with the soil and measure the moisture level of soil and give it to the op-amp that on comparing the reference value of moisture content of soil and send signal to the microcontroller and gives the output to the relay which turn ON/OFF the Pump accordingly. Figure 3 CAPACITOR FILTER The simple capacitor filter is the most basic type of power supply filter. The application of the simple capacitor filter is very limited. It is sometimes used on extremely high-voltage, low current power supplies for cathode ray and similar electron tubes, which require very little load current from the supply. The capacitor filter is also used where the power-supply ripple frequency is not critical; this frequency can be relatively high. Full-wave rectifier with a capacitor filter. P a g e 8 | 17 When this filter is used, the RC charge time of the filter capacitor (C1) must be short and the RC discharge time must be long to eliminate ripple action. In other words, the capacitor must charge up fast, preferably with no discharge at all. Better filtering also results when the input frequency is high; therefore, the full-wave rectifier output is easier to filter than that of the half-wave rectifier because of its higher frequency. RELAY MODULE Relay is an electromagnetic device which is used to isolate two circuits electrically and connect them magnetically. They are very useful devices and allow one circuit to switch another one while they are completely separate. They are often used to interface an electronic circuit (working at a low voltage) to an electrical circuit which works at very high voltage. For example, a relay can make a 5V DC battery circuit to switch a 230V AC mains circuit. Thus a small sensor circuit can drive, say, a fan or an electric bulb. Figure 4 DC PUMP A DC motor is any of a class of rotary electrical machines that converts direct current electrical energy into mechanical energy. The most common types rely on the forces produced by magnetic fields. Nearly all types of DC motors have some internal mechanism, either electromechanical or electronic, to periodically change the direction of current flow in part of the motor. DC motors were the first type widely used, since they could be powered from existing directcurrent lighting power distribution systems. A DC motor's speed can be controlled over a wide range, using either a variable supply voltage or by changing the strength of current in its field windings. Small DC motors are used in tools, toys, and appliances. P a g e 9 | 17 WORKING The soil moisture sensors which are nothing but copper strands are inserted in the soil. The soil sensing arrangement measures the conductivity of the soil. Wet soil will be more conductive than dry soil. The soil sensing arrangement module has a comparator in it. The voltage from the prongs and the predefined voltage are compared and the output of the comparator is high only when the soil condition is dry. This output from the soil sensing arrangement is given to the analogue input pin of the microcontroller. The microcontroller continuously monitors the analogue input pin. When the moisture in the soil is above the threshold, the microcontroller displays a message mentioning the same and the motor is off. When the output from the soil sensing arrangement is high i.e. the moisture of the soil is less. This will trigger the microcontroller and displays an appropriate message on the LCD and the output of the microcontroller, which is connected to the base of the transistor, is high. When the transistor is turned on, the relay coil gets energized and turns on the motor. The LED is also turned on and acts as an indicator. When the moisture of the soil reaches the threshold value, the output of the soil sensing arrangement is low and the motor is turned off . FLOW CHART P a g e 10 | 17 PROPOSED ALGORITHM // AUTOMATIC IRRIGATION SYSTEM /* Program to test 16*2 Alaphanumeric LCD with STM32 (Blue Pill) The circuit: LCD RS pin to digital pin PB11 LCD Enable pin to digital pin PB10 LCD D4 pin to digital pin PB0 LCD D5 pin to digital pin PB1 LCD D6 pin to digital pin PC13 LCD D7 pin to digital pin PC14 LCD R/W pin to ground LCD VSS pin to ground LCD VCC pin to 5V */ #include <LiquidCrystal.h> //LCD Library const int rs = PB11, en = PB10, d4 = PB0, d5 = PB1, d6 = PC13, d7 = PC14; //mention the pin names to with LCD is connected to int M_Sensor = PA0; int P_pin = PB5; //pump int buzzer = PB6; // buzzer int val; int cel; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); //Initialize the LCD void setup() { P a g e 11 | 17 lcd.begin(16, 2); lcd.clear(); pinMode(P_pin, OUTPUT); pinMode(M_Sensor, INPUT); pinMode(buzzer, OUTPUT); Serial.begin(9600); lcd.setCursor(0, 1); lcd.print("EE-17 GIRLS"); delay(2000); lcd.clear(); lcd.setCursor(0, 0); lcd.print("AUTOMATIC SMART"); lcd.setCursor(0, 1); lcd.print("IRIGATION SYSTEM"); delay(2500); lcd.clear(); delay(1000); } void loop() { lcd.clear(); int Moisture = analogRead(M_Sensor); //Read Moisture Sensor Value Serial.println(Moisture); if (Moisture > 2300) // for no soil { lcd.clear(); lcd.setCursor(0, 0); lcd.print("NO SOIL"); //lcd.setCursor(11,1); P a g e 12 | 17 //lcd.print("SOIL"); lcd.setCursor(0, 1); lcd.print("PUMP:OFF"); digitalWrite(PB5, LOW); digitalWrite(PB6, LOW); } else if (Moisture >= 1800 && Moisture <= 2300) // for dry soil { lcd.clear(); lcd.setCursor(0, 0); lcd.print("DRY SOIL"); //lcd.setCursor(11,1); //lcd.print("SOIL"); lcd.setCursor(0, 1); lcd.print("PUMP:ON"); digitalWrite(PB5, HIGH); digitalWrite(PB6, HIGH); } else if (Moisture >= 900 && Moisture <= 1800) //for Moist Soil { lcd.clear(); lcd.setCursor(0, 0); lcd.print("MOIST SOIL"); //lcd.setCursor(11,1); //lcd.print("SOIL"); lcd.setCursor(0, 1); lcd.print("PUMP:OFF"); digitalWrite(P_pin, LOW); digitalWrite(buzzer, LOW); P a g e 13 | 17 } else if (Moisture < 900) // For Soggy soil { lcd.clear(); lcd.setCursor(0, 0); lcd.print("SOGGY SOIL"); //lcd.setCursor(11,1); //lcd.print("SOIL"); lcd.setCursor(0, 1); lcd.print("PUMP:OFF"); digitalWrite(P_pin, LOW); digitalWrite(buzzer, LOW); } delay(1000); } P a g e 14 | 17 PIN CONFIGURATION OF STM32 Figure 5 HARDWARE Figure 6 P a g e 15 | 17 CONCLUSION The Project ‘Smart Irrigation System’ is used for the optimization use of water in agricultural field without the intervention of farmer by using soil moisture Sensor that senses the moisture content of the Soil using Microcontroller that turn ON/OFF the pump automatically according t the need of water for irrigation and hence helpful in saving water. This system is quite affordable and feasible. This system of irrigation is also helpful in the region where there is scarcity of water and improves their sustainability. And can also be adjusted according to the need of varieties of crop to be irrigated. FUTURE SCOPE Using this system as framework, the system can be expanded to include various other options which could include mobile application control of motor and wifi controlled monitoring. These will expand the working capability and efficiency of this prototype. It can be implemented not in agriculture but in gardens in any places using the sprinkler concept. The concept in future can also be enhanced by adopting DTMF technology. This project is basically dependent on the output of the sensing arrangement. Whenever there is need of excess water in the desired field then it will not be possible by using sensing arrangement technology. P a g e 16 | 17 REFERENCE SMAJSTRLA, A.G.; KOO, R.C...(1 9 8 6 ). "Applied engineering in agriculture" http://www.ijirst.org/articles/IJIRSTV3I10005.pdf https://www.researchgate.net/publication/330831084_Developing_a_Smart_Irrigation_Systemo P a g e 17 | 17