Gabe MartinezArmias AdhanomJavier Pevida
Published

Plant Moisture Notifier

This IOT project reminds the owner when their plant needs watering.

IntermediateFull instructions provided708
Plant Moisture Notifier

Things used in this project

Hardware components

Buzzer, Piezo
Buzzer, Piezo
×1
SparkFun Soil Moisture Sensor (with Screw Terminals)
SparkFun Soil Moisture Sensor (with Screw Terminals)
×2
Jumper wires (generic)
Jumper wires (generic)
×1
Argon
Particle Argon
×3
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
Google Sheets
Google Sheets

Story

Read more

Schematics

Argon connected to Moisture sensor

This particle is connected to the moisture sensor and it is used to get data and to power the sensor. The other Argon serves the same purpose.

Argon connected to Buzzer

This Argon communicates with the other Argons and triggers the buzzer when the moisture level is low.

Code

Left Plant Moisture Detect

Arduino
int detectPin = D2;
    int plant = 0; //Water is dry at 0
    int detectVal = 0; //Pin read
    
    void setup() {
        
        pinMode(detectPin, INPUT);
    Particle.variable("plant", &plant, INT);
        Particle.variable("detectVal", &detectVal, INT);
        
    }
    
    void loop(){
        detectVal = digitalRead(detectPin); //Check Pin
        if (detectVal == 1){
            
            Particle.publish("Plant_Left","Watered");
            delay(2000);
        }
        
            else if (detectVal == 0)  {
                
                Particle.publish("Plant_Left","Needs_Water");
            
            delay(2000);    
            }
    }

Right Plant Moisture Detect

Arduino
int detectPins = D2;
    int plants = 0; //Water is dry at 0
    int detectVals = 0; //Pin read
    
    void setup() {
        
        pinMode(detectPins, INPUT);
    Particle.variable("plants", &plants, INT);
        Particle.variable("detectVals", &detectVals, INT);
        
    }
    
    void loop(){
        detectVals = digitalRead(detectPins); //Check Pin
        if (detectVals == 1){
            
            Particle.publish("Plant_Right","Watered");
            delay(2000);
        }
        
            else if (detectVals == 0)  {
                
                Particle.publish("Plant_Right","Needs_Water");
            
            delay(2000);    
            }
    }

Buzzer

Arduino
void setup()
{                
    pinMode(D2, OUTPUT);  // buzzer on pin D2
    Particle.subscribe("Plant_Left",myHandler);
     Particle.subscribe("Plant_Right",myHandler);
}

void myHandler(const char *event, const char *data)
{
    if (strcmp(data,"Needs_Water")==0)
    {
        digitalWrite(D2,HIGH);delay(2000);digitalWrite(D2,LOW);delay(2000);
digitalWrite(D2,HIGH);delay(2000);digitalWrite(D2,LOW);delay(2000);
digitalWrite(D2,HIGH);delay(2000);digitalWrite(D2,LOW);delay(2000);
digitalWrite(D2,HIGH);delay(2000);digitalWrite(D2,LOW);delay(2000);
digitalWrite(D2,HIGH);delay(2000);digitalWrite(D2,LOW);delay(2000);
digitalWrite(D2,HIGH);delay(2000);digitalWrite(D2,LOW);delay(2000);
digitalWrite(D2,HIGH);delay(2000);digitalWrite(D2,LOW);delay(2000);
     
    }
    
    else
    {
    delay(100);
    }
}

Credits

Gabe Martinez

Gabe Martinez

1 project • 0 followers
Armias Adhanom

Armias Adhanom

1 project • 0 followers
Javier Pevida

Javier Pevida

1 project • 0 followers

Comments