millerman4487
Published © CC BY-NC-SA

DIY Plant Moisture Sensor

This project will calculate the water content of soil around a plant by measuring the dielectric constant.

IntermediateFull instructions provided30 minutes35,856
DIY Plant Moisture Sensor

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Resistor 221 ohm
Resistor 221 ohm
×3
Resistor 10k ohm
Resistor 10k ohm
×1
RGB Diffused Common Anode
RGB Diffused Common Anode
×1
Nuts and Bolts
×2
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×1
Male/Male Jumper Wires
×8

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Schematic 1

Schematic 2

Code

Code snippet #1

Plain text
int moistPin = 0;
int moistVal = 0;
int tooDry = 150; //set low parameter for plant
int tooWet = 400; //set high parameter for plant
void setup()
{
  Serial.begin(9600);
}
void loop()
{
  moistVal = analogRead(moistPin);
  Serial.println(moistVal);
  int percent = 2.718282 * 2.718282 * (.008985 * moistVal + 0.207762); //calculate percent for probes about 1 - 1.5 inches apart
  Serial.print(percent);
  Serial.println("% Moisture ");
  if (moistVal <= tooDry) {
    digitalWrite(4, HIGH); //Red LED
    digitalWrite(3, LOW);
    digitalWrite(2, LOW);
  }
  else if (moistVal >= tooWet) {
    digitalWrite(4, LOW);
    digitalWrite(3, HIGH); //Blue LED
    digitalWrite(2, LOW);
  }
  else {
    digitalWrite(4, LOW);
    digitalWrite(3, LOW);
    digitalWrite(2, HIGH); //Green LED
  }
  delay(250);
}

Credits

millerman4487

millerman4487

10 projects • 82 followers

Comments