The aim of this application is to keep the garden plants
alive, when we are on vacation.
This uses Arduino UNO to control the submersible pump, based
on the timings and additional parameters like water level in the tank as a
protection to the submersible pump.
Equipment inventory
Submersible Pump
|
1
|
Used in small water fountains or aquariums
|
Arduino UNO
|
1
|
The main microcontroller
|
Single channel Relay
|
1
|
To control the current through solenoid
|
DTH 11
|
1
|
Temperature& humidity measurement
|
Water level sensors
|
1
|
To detect the water level as an additional check for protecting the
pump
|
Power supplies
1. 5V
for Arduino
2. 220V
for Pump
3. Optionally
12V for relay
|
1
1
1
|
|
Drip irrigation water feeder tube
|
Length varies according to the number of plants / pots to be
irrigated
|
|
Plumbing accessories
|
To connect the drip irrigation system to main water inlet.
|
Arduino library
1)
Time Library (http://www.pjrc.com/teensy/td_libs_Time.html)
Connection block diagram
Arduino Code
|
#include <Time.h>
#include <TimeAlarms.h>
#include <dht.h>
int pin = 10;
int pin2 = 13;
int levelOut = 8;
int levelIn = 9;
dht DHT;
#define dht_dpin A0;
//#define relay 5;
//#define relay 12;
int relay = 5;
void setOn(){
if(relay == 5) {
digitalWrite(pin,LOW);
digitalWrite(pin2,HIGH);
}
else
digitalWrite(pin,HIGH);
digitalWrite(pin2,LOW);
}
void setOff(){
if(relay == 5) {
digitalWrite(pin,HIGH);
digitalWrite(pin2,LOW);
}
else
digitalWrite(pin,LOW);
digitalWrite(pin2,HIGH);
}
void setup()
{
pinMode(pin, OUTPUT);
pinMode(pin2, OUTPUT);
pinMode(levelOut, OUTPUT);
pinMode(levelIn, INPUT);
//digitalWrite(pin,LOW);
setOff();
//digitalWrite(pin2,LOW); //
don't want the LED on pin 13 glowing
Serial.begin(9600);
setTime(22,37,00,27,9,2015);
// set the date time of your Arduino
Alarm.alarmRepeat(6,0,0,
EarlyMorning); // 6:00am every day
Alarm.timerRepeat(60,
Hourly); // timer for every 2
hours
Serial.println("");
}
void loop() {
Alarm.delay(1000); // wait
one second between clock display
}
void EarlyMorning(){
// first thing in the morning
open Pump for 2 mins
Serial.println("Early
morning");
Pump(2);
}
void Pump(int min)
{
//digitalWrite(pin,HIGH); //
Open Pump
if(ChkLevel()){
setOn();
delay(min * 6 * 1000);
//delay(min * 60 * 1000);
//digitalWrite(pin,LOW); //
shut Pump
setOff();
}
}
void Hourly()
{
Serial.println("Hourly");
// check during daytime only
if( hour() >= 8 &&
hour() <= 17 && ChkTemp())
Pump(1);
}
int relay = 5;
void setOn(){
if(relay == 5) {
digitalWrite(pin,LOW);
digitalWrite(pin2,HIGH);
}
else
digitalWrite(pin,HIGH);
digitalWrite(pin2,LOW);
}
void setOff(){
if(relay == 5) {
digitalWrite(pin,HIGH);
digitalWrite(pin2,LOW);
}
else
digitalWrite(pin,LOW);
digitalWrite(pin2,HIGH);
}
bool ChkTemp()
{
DHT.read11(A0);
// if temp > 30 and
humidity > 75%
return (DHT.temperature >=
30 || DHT.humidity >= 75 );
}
bool ChkLevel(){
return true;
// since we are using water level switch in serial manner /*digitalWrite(levelOut,HIGH); bool val = digitalRead(levelIn);
return (val == LOW) ;*/
} |
No comments:
Post a Comment