Project showcase
Automatic Pet Watering System

Automatic Pet Watering System © Apache-2.0

Automatic watering system for my dog.

  • 17,932 views
  • 3 comments
  • 36 respects

Components and supplies

About this project

My project is about a automatic watering system for my dog. I love making stuff, so i decided to make something useful for my dog! 

The automatic watering system simple just read the water level in the water bowl with a HC-SR04 ultra sonic sound sensor. It measure the distance to the surface of the water. If the level is less then 3cm for more than 30sec it triggers a 5V relay whit a NO-contact . The relay are controlling a 12VDC supply to a mini watering pump in the water tank. 


Code

CodeC#
Sorry for the messy code and the variables between English and Norwegian, new at this. So be pasient please =)
//Automatic watering ystem//


const int trigPin = A3;
const int echoPin = A2;

int rele = 3;
int normaldrift = 5;
int fyller = 8;

long duration;
int distance;

int releDrift = 0;
int sensorValue = 0;  
int fullStatus = 0;
int startfylling = 0;
int tell =0;



#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 6, 9, 10, 7);




void setup() 
{

  
//Utganger og innganger//
pinMode (trigPin, OUTPUT);
pinMode (echoPin, INPUT);


pinMode (rele, OUTPUT);
pinMode (normaldrift,OUTPUT);
pinMode (fyller , OUTPUT);



//level sensor
Serial.begin(9600);



  lcd.begin(16, 2);
  // Print a message to the LCD.

digitalWrite(rele,LOW);

}





void loop() 
{

 

  
  
  
   //               LEVEL SENSOR                 //
  //---------------------------------------------//
 
  // read the analog in value:

  
int avstand = (distance);
avstand = constrain(avstand, 1, 8);
avstand = map (avstand,1,8,8,1);




digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);



duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2;



int vannlevel = avstand;



  // print the results to the serial monitor:

Serial.println(releDrift);

  delay(200);
 
  releDrift = digitalRead(rele);





if ( vannlevel < 3 )
 {tell++;}


if (tell >=111) // 30sekunder
{ startfylling = 1;
}





  if ( startfylling == 1 && vannlevel < 6) 
  {
   digitalWrite(rele, HIGH);
  }
  
   if ( vannlevel >= 6) 
  {
   digitalWrite(rele, LOW); 
   tell = 0;
   startfylling = 0;
   }
  

  

//-------------------------------------------------//








//                   LOW LEVEL                     //
// ------------------------------------------------//




//---------------------------------------------------//









//      Forigling  (for å sikre tørrkjøring          //
//--------------------------------------------------//





//---------------------------------------------------//










//                     Display                       //
//---------------------------------------------------//




if (releDrift == LOW)
{
lcd.clear();
lcd.setCursor(4, 0);
lcd.print("Vannstand");
lcd.setCursor(8, 1);
lcd.print(vannlevel);
lcd.setCursor(10, 1);
lcd.print("cm");
delay(50);
lcd.clear();
lcd.setCursor(4, 0);
lcd.print("Vannstand");
lcd.setCursor(8, 1);
lcd.print(vannlevel);
lcd.setCursor(10, 1);
lcd.print("cm");
digitalWrite (normaldrift, HIGH);


  }



if (releDrift == HIGH)
{
lcd.clear();
lcd.setCursor(5, 0);
lcd.print("Fyller");
lcd.setCursor(7, 1);
lcd.print(vannlevel);
lcd.setCursor(3, 1);
lcd.print("~");
lcd.setCursor(11, 1);
lcd.print("~");
digitalWrite (normaldrift, LOW);
digitalWrite (fyller, HIGH);
delay(50);
digitalWrite (fyller, LOW);
delay(50);
}






//--------------------------------------------//


}

Schematics

Arduino pro mini
This is the microcontroller i used
Skjermbilde123

Comments

Similar projects you might like

Automatic Watering System

Project tutorial by PRosenb

  • 14,914 views
  • 15 comments
  • 36 respects

Automatic Plant Watering System with Arduino

Project tutorial by Team RobotGeek Projects Team

  • 32,775 views
  • 2 comments
  • 45 respects

Home Plant Watering System

Project tutorial by Alexander

  • 15,191 views
  • 2 comments
  • 42 respects

Automatic Watering System

Project tutorial by Manson Hau

  • 9,057 views
  • 11 comments
  • 38 respects

Automatic Pet Water Chiller

Project tutorial by Mitomon

  • 966 views
  • 0 comments
  • 7 respects
Add projectSign up / Login