Stamatia Stefanopoulou
Published © GPL3+

To Water, or not to Water??

This sensor will send out email notifications every time your plants need water.

IntermediateFull instructions provided2,656
To Water, or not to Water??

Things used in this project

Hardware components

SparkFun Soil Moisture Sensor (with Screw Terminals)
SparkFun Soil Moisture Sensor (with Screw Terminals)
×1
Photon
Particle Photon
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Screw Terminals 3.5mm Pitch (3-Pin)
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Resistor 221 ohm
Resistor 221 ohm
×1
LED (generic)
LED (generic)
×3

Software apps and online services

IFTTT Particle

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Code

Soil Moisture Sensor

Arduino
Checks the soil moisture of your plants every hour.
//SOIL MOISTURE SENSOR


//Initialize variables and set photon pins

int thresholdUp = 3000; 

int thresholdDown = 350;

int sensorPin = A0;

int LEDs = D0;

int sensorVoltage = A5;



//Set input and outputs, subscribe

void setup(){

 pinMode(sensorPin, INPUT);

 pinMode(LEDs, OUTPUT);

 pinMode(sensorVoltage, OUTPUT);

 Particle.subscribe ("Stefanopoulou453Sensor",sensor);

 digitalWrite(sensorVoltage, HIGH);

    }


// Sensor Readings

void loop()

{

  int sensorValue;

  sensorValue = analogRead(sensorPin);

    if (sensorValue <= thresholdDown){

    digitalWrite(LEDs, HIGH);

    Particle.publish("SoilStatus","Dry! Water me!!",60,PUBLIC);

    delay(5000);

     }

 else if (sensorValue > thresholdUp){

    digitalWrite(LEDs, LOW);

    Particle.publish("SoilStatus", "Too much water!",60,PUBLIC);

     } 

  else {

    digitalWrite(LEDs, LOW);

    Particle.publish("SoilStatus", "No Water Needed!",60, PUBLIC);

  }


  delay(3600000); //checks every hour.

}

}

Credits

Stamatia Stefanopoulou

Stamatia Stefanopoulou

1 project • 1 follower
UNCC Mechanical Engineering

Comments