Santosh Ambekar
Published © Apache-2.0

IoT- Plant Irrigation System

Build your own automatic IoT plant irrigation system with soil sensor, Particle Photon, relay and immersible water motor.

BeginnerFull instructions provided30 minutes6,945
IoT- Plant Irrigation System

Things used in this project

Hardware components

Photon
Particle Photon
×1
5V relay
×1
Soil Moisture Sensor
×1
Immersive water motor
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
10 Pc. Jumper Wire Kit, 5 cm Long
10 Pc. Jumper Wire Kit, 5 cm Long

Story

Read more

Schematics

Schematic

Code

Source code for Plant irrigation system

Arduino
#define WetSoilValue        3200
#define SensorPin           A0
#define MotorPin            7
#define PublishInterval     5000

int WetSoilValueReached = false;
unsigned long LastTextTime = 0;

void setup() {
    pinMode(SensorPin, INPUT);
    pinMode(MotorPin, OUTPUT);
}

void loop() {
    if(analogRead(SensorPin) < WetSoilValue){
        WetSoilValueReached = true;
        digitalWrite(MotorPin, LOW);
        
        unsigned long now = millis();
        
        if (now - LastTextTime >= PublishInterval) { 
            Particle.publish("Soil moisture low, turning on sprinklers!");
        }
    }else{
        WetSoilValueReached = false;
        digitalWrite(MotorPin, HIGH);
    }
    delay(5000);
}

Credits

Santosh Ambekar

Santosh Ambekar

11 projects • 19 followers
Santosh is an IoT enthusiastic and expert in the field of automation and software development.

Comments