Smart Irrigation System Using Arduino | Arduino Project

by | Jun 3, 2022 | Arduino, Basic Coding, Coding

Home » Coding » Smart Irrigation System Using Arduino | Arduino Project

Introduction

Do you want to save water and keep your garden or crops healthy and thriving? Building a smart irrigation system using Arduino might be the solution you’ve been looking for! By combining the power of electronics and programming, you can create an automated irrigation system that waters your plants only when they need it, based on weather conditions, soil moisture levels, and other factors.

This project is not only practical but also fun and educational, offering a great opportunity to learn about the basics of electronics, sensors, and microcontrollers. With just a few components and some basic coding skills, you can build a smart irrigation system that will make your gardening life easier and more sustainable.

The concept that we will apply to build this smart irrigation system will be to use 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. So let’s get started and learn how to build a smart irrigation system using Arduino!

 

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 into 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. Initially, we used a liquid crystal library for LCD operations.

2. Then, we 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 calculate and print 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.

 

More Arduino Projects>>>

You May Also Like To Create…

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *