Final Design for Sustainability Project

The Project;

The aim of this project is to prevent the  over watering of the large agricultural fields. To achieve this we developed an Arduino system with soil moisture sensor and solenoid valve which are connected to each other. The agricultural field has sensors at regular intervals throughout the field which send the soil moisture data to the Arduino microcontroller. Through the microcontroller solenoid valve receives the soil soil moisture  data  and releases enough water to replenish the moisture in soil for a set of time. This process continues until the soil have enough water for the crop.

We strongly believe this system will help to reduce the over watering of crops and therefore save water and produce higher, healthier yield.

These improvements to water usage will lead to greater Sustainability.

Coding of the Project;

int rainPin = A0;
int solenoid = 7;
int sensorValue;
// you can adjust the threshold value
int thresholdValue = 1050;
int thresholdValue1 = 1000;
int thresholdValue2 = 850;
int thresholdValue3 = 700;
int thresholdValue4 = 550;
int thresholdValue5 = 400;

void setup() {
for(int i=2; i<=6; i++){ // sets up LEDs from pin 2 to pin 6
pinMode(i,OUTPUT);
}
pinMode(rainPin, INPUT);

pinMode(7, OUTPUT);// connected to S terminal of Relay;
Serial.begin(9600);
}

void loop() {
// read the input on analog pin 0:
sensorValue = analogRead(rainPin);
Serial.println(sensorValue);
checkMoisture(thresholdValue, LOW, 2, 6);
checkMoisture(thresholdValue1, HIGH, 2, 2); //checks moisture(your threshold value, LED HIGH or LOW, starting LED pin, ending LED pin)
checkMoisture(thresholdValue1, LOW, 3, 6);
checkMoisture(thresholdValue2, HIGH, 2, 3);
checkMoisture(thresholdValue2, LOW , 4, 6);
checkMoisture(thresholdValue3, HIGH, 2, 4);
checkMoisture(thresholdValue3, LOW, 5, 6);
checkMoisture(thresholdValue4, HIGH, 2, 5);
checkMoisture(thresholdValue4, LOW, 6, 6);
checkMoisture(thresholdValue5, HIGH, 2, 6);

if(sensorValue < thresholdValue){
digitalWrite(7,HIGH);// turn relay ON;
}
else {
digitalWrite(7, LOW);// turn relay OFF;
}
delay(2000);
}

void checkMoisture(int threshold, bool ledLevel, int startingPin, int endingPin) { //checks moisture(your threshold value, LED HIGH or LOW, starting LED pin, ending LED pin)
if(sensorValue < threshold) {
for (startingPin; startingPin<=endingPin; startingPin++){
digitalWrite(startingPin,ledLevel);
}
}

}

Fritzing Chart of The Project

 

fritzing chart-APRIL 19

 

Photos of the Project;

 

Moisture Level Measurement

 

portfol-1

Solenoid System

Sensor-Soil Moisture

Tab-Solenoid

Water Tank

Video of the Project; Testing the Solenoid Valve

Testing of the solenoid Valve

 

Testing of the system