STEMpedia
Published © CC BY

Automatic Plant Watering System Using Arduino

This project will show you how to make your own automatic plant watering system.

IntermediateFull instructions provided4 hours3,646
Automatic Plant Watering System Using Arduino

Things used in this project

Hardware components

evive AgriTech Kit
STEMpedia evive AgriTech Kit
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Fritzing Diagram

Code

Arduino Code for Automatic Plant Watering System

Arduino
#include<evive.h>

#define sensor_pin A0
#define pump_enable 44
#define pump_gnd 28
#define pump_control 29

unsigned int sensor_out=0;

void setup() {
  // put your setup code here, to run once:

  Serial.begin(9600);

  pinMode(sensor_pin,INPUT);
  pinMode(pump_enable,OUTPUT);
  pinMode(pump_gnd,OUTPUT);
  pinMode(pump_control,OUTPUT);

  analogWrite(pump_enable,255);
  digitalWrite(pump_gnd,LOW);
  digitalWrite(pump_control,LOW);

  tft_init(INITR_GREENTAB);
  tft.setRotation(1);
  tft.fillScreen(ST7735_BLACK);

   tft.setCursor(25,10);
  tft.setTextSize(2);
  tft.setTextColor(ST7735_WHITE,ST7735_BLACK);
  tft.print("STEMpedia");

   tft.setCursor(15,30);
  tft.setTextSize(1.8);
  tft.setTextColor(ST7735_GREEN,ST7735_BLACK);
  tft.print("SMART DRIP IRRIGATION ");
  tft.setCursor(55,40);
  tft.print("SYSTEM");

  tft.setCursor(55,60);
  tft.setTextSize(1.8);
  tft.setTextColor(ST7735_GREEN,ST7735_BLACK);
  tft.print("STATUS");

  tft.setCursor(20,70);
  tft.setTextColor(ST7735_WHITE,ST7735_BLACK);
  tft.print("PUMP     :");
  tft.setTextColor(ST7735_BLUE,ST7735_BLACK);
  tft.print(" OFF  ");
  tft.setTextColor(ST7735_WHITE,ST7735_BLACK);
  tft.setCursor(20,80);
  tft.print("HUMIDITY : ");
  tft.setTextColor(ST7735_GREEN,ST7735_BLACK);
  tft.print(sensor_out);
  tft.print(" %   ");

  tft.setTextColor(ST7735_GREEN,ST7735_BLACK);
  tft.setCursor(0,105);
  tft.setTextSize(1.8);
  tft.print("FOR MORE INFORMATION VISIT");
  tft.setCursor(30,115);
  tft.setTextColor(ST7735_WHITE,ST7735_BLACK);
  tft.print("thestempedia.com");
}

void loop() {
  // put your main code here, to run repeatedly:

  sensor_out = analogRead(sensor_pin);
  sensor_out = map(sensor_out,1023,550,10,100);

  tft.setCursor(20,80);
   tft.setTextColor(ST7735_WHITE,ST7735_BLACK);
  tft.print("HUMIDITY : ");
  tft.setTextColor(ST7735_GREEN,ST7735_BLACK);
  tft.print(sensor_out);
  tft.print(" %   ");
 

  if(sensor_out>=60)
    {
       tft.setCursor(20,70);
       tft.setTextColor(ST7735_WHITE,ST7735_BLACK);
       tft.print("PUMP     :");
       tft.setTextColor(ST7735_BLUE,ST7735_BLACK);
       tft.print(" OFF  ");
       digitalWrite(pump_control,LOW);
       delay(50);
    }
  else if(sensor_out<60)
     {
       tft.setCursor(20,70);
       tft.setTextColor(ST7735_WHITE,ST7735_BLACK);
       tft.print("PUMP     :");
       tft.setTextColor(ST7735_GREEN,ST7735_BLACK);
       tft.print(" ON  ");
       digitalWrite(pump_control,HIGH);
       delay(50);
       
     }

  delay(30);

  
}

eviv

C/C++
No preview (download only).

Credits

STEMpedia

STEMpedia

42 projects • 169 followers
STEMpedia blends theory with experiential learning by offering state-of-the-art technology, projects, tutorials, courses, and much more.

Comments