Hackster is hosting Hackster Holidays, Ep. 4: Livestream & Giveaway Drawing. Start streaming on Wednesday!Stream Hackster Holidays, Ep. 4 on Wednesday!
lakshyajhalani56
Published

Smart Irrigation | Soil Moisture Sensor Arduino | Water Pump

Here, We learn How to make a Smart Irrigation System in which Arduino can sense the moisture in soil and watering it accordingly.

IntermediateFull instructions provided25,628
Smart Irrigation | Soil Moisture Sensor Arduino | Water Pump

Things used in this project

Story

Read more

Schematics

Look

Code

Smart Irrigation Code

C Header File
//Welcome
//Electronics University

int relayPin = 8;
int sensor_pin = A0; // Soil Sensor input at Analog PIN A0
int output_value ;
void setup()         // put your setup code here, to run once:
{ 
  Serial.begin(9600);                 
  pinMode(relayPin, OUTPUT);
  pinMode(sensor_pin, INPUT);
  Serial.println("Reading From the Sensor ...");
  delay(2000);
}

void loop()
{
 output_value= analogRead(sensor_pin);
 output_value = map(output_value,550,10,0,100);
 Serial.print("Mositure : ");
 Serial.print(output_value);
 Serial.println("%");
 if(output_value<20){
  digitalWrite(relayPin, LOW);
 }
 else
 {
  digitalWrite(relayPin, HIGH);       
 }
 delay(1000);
}

Credits

lakshyajhalani56

lakshyajhalani56

9 projects • 13 followers

Comments