Project in progress
Secure Watering System

Secure Watering System © GPL3+

A home or farm-field watering system that provides a security from intruders.

  • 2,855 views
  • 0 comments
  • 4 respects

Components and supplies

Apps and online services

About this project

Our project is not just a water system. It's a water system that provides security from intruders! We decided to make it in order to make our hobby, gardening easier. At a particular time it starts watering. It has switches that turn off the system. It can also can be activates / deactivates automaticly. Manual operation for each bet. Has a good operating system with switches and leds. Future scalability with electrical panels.

Code

Untitled fileArduino
#include <stdio.h>

#include <DS1302.h>

int time_vrish_mpalkoni = 10;

int time_vrish_kupos = 20;

#define hour_to_start 22

#define minute_to_start 22

int input_sensor_Pin = 8; 

int alarm_pin = 12;

const int kupos_vrish = 7;

int mpalkoni_vrish = 5;

const int button_auto_gardening = 6;

uint8_t RST_PIN = 11; 

uint8_t SDA_PIN = 10;

uint8_t SCL_PIN = 9; 

DS1302 rtc(RST_PIN, SDA_PIN, SCL_PIN);

int button_diagnostics = 0;

int lastbutton_diagnostics = 1;

unsigned long start_time_pressed = 0;

unsigned long end_time_pressed = 0;

unsigned long time_hold = 0; 

unsigned long time_to_release = 0;

unsigned long prev_millis = 0;

const int button_diagnostics_pin = 4;  

const int ledPin = 3; 

 

void watering(){  

  Serial.println("Start watering");

  digitalWrite(kupos_vrish, HIGH);

  delay(time_vrish_kupos*60000);

  digitalWrite(kupos_vrish, LOW);

  delay(100);

  

  Serial.println("Start watering vrish mpalkoni");

  digitalWrite(mpalkoni_vrish, HIGH);

  delay(time_vrish_mpalkoni*60000);

  Serial.println("end delay: ");

  digitalWrite(mpalkoni_vrish, LOW);

  delay(1000);

  Serial.println("Finish watering");

}

void watering_check_diagnostics(){

  Serial.println("Start watering check diagnostics");

  digitalWrite(kupos_vrish, HIGH);

  delay(60000);

  digitalWrite(kupos_vrish, LOW);

  delay(100);

  Serial.println("end delay vrish kupos ");

  

  Serial.println("Start watering vrish mpalkoni");

  digitalWrite(mpalkoni_vrish, HIGH);

  delay(60000);

  Serial.println("end delay vrish mpalkoni ");

  digitalWrite(mpalkoni_vrish, LOW);

  delay(100);

  Serial.println("Finish watering check");

}

void setup(){

  Serial.begin(9600);

  pinMode(alarm_pin, OUTPUT);      

  pinMode(input_sensor_Pin, INPUT);

  pinMode(button_diagnostics_pin, INPUT);

  pinMode(ledPin, OUTPUT);

  pinMode(button_auto_gardening, INPUT);

  pinMode(kupos_vrish, OUTPUT);

  pinMode(mpalkoni_vrish, OUTPUT);

  rtc.halt(false);

}

unsigned long CurrentTime = 5000000;

int button_auto_gardening_state = 0; 

int sensor = 0;    

void loop(){

  unsigned long currentMillis = millis();

  if(currentMillis - prev_millis >= 1000) {

    button_auto_gardening_state = digitalRead(button_auto_gardening);

    Time t = rtc.time();

    if (button_auto_gardening_state == HIGH) {

      if( t.min==minute_to_start&&t.hr==hour_to_start){

        watering();

      }

    }else{

      Serial.println("Switch off ");

    }

    

    Serial.print("Hour: ");

    Serial.print(t.hr);

    Serial.print(" Minute: ");

    Serial.println(t.min);

    prev_millis = currentMillis;

  }

  button_diagnostics = digitalRead(button_diagnostics_pin);

  if (button_diagnostics != lastbutton_diagnostics) {

      if (button_diagnostics == HIGH) {

          start_time_pressed = millis();

          time_to_release = start_time_pressed - end_time_pressed;

      } else {

          end_time_pressed = millis();

          time_hold = end_time_pressed - start_time_pressed;

          if (time_hold >= 0 && time_hold < 1000) {

              Serial.println("Button pressed"); 

              digitalWrite(ledPin, HIGH);

              delay(1000);

              digitalWrite(ledPin, LOW);

          }

          if (time_hold >= 1000) {

            watering_check_diagnostics();

          }

      }

  } 

  lastbutton_diagnostics = button_diagnostics;

  sensor = digitalRead(input_sensor_Pin);  

  if (sensor == HIGH) {            

      digitalWrite(alarm_pin, HIGH);  

      delay(100000)

      digitalWrite(alarm_pin, LOW);

  }

}

Schematics

Extended
21741693 10214213510722451 1815469505 n 630k46z9a0
Scheme
21733387 10214213445000808 1104489735 n 7t1g3swv1o

Comments

Similar projects you might like

Automatic Plant Watering System with Arduino

Project tutorial by Team RobotGeek Projects Team

  • 32,784 views
  • 2 comments
  • 45 respects

Automatic Watering System

Project tutorial by PRosenb

  • 14,917 views
  • 15 comments
  • 36 respects

Automatic Watering System

Project tutorial by Manson Hau

  • 9,058 views
  • 11 comments
  • 38 respects

Automated Plant Watering System

Project in progress by Ammar Shahid

  • 4,426 views
  • 2 comments
  • 23 respects

Home Plant Watering System

Project tutorial by Alexander

  • 15,200 views
  • 2 comments
  • 42 respects
Add projectSign up / Login