Intern Project: Smart Plant Watering System

Smart Plant Watering System

Automated system that monitors the soil moisture level around a plant and waters it when the soil becomes too dry. So, it aims to provide an efficient way to ensure that plants receive the right amount of water, helping to maintain their health and vitality.

The Problem

Plants are living things, and just like us, they require a consistent and suitable amount of water to flourish. However, keeping track of their water needs can be tricky. Sometimes, they end up not getting enough water, which is called under-watering, or they receive too much water, known as over-watering. These irregularities can happen due to various reasons, such as sudden changes in the weather or the simple fact that people might forget to water them regularly.

 

The Idea

The project’s concept involves executing a code on the Shabakah board to establish connections between the tools. This connection setup serves the purpose of detecting whether the plant requires watering (if it’s dry), prompting the pump to activate, or if the plant has sufficient moisture (if it’s wet), causing the pump to deactivate.

 

Tools Needed

In our project, we used a Shabaka board, a breadboard, a water pump, a moisture sensor, an LED traffic light, and a transistor.

The Shabakah board serves as the central processing unit, facilitating the communication and coordination between all the connected components. The breadboard acted as a convenient platform for connecting and organizing the various electrical connections required for the system. The moisture sensor informs us whether the plant is in need of water when it’s dry, or if it’s already wet and doesn’t require any watering. The LED traffic light represents the plant’s moisture status by turning green when it’s wet, red when it’s dry, and yellow when it’s in a state between dry and wet. The water pump move the water from the glass to the plant when it is dry. We have a difficulty in keeping the water pump running using power directly from the shabakah board. The problem is that the amount of current from this pin is not strong enough to make the pump work. To solve this, we need to use a transistor to increase the current and make it work.

Each of these components played a role in creating a system designed to manage and control the distribution of water based on the moisture levels detected by the sensor.

The moisture sensor is connected to both pin 4 and pin 7. Pin 4 is designated for sensing serial monitoring, while pin 7 serves as the power control pin. The three LED’s are connected to the analog pins 0, 1, and 2. The water pump is connected to the ground, and by utilizing the transistor, the water pump is connected to the collector, with the base connected to 5V, and the emitter connected to pin 9.

This picture illustrates how everything is connected:

In summary, here’s what you’ll need:

  • Shabakah board
  • Breadboard
  • LED (Traffic light) 
  • Transistor
  • Moisture sensor
  • Water pump
  • Wire Jumper
  • Plant

The Code

				
					/**
* @file Smart_plant_watering_system.ino
* @author Alia Almehisni, Remal IoT
* @date 14 august 2023
*
* @brief The provided code is for a simple smart plant watering system. It uses a Shabakah board,
  a Moisture sensor,a Water pump, a Breadboard, an LED Traffic light, and a Transistor.
  
  Here's what it does: It runs a program on the Shabakah board to connect these parts together. This
  setup helps figure out if the plant needs water. If the soil is dry, a Red LED turns on, and the pump
  starts to water the plant. If the soil is already wet enough, a Green LED turns on, and the pump stops.
*
*
* The provided code is based on this reference link: 
* Reference: [https://www.sciencebuddies.org/science-fair-projects/project-ideas/PlantBio_p055/plant-biology/arduino-automatic-plant-watering]
*
*
*/

// Smart Plant Watering System code

// declare variables for pins
const int sensorpin = 4; 
const int sensorpower = 7;
const int waterpumppin = 9;
const int LED1 = 2; //Red, Analog pins
const int LED2 = 1; //Yellow, Analog pins
const int LED3 = 0; //Green, Analog pins

// variable for sensor reading
int sensor;

// delay time between sensor readings (milliseconds)
// this helps prevent the sensor from corroding by
// not leaving it powered on all the time
const int delayTime = 1000; 

// "wet" and "dry" thresholds - these require calibration
int wetsoil = 1500;
int drysoil = 500;

void setup(){ // code that only runs once
  // set pins as outputs
  pinMode(LED1,OUTPUT);
  pinMode(LED2,OUTPUT);
  pinMode(LED3,OUTPUT);
  pinMode(sensorpower,OUTPUT);
  pinMode(waterpumppin,OUTPUT);
  digitalWrite(waterpumppin,LOW);

  
  // initialize serial communication
  Serial.begin(9600);
}

void loop(){ // code that loops forever
  // power on sensor and wait briefly
  digitalWrite(sensorpower,HIGH);
  delay(1000);
  // take reading from sensor
  sensor = analogRead(sensorpin);
  // turn sensor off to help prevent corrosion
  digitalWrite(sensorpower,LOW);
  
  Serial.print("Soil Moisture = "); //get soil moisture value from the function below and print it
  // print sensor reading
  Serial.println(sensor);
  
  // If sensor reading is greater than "wet" threshold,turn on the green LED and deactivate the water pump.
  // If it is less than the "dry" threshold, turn on the red LED and activate the water pump. If it is in between
  // the two values, turn on the yellow LED and deactivate the waterpump.
  if(sensor>wetsoil){
    digitalWrite(LED1,LOW);
    digitalWrite(LED2,LOW);
    digitalWrite(LED3,HIGH);
    digitalWrite(waterpumppin,LOW);
  }
  else if(sensor<drysoil){
    digitalWrite(LED1,HIGH);
    digitalWrite(LED2,LOW);
    digitalWrite(LED3,LOW);
    digitalWrite(waterpumppin,HIGH);
  }
  else{
    digitalWrite(LED1,LOW);
    digitalWrite(LED2,HIGH);
    digitalWrite(LED3,LOW);
    digitalWrite(waterpumppin,LOW);
  }
  
  // wait before taking next reading
  delay(1000);
}
				
			

Results:

The Plant is dry

The picture on the left shows a wet plant that doesn’t need water because the moisture sensor reading is 1500 or higher, as coded. On the right, the picture shows a dry plant that needs water because the moisture sensor reading is less than 500, as coded.

Video Showcase

Here’s a video that demonstrates the project:

Conclusion

This project has shown how we can use technology to take care of plants more efficiently. By connecting various tools and writing code for the Shabakah board, we’ve created a system that checks if a plant needs watering. If it’s dry, the system turns on a pump, and if it’s wet enough, the system turns off the pump. This project demonstrates how technology can make our lives easier, especially when it comes to everyday tasks like plant care.

Leave a Reply

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