Smart Irrigation System Using Arduino | Arduino Project

by | Jun 3, 2022 | Arduino, Coding

Introduction

In this Arduino project, we will create a Smart Irrigation System using Arduino. The concept that we will apply to make this system will be using a sensor for checking the humidity and temperature of the soil, and then water will be automatically supplied to the crops by using a motor.

 

Supplies

In order to make Smart Irrigation System using Arduino, we will require the following components:

Components

Circuit Diagram

Smart Irrigation System Using Arduino | Arduino Project

Steps To Make Smart Irrigation System Using Arduino

Step 1: Gather all the components on the Digital Board or Physical Table.

Step 2: Plug the Potentiometer, Sensor & Transistor on the BreadBoard.

Potentiometer:

Step 3: Connect the first Terminal of it to the Ground(GND) pin of the Arduino using a black colored wire thru a resistor.

Step 4: Connect the wiper terminal of it to the contrast pin of the LCD.

Step 5: Connect the third terminal of it to the 5V power supply pin of the Arduino Uno.

Transistor:

Step 6: Connect the Collector terminal of it to the 5V pin of the Arduino.

Step 7: Connect the Base Terminal of the transistor to the 13 number pin of the Arduino thru a resistor, as shown in the figure.

Step 8: Connect the Emitter terminal of the transistor to the second terminal of the DC Motor, as shown in the figure.

DC Motor:

Step 9: Connect the first terminal of it to the GND pin of the Arduino.

LEDs:

Step 10: Connect the Cathode terminal of it to the GND pin of the Arduino thru a resistor.

Step 11: Connect the Anode terminal of it to the 11 & 12 pin numbers of the Ardunio, respectively.

Sensor:

Step 12: Connect the Vs terminal of it to the 5V pin of the Arduino.

Step 13: Connect the Vout Terminal of it to the A0 number pin of the Arduino.

Step 14: Connect the GND terminal of it to the GND pin of the Arduino.

LCD:

Step 15: Connect the Ground terminal of it to the GND pin of the Arduino.

Step 16: Connect the Power terminal of it to the 5V pin of the Arduino.

Step 17: Connect the Register Select Terminal of it to the 2 number pin of the Arduino.

Step 18: Connect the Read/Write terminal of it to the GND pin of the Arduino.

Step 19: Connect the Enable Terminal of it to the 3 number pin of the Arduino.

Step 20: Connect the DB4, DB5, DB6, & DB7 Terminal of it to the 4, 5, 6, and 7 number pins of the Arduino, respectively.

Step 21: Connect the LED Cathode terminal of it to the GND pin of the Arduino thru a resistor.

Step 22: Connect the LED Anode terminal of it to the 5V pin of the Arduino.

Source Code

#include <LiquidCrystal.h>

int sensor = A0;

int motor = 13;

int ledRed = 12;

int ledGreen = 11;

LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

void setup()

{

Serial.begin(9600);

lcd.begin(16, 2);




lcd.setCursor(5,0);

lcd.print("Smart ");

lcd.setCursor(0,1);

lcd.print("IrrigationSystem");




pinMode(motor, OUTPUT);

pinMode(ledRed, OUTPUT);

pinMode(ledGreen, OUTPUT);

delay(1500);




lcd.clear();

lcd.print("Temp = ");

lcd.setCursor(0,1);

lcd.print("WaterPump = ");

}

void loop()

{

int value = analogRead(sensor);

float temperature = value * 500.0 / 1023.0;

lcd.setCursor(7,0);

lcd.print(temperature);

lcd.setCursor(11,1);

if(temperature > 40)

{

digitalWrite(motor, HIGH);

digitalWrite(ledRed, HIGH);

digitalWrite(ledGreen, LOW);

lcd.print(" ON ");

}

else

{

digitalWrite(motor, LOW);

digitalWrite(ledRed, LOW);

digitalWrite(ledGreen, HIGH);

lcd.print(" OFF");

}




delay(1000);

}

Explanation of the Code

1. In the beginning, we used a liquid crystal library for LCD operations.

2. Then, we have initialized some variables w.r.t. the pin numbers of the Arduino to which the components are connected.

3. In the setup function, we are beginning the serial connection with 9600 bits per second speed and printing some text in the LCD using the setcursor() function.

4. After this, we have configured the pin mode for output purposes.

5. In the loop function, we are reading the sensor’s value and storing it in a variable named value.

6. Then, we are calculating and printing the temperature in degrees centigrade.

7. At last, we are using an if-else statement, which will glow the respective LED and provide HIGH or LOW power to the motor as per the temperature specified.

Output

On the successful completion of this  Arduino project on a smart irrigation system, we will get the following output.

Smart Irrigation System Using Arduino - Arduino Project

On giving power to the Arduino, the sensor will check the temperature, and accordingly, it will turn on or off the motor by which the water will be supplied automatically.

 

You May Also Like To Create…

0 Comments

Submit a Comment

Your email address will not be published.