SoilSMS 2.0

Rice and corn yield potential has been slowly decreasing in the Philippines and other neighbouring countries in the past couple of years due to climate change.

actually-anytime-someone-tells-you-not-to-worry-about-population-growth-show-them-this-chart

 

 

According to the study made by the USDA, decrease in yield is largely due to the El Nino phenomenon, that because the sudden increase in temperature caused by El Nino is unpredictable, it is harder for farmers to plan out water irrigation and timing.

chart-5

 

Since timing is crucial, water irrigation management is something I would like to address for my final project for Towers of Powers.

What if I could create a prototype of a module that can detect when soil moisture is low and immediately SMS the farmer when timing is critical. The farmer can then send an SMS back to the module and the module will begin the irrigation process?

356277-el

Project Description

PlantSMS 2.0 is a module for crops and other plants that will send an SMS the user once the crop/plant needs to be watered. The user can also respond with an SMS, anywhere he or she may be, and PlantSMS 2.0 will automatically water the crop/plant for him.

Documentation for PlantSMS 1.0 can be found here.

Material List

IMG_2185

How it Works

Alert System (Documentation can be found here.)

  • Plug in the DC power supply and wait for the GSM module to boot up.
  • Insert the Moisture Sensor halfway into the soil.
  • When the plant needs to be watered, you will receive an SMS in your mobile phone.
  • The red LED will also light up indicating that the plant needs to be watered.

Watering

  • Fill the bottle with water and attach it to the Orbit Watering Module
  • Send an SMS to the GSM module’s number.
  • The Red LED will blink to indicate that the messaged has been received.
  • The Watering Module will start watering the plant.
  • Once the Moisture Sensor detects that enough water has been dispensed, the Red LED will stop blinking and the Watering Module will stop dispensing water.

System Diagram

SoilSMS System Diagram

 Hacking in to the Orbit

Here’s how I hacked the Orbit:

  • I opened the Orbit and saw that the gate where the water flows is controlled by a ground and a power wire (thankfully marked accordingly) powered by 2x AA batteries.
  • At first, I tried using the Arduino to control the gate (see below) but either I browned out the Arduino or I’m not getting enough charge to power the gate.

IMG_2107

 

  • I then tried to use a transistor to try to control the ground while giving the module it’s own power source (the 2x AA batteries.
  • Below is the system diagram:

TIPIMG_2181

Here’s a video of how the Arduino controls the gate:

Code:

//Soil SMS 02.11.15 (3:55am)
#include <GSM.h>
#define PINNUMBER “”

GSM gsmAccess;
GSM_SMS sms;

char remoteNumber[20] = “+19172947596”;
char txtMsg[200] = “Please Water Me!”;
char senderNumber[20];

int ledPin = 12;
int soilSensor = A0;
int val = 0;
int inByte;
int pour = 9;

void setup() {
Serial.begin(9600);
pinMode (7,INPUT);
pinMode(ledPin, OUTPUT);
pinMode(pour, OUTPUT);

Serial.println(“SoilSMS 2.0”);

// connection state
boolean notConnected = true;
// Start GSM connection
while(notConnected)
{
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
{
notConnected = false;
}
else
{
Serial.println(“Not connected”);
delay(1000);
}
}
Serial.println(“GSM initialized”);
}

void loop() {

if (Serial.available () > 0){
inByte = Serial.read ();
}

if (analogRead(soilSensor) > 900) {
Serial.println(analogRead(soilSensor));
sendSMS();
Serial.println(“sent”);
delay(20000);
}

char c;

if (sms.available()) {
Serial.println(“Message received from:”);
sms.remoteNumber(senderNumber, 20);
Serial.println(senderNumber);
lightUp();
waterPlant();
while(c=sms.read())
Serial.print(c);
Serial.println(“\nEND OF MESSAGE”);
sms.flush();
lightR();
}

if (analogRead(soilSensor) < 900){
lightR2();
}

}

void lightUp () {
digitalWrite(ledPin, HIGH);
//Serial.println(“light”);
delay(1000);
digitalWrite(ledPin, LOW);
//Serial.println(“off”);
delay(1000);
digitalWrite(ledPin, HIGH);
//Serial.println(“light”);
delay(1000);
digitalWrite(ledPin, LOW);
//Serial.println(“off”);
delay(1000);
digitalWrite(ledPin, HIGH);
//Serial.println(“light”);
delay(1000);
digitalWrite(ledPin, LOW);
//Serial.println(“off”);
delay(1000);
digitalWrite(ledPin, HIGH);
//Serial.println(“light”);
delay(1000);
digitalWrite(ledPin, LOW);
//Serial.println(“off”);
delay(1000);
}

void sendSMS(){

Serial.print(“Message to mobile number: “);
Serial.println(remoteNumber);

// sms text
Serial.println(“SENDING”);
Serial.println();
Serial.println(“Message:”);
Serial.println(txtMsg);

// send the message
sms.beginSMS(remoteNumber);
sms.print(txtMsg);
sms.endSMS();
Serial.println(“\nCOMPLETE!\n”);
}
void waterPlant() {
digitalWrite(pour, HIGH);
delay (1000);
digitalWrite(pour, LOW);
}
void lightR () {
digitalWrite(ledPin, HIGH);

}

void lightR2 () {
digitalWrite(ledPin, LOW);
}

Leave a Reply

Your email address will not be published. Required fields are marked *