Smart Irrigation System using Arduino UNO

Hello everyone, we are back with a new project and we hope you all are doing well. In this article, we will discuss a project named Smart Irrigation System using Arduino UNO. We will use different sensors to measure the environmental and crop parameters which are responsible for good production. We will also make the water pump system automatic which will open the water valve automatically according to the soil moisture of the crop.

We will discuss all points and concepts briefly in this article and also provide a Proteus Simulation to observe how it will work in the real world. Complete fully explained code and simulation are also provided below as you go ahead in this article. You can download it from there.

Smart Irrigation System using Arduino UNO

Let’s start with an Introduction:

Where To Buy?
No.ComponentsDistributorLink To Buy
1LCD 20x4AmazonBuy Now
2LDR SensorAmazonBuy Now
3MQ-135AmazonBuy Now
4Arduino UnoAmazonBuy Now

Introduction 

In the late decades, there has been a quick advancement in Smart Agricultural Systems. Show that agriculture has great importance worldwide. Indeed, in India for example, about 70 % of the people rely upon the vital sector of agriculture. In the past, irrigation systems used to be dependent on the mills to irrigate the farm by conventional methods without knowing the appropriate quantities of these crops.

These old systems are a major cause of the waste of large quantities of water and thus destroy some crops because of the lack of adequate quantities of water. However, with the recent technological developments, there have been innovative systems for irrigation without the farmer interfering in the irrigation process. We will discuss it in brief below.

We will do a simulation on Proteus 8 Professional Software.

Working

The working of this project is like, we will use a Soil Moisture sensor for measuring the moisture of Soil according to which water valves are controlled. When the moisture level gets below a threshold value, valves will open with the help of a relay or solenoid till the soil is well moisturized.

  • The BMP180 sensor will measure the Atmospheric Pressure.
  • The DHT11 sensor will measure the temperature and humidity of the climate.
  • The MQ135 sensor will measure the Air Quality Index of the environment.
  • LDR will measure the sunlight intensity.
  • We will use a 20x4 LCD Screen for displaying the data gathered from the sensors.
  • And the main thing, we will use an Arduino UNO microcontroller as the brain of the project.

In a used case, when the moisture level gets below a threshold value, valves will open with the help of a relay or solenoid for a required time interval.

Block Diagram

  • Here's the Block Diagram of Smart Irrigation System:

Components Required

Here's the list of components used in this project:
  • Arduino UNO
  • BMP180 Sensor
  • DHT11 Sensor
  • LDR Sensor
  • MQ135 Gas Sensor
  • Soil Moisture Sensor
  • 20x4 LCD Display
  • PCF8574 remote 8-bit I/O expander for the I2C bus
  • Breadboard.
  • Jumper wires (Male to Male, Male to Female, Female to Male.)

Since we are designing a prototype of this project, we will use jumper wires instead of soldering.

  • Power Supply

You can use a Battery, Adapter or any DC source of 5-8v(recommendable).

Circuit Diagram

Since we are making a prototype of this project, we will make connections on the breadboard and avoid soldering the components. We will use male to male, male to female and female to female jumper wires. 

Pins Connections

These are the pin connections of all components.
Pin Connections of Smart Irrigation System
No. Sensor Pinout
1 Soil Moisture Sensor Data - A0 (Arduino)
2 LDR Sensor LDR-Resistor Junction - A2 (Arduino)
3 MQ135 Gas Sensor Out - A1 (Arduino)
4 DHT11 Sensor Data - D2 (Arduino)
5 BMP180 Pressure Sensor SDA-SDA (Arduino) SCL - SCL (Arduino)
 

Arduino Libraries Required

You need to install these third-party Arduino Libraries, in order to interface sensors:

  1. Adafruit_BMP085.h
  2. DHT.h
  3. LiquidCrystal_I2C.h

We have added comments in the code for better understanding so it can be understood easily.

Note - Change the Address of the LCD Screen while you run the code in Proteus, change it to 0x20 instead of 0x27 or anyone else. In the real experiment, we can alter the address of the LCD by changing the configurations of A0, A1 and A2 pins of the PCF8574 module.

Proteus Libraries Required

We will show you a demo of this project as a simulation. We are using Proteus 8 Professional Software for the simulation.

Proteus Simulation Connections

  • This potentiometer defines the soil water content in the proteus simulation.
  • When the resistance is maximum at the test pin, the circuit shows zero volts across the voltmeter, which means the sensor is either in the dry ground or taken out of the ground, i.e. giving zero moisture value of the water content.
  • And when resistance is zero, the circuit will show the maximum voltage across the voltmeter which indicates the sensor is inserted in a wet ground i.e. water contents in the soil are too high.
  • This is important. We have attached the output pin with an LC filter. This filter is not required in real hardware implementation.
  • We are using it in Proteus Simulation only as Proteus gives the peak-to-peak value and we have to convert that PP value into Vrms.
  • If you are working on a real sensor then you don’t need to add this LC circuit.
  • Similarly for Gas sensor, as we increase the potentiometer, in simulation it means good air quality.

Steps for Simulation

These are the steps for simulation. Follow them to create a fully working simulation.
  • Download the Zip Files given at the start of this tutorial.
  • Extract them in the LIBRARY folder. You will find it inside the Labcenter Electronics Folder.
  • Go to Arduino IDE and open the code, go to Tools and select the board Arduino UNO.
  • Go to Sketch and Click on Export Compiled Binary. It will create a compiled .hex file of the code which will be used as the main program in the simulation ahead.
  • Open Proteus software and add components by searching like Arduino, DHT11, BMP180, 20x4 LCD, etc.
You can see the components listed here.

Note - We used a simple LED instead of the valve because the valve component is not available in the Software, simply replace the LED with a valve in a real project. Make connections according to the circuit diagram and add virtual terminals to Serial pins to see the readings and Data.

  • Paste the Program File here for all the sensors.
  • Paste the Compiled Binary File as a Program file of Arduino UNO.
  • Run the simulation and you can see the readings by opening the virtual terminal.

Observations and Results

 
  1. In this simulation and project, you can see the sensor's information first in the terminal.
  2. After that, we are getting well organized and easily understood data on the terminal by every sensor according to code.
  3. According to the code, when the value of the soil moisture sensor gets less than a threshold value, the LED gets on.

This means when the soil gets dry the valve will open and water will be provided to the crops.

pH Sensor Library for Proteus

Hi guys, I hope you are good and doing well in your life. In this article, I am going to tell you about a new pH Sensor Library for Proteus. I hope you all will enjoy it and find it useful. We are all well aware of pH Sensors which are used for the detection of pH of different fluids. By knowing the pH of a liquid we can tell whether the liquid is acidic or basic. You can’t find a pH sensor in Proteus software, so we designed a pH sensor for simulation purposes. You can interface this pH Sensor with any Microcontroller, for example: Arduino, PIC Microcontroller, 8051 Microcontroller etc.

In this pH Sensor Library, I have added four different pH Sensors, which are used for the detection of the pH of any fluid. Since we can’t place real liquid and measure pH in this software, I have attached a test pin in the pH meter where you have to connect a potentiometer. The potentiometer will produce a reading from 0 to 1023, which will be mapped from 0 to 14 in the program code. We can predict the nature of the liquid. We will have a look at how to use these sensors below. So, here’s the list of all four pH sensors, I have added to this pH sensor  library:

  • PH METER
  • PH METER 2
  • PH METER 3
  • PH METER 4

So, let’s start with downloading and installing the pH Sensor Library for Proteus.

Where To Buy?
No.ComponentsDistributorLink To Buy
1LEDsAmazonBuy Now
2ResistorAmazonBuy Now
3Arduino UnoAmazonBuy Now

What is a pH Sensor?

  • A pH sensor is a device that is used to measure the pH value of a liquid. pH can be defined as the concentration of H+ ions in a liquid. We can find whether the fluid is acidic, basic or neutral by knowing the pH of the liquid.
  • Real pH sensors are shown below:

pH sensor Library for Proteus

  • First, download the zip file of Proteus Library for pH Sensor.
  • Click the link below to download the library zip file of pH Meter:
pH Sensor Library for Proteus
  • After downloading the zip file, extract its files and open the folder named “Proteus Library Files“.
  • In this folder, you will find three files, named:
    • pHMeterLibraryTEP.IDX
    • pHMeterLibraryTEP.LIB
    • pHMeterLibraryTEP.HEX
  • We have to place these files in the ‘LIBRARY’ folder of Proteus software.
  • Now, open Proteus. if you are already working on it you have to restart it.
  • In the components search box, search for “PH METER” and you will get four results, as shown in the below figure:
  • Let’s place these four pH Meter models in our Proteus workspace:

Adding Hex File to the Sensor

  • Now we need to paste the hex file of the pH METER in the properties section of the sensor. Double click on the sensor to open the properties window.
  • Go to the program file section, browse to the hex file, which we have downloaded above and placed it in the ‘LIBRARY’ folder of Proteus software:
  • After adding the hex file, click the Ok button.
  • Now all is ready, let’s create a circuit to check it's working.

pH Sensor Proteus Simulation

  • The pH sensor is now ready to simulate in Proteus, so let’s design a simple circuit to understand its working:
  • As you can see, I have placed an LC filter on the analog output of the pH sensor, it's because proteus gives us a peak to peak voltage value and we need to convert it to Vrms.
  • While performing the real experiment, you don’t need to do the above stuff.
  • Now, let’s run the Proteus simulation. You will see such a screen if everything will work fine.

Interfacing of pH sensor with Arduino UNO

  • Add Arduino UNO  and pH sensor to the components list and place them in the workspace.
  • Placed an LC filter on the analog output of the pH sensor, as mentioned above.
  • Connect it to the A0 pin of Arduino. Add a virtual terminal also to see the readings generated.
  • Paste the hex file of the program at the program file section of the Arduino.
  • Now run the simulation, if everything's fine you will get results as shown in the below figure:
  • You can watch the complete working simulation in the below video:

So, that was all for today. I hope you have enjoyed today's lecture. Thanks for reading !!!

Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir