Kim T.Brian
Published

Plant Monitor & WaterBomb

Simple way to monitor your plant's Moisture Levels and water from afar.

BeginnerFull instructions provided2 hours1,763
Plant Monitor & WaterBomb

Things used in this project

Story

Read more

Schematics

Photon Connected to Moisture Sensor

This is the schematic for the photon that is reading data from the moisture sensor.

Photon Connected to Servo

This is the schematic for the photon that is connected to the servo, which pops the balloon when the command #Detonate is sent via text to the IFTTT applet

Code

SoilStatus

C/C++
This code is for the Moisture level tracker.
//Team SoilStatus -- K. Thach & B. Padgett
//Code to monitor soilstatus using Analog moisture counts from a Soil Moisture Stick.

//------------------------------
int thresholdup=6000;   //Count Threshold 
int thresholddown=350;  
const int sensorPin = A0;
int sensorValue=0;


void setup() 
{
  // put your setup code here, to run once:
pinMode(sensorPin, INPUT);

}

void loop()

{  // put your main code here, to run repeatedly:
int sensorValue;
sensorValue = analogRead(sensorPin);
if(sensorValue<=thresholddown)
{

Particle.publish("SoilStatus","DRY!",60,PUBLIC);
delay(5000);
}
else if (sensorValue>thresholdup)
{

  Particle.publish("SoilStatus","Swimming!",60,PUBLIC);
}
else
{
  Particle.publish("SoilStatus","OK!",60,PUBLIC);
}
delay(30000); //Checks every 5 minutes
Particle.publish("SoilStatus", String(sensorValue), 60, PUBLIC);

}

Servo

C/C++
This code works with IFTTT to move the servo arm.
//Team Soil Status
Servo myservo;  // create servo object to control a servo
int pos = 0;   // variable to store the servo position


void setup()
{
  myservo.attach(D0); 
  Particle.function("WaterBomb", WaterBomb);
  pinMode(D7, OUTPUT); 

}
void loop()
{
}
int WaterBomb(String command)
{
  if(command=="#Detonate")
  {
    myservo.write(0);
    digitalWrite(D7, HIGH);
    delay(100);
    myservo.write(45);      //Posiiton [degrees]
    digitalWrite(D7, LOW);
    Particle.publish("SoilStatus", "WaterBombed",60,PUBLIC);
        delay(1000);
    return 1;
  }
  else return -1;
}

Credits

Kim T.

Kim T.

1 project • 0 followers
Mechanical Engineering Student
Brian

Brian

1 project • 0 followers
UNCC Mechanical Engineering Student

Comments