Things used in this project

Hardware components:
DFRobot Piezo Buzzer
×1
DFRobot Super-Bright LED
×1
DFRobot Capacitive Soil Moisture Sensor
×1
Particle Photon
×1
DFRobot Micro USB Cable
×1
DFRobot Breadboard
×1
Male-Male Jumper Wire
×1

Code

AnnoyingPlant.inoArduino
//AnalogRead on particle ranges from 0 to 4095, so the values for Arduino will be different

#define THRESHOLD           3000
#define SENSOR_PIN          A0
#define LIGHT_PIN           7
#define BUZZER_PIN          6
#define TEXTING_INTERVAL    1800000 //30 minutes (1000ms * 60s * 30mins)

int buzzerOn = 0;
int thresholdMet = false;
unsigned long lastTextTime = 0;

void setup() {
    pinMode(SENSOR_PIN, INPUT);
    pinMode(LIGHT_PIN, OUTPUT);
    pinMode(BUZZER_PIN, OUTPUT);
}

void loop() {
    if (analogRead(SENSOR_PIN) > THRESHOLD) {
        thresholdMet = true;
        digitalWrite(LIGHT_PIN, HIGH);
        digitalWrite(BUZZER_PIN, HIGH);
        
        unsigned long now = millis();
        
        if (now - lastTextTime >= TEXTING_INTERVAL) {
            Particle.publish("Water Me Now!");
        }
    }
    
    else {
        thresholdMet = false;
        digitalWrite(LIGHT_PIN, LOW);
        digitalWrite(BUZZER_PIN, LOW);
    }
}

Credits

Dsc 0358 aupidjdwxg
Alex Wulff
1 project • 38 followers
I'm an 18-year-old maker from Upstate New York. I love Arduino, embedded systems, 3D printing, and iOS development. www.AlexWulff.com
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaBlog