Yoosuf Razook
Published

Soil moisture sensor

Made up with soil moisture sensor when the soil is too dry, the sensor detects it and the buzzer beeps

BeginnerFull instructions provided30 minutes12
Soil moisture sensor

Things used in this project

Story

Read more

Custom parts and enclosures

custom part

custom part if u want to use it, if not please do not consider this as a mandatory part

Schematics

soil moisture sensor project diagram

follow the instructions that is given the diagram and if it doesnt work please DM me

Code

code for the plant care project

Arduino
it is the code for the project if tere is any bugs please tell me ill fix it
}

void loop() {
  // Read the changing voltage from the soil sensor (0 to 1023)
  int soilValue = analogRead(soilPin);
  
  // Print raw value to screen so you can see your dirt's status
  Serial.print("Soil Moisture Value: ");
  Serial.println(soilValue);

  // -----------------------------------------------------------------
  // CONDITION: Soil is too dry (Value is ABOVE the threshold limit)
  // -----------------------------------------------------------------
  if (soilValue > dryThreshold) {
    Serial.println("[!!!] ALERT: SOIL IS BONE DRY! PLANT NEEDS WATER!");
    
    // Play a rhythmic, pulsing "Water Me!" distress chime
    digitalWrite(alarmLed, HIGH);
    tone(buzzerPin, 1000); // Low-mid pleading frequency
    delay(200);
    
    digitalWrite(alarmLed, LOW);
    noTone(buzzerPin);
    delay(800); // 1-second interval loop so it doesn't drive you crazy
  } 
  
  // -----------------------------------------------------------------
  // CONDITION: Soil is hydrated and healthy (Value is LOW)
  // -----------------------------------------------------------------
  else {
    noTone(buzzerPin);
    digitalWrite(alarmLed, LOW);
    delay(1000); // Check once per second when healthy to save battery
  }
}

Credits

Yoosuf Razook
1 project • 0 followers
just a arduino project builder nothing special

Comments