Alex Wulff
Published © CC BY-NC-SA

Annoying Soil Moisture Sensor with Photon and IFTTT

Never forget to water your plants again with this extraordinarily annoying soil moisture monitor.

EasyFull instructions provided1 hour2,033
Annoying Soil Moisture Sensor with Photon and IFTTT

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

Story

Read more

Code

AnnoyingPlant.ino

Arduino
//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

Alex Wulff

Alex Wulff

2 projects • 48 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

Comments

Add projectSign up / Login