Agriculture Water – Ali Rostam and Suleyman Akbulut

Over watering of agricultural fields is a problem that is happening all around the world. Globally agriculture usage of water takes up around 70 % of the worlds accessible fresh water. And with this countries are starting to reach there renewable water resource limits. This mainly comes down to poor watering systems and wrong methods of watering. A lot of it is as well as crops are being over watered. This is just not a waste of water it can also cause damage to plants. If watered too much plants can drown or salt crystals can form on the surface of the soil which can cause harm to the plants and makes it hard for the ground to be fertile.

Image result for over watering of agriculture fields

The aim of our project is to prevent the over watering of the large agricultural fields. We wanted to design a product that could control how much water the plants get and that they only get the amount they need. No more no less! To achieve this we developed an arduino system with a soil moisture sensor and a solenoid valve which are connected to each other. The filed will have sensors at regular intervals through out the field, which will send the readings of the moisture in the soil to the arduino micro controller. Through the micro controller solenoid valve receives the soil moisture readings. If there is not enough moisture in the soil then the solenoid will release water until the moisture sensor reads that the plant has enough water. The solenoid will release the water for set times until there is enough moisture in the soil for the plant.


Step 1 Moisture Sensor


The first thing we did was set up the moisture sensor and to test. We tested the sensor so we could make sure we were getting the correct readings of the soil and that we knew what values the soil would be for which state it was in. The way we tested the Moisture sensor was by setting up in different soils which all had different moister levels in it. After we had the results we would then use them in the code.

Step 2 Solenoid valve

SparkFun Hardware Solenoid Valve 12V  - 3/4"

The next thing was setting up the solenoid valve to work when the moister sensor read that the soil needs more water. So from the results we got from the moisture sensor we set up the code on the arduino to have thresh holds that would make the solenoid valve turn on when there is not enough water in the soil.

Step 3 Setting up the LED’s

Moisture Level Measurement


After we got the moister sensor and the solenoid working we looked into ways of showing the moisture from the circuit. So we set up a LED bar graph that indicates how much moisture the soil has. There are 5 LED’s one if all five are on then the plant has the perfect amount of water. If none are on then the moister level is too low and the solenoid will turn on to allow water to flow to the crops.

After this we then set up the code. We took the values we got from the moister sensor and implemented them into the code. We had to set up the code that the moisture senor would control when the solenoid valve would turn on and turn off. And for the LED’s to show what the moister levels are.


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(rainPin, INPUT);

pinMode(7, OUTPUT);// connected to S terminal of Relay;

void loop() {
// read the input on analog pin 0:
sensorValue = analogRead(rainPin);
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;

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++){



We set up the curcuit of the board to the correct way. fritzing chart-APRIL 19

Because we needed a 12v power supply for the solenoid valve but we wanted to control it with the arduino which only runs at 5v we had to use a relay. The relay allows the switch between the power supplies with out over loading the board.

Flow Chart Capture A18

We set up the circuit and and code and tested to see if the model would work.

Are aim for this project was to lower the amount of water wasted in agricultural fields and try and make them as sustainable as possible. We have tried to do this by monitoring how much water is in the soil and when it needs to be watered and when it does not. We have done this by using a moisture sensor to read the moisture in the soil and a solenoid valve to control when to release the water to the plants.

With the model we made there was a couple of restrictions. the solenoid valve we used needs a mains water supply or a water supply with pressure behind it to push the water through. And because for are mini model we used a water bottle that the  pressure was gravity fed, there was not enough pressure to push a lot of water through at once and it only dribbled out slowly. This model is designed for a large scale design. So we designed it that it would be used with a mains water supply behind it to give more pressure.

By having this product it would help with the over watering problem as it would only water the plants when they need to be watered and not until then. There would be no over watering and would save a lot of time, money and water that is getting more and more reserved.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s