Angela Martinanna nguruMeriam Hourani
Published © GPL3+

MEGR 3171 Plant Moisture Sensor

If you have owned/ own plants, you know its hard to keep them alive. The plant moisture sensor is here to help.

IntermediateFull instructions provided770
MEGR 3171 Plant Moisture Sensor

Things used in this project

Hardware components

Breadboard (generic)
Breadboard (generic)
×2
Argon
Particle Argon
×3
3-9 v power supply
×1
SparkFun Soil Moisture Sensor (with Screw Terminals)
SparkFun Soil Moisture Sensor (with Screw Terminals)
×2

Software apps and online services

ThingSpeak API
ThingSpeak API
Particle Build Web IDE
Particle Build Web IDE

Hand tools and fabrication machines

Premium Female/Male Extension Jumper Wires, 40 x 6" (150mm)
Premium Female/Male Extension Jumper Wires, 40 x 6" (150mm)
Breadboard, 170 Pin
Breadboard, 170 Pin

Story

Read more

Schematics

circuit diagram

The circuit is built similar to the one the page that inspired this project.

Code

Main code

C/C++
This code send data to the particles one and two.
void argontwo(const char *event, const char *data){
    
    Particle.publish("plantStatus_percentage_two", "gotit", PRIVATE);
    delay(500);
    Particle.publish("moisture", data, PRIVATE);
    delay(500);
    
}
    
void argonone(const char *event, const char *data){
    
    Particle.publish("plantStatus_percentage_one", "gotit", PRIVATE);
    delay(500);
    Particle.publish("moisture", data, PRIVATE);
    delay(500);
    
}

void setup() {
}

void loop() {

    Particle.subscribe("plantStatus_percentage_two", argontwo, MY_DEVICES);
    
    Particle.subscribe("plantStatus_percentage_one", argonone, MY_DEVICES);

}

Particle one and two code

C/C++
This code collects data every 5 seconds to the cloud. Which will graphed data to the cloud.
void res(const char *event, const char *data){

    if (strcmp(data, "gotit")==0){
        digitalWrite(D7, HIGH);
        delay(500);
        digitalWrite(D7,LOW);
        delay(500);
    }
    
}

int moisture_pin = A1;

void setup() {

    pinMode(D7, OUTPUT); 
    pinMode(moisture_pin, INPUT);  
    
}

void loop() {
    
    int moisture_analog = analogRead(moisture_pin); 

    float moisture_percentage = (100 - ((moisture_analog/4095.00) * 100));

    Particle.publish("plantStatus_percentage_one", String(moisture_percentage), PRIVATE);
    delay(2000);
    Particle.subscribe("plantStatus_percentage_one", res, MY_DEVICES);

}

Credits

Angela Martin

Angela Martin

1 project • 0 followers
anna nguru

anna nguru

1 project • 0 followers
Meriam Hourani

Meriam Hourani

1 project • 0 followers
Thanks to nick engmann.

Comments