Escolar Documentos
Profissional Documentos
Cultura Documentos
ON
Abhijit Hota
---------------------------2008A7PS095G
TABLE OF CONTENTS
Introduction
Functioning Flowchart
Pin Diagram
Code
Conclusion
12
Bibliography
13
ii
INTRODUCTION
This project aims to develop a system to automate irrigation/watering of plants installed inside a
household/office space. It samples the moisture content of the soil and automatically waters the
plants to the required amount of saturation. The user just has to input the sampling rate and the
threshold soil moisture content, which can be changed as required, and the system functions
accordingly. It also monitors the sufficiency of water from the source, which could be a reservoir or
a tank, and raises an alert when required. The state of the system is constantly monitored and an
LCD display notifies the current overall status. The system helps save time, prevents unnecessary
water wastage and avoids any inconvenience that is caused by watering the plants manually. It can
be extended to a large scale irrigation system for a complete building or a farm with increased
complexity of watering.
6) Buzzer : A buzzer is used to raise an alert whenever the water level falls below the minimum
level (sensing from the water level sensor). Once the level sensor module detects insufficiency
of water, the LCD displays no water and the buzzer is sounded.
7) Push Button : Once the level sensor module detects for water insufficiency (i.e. Vsensor voltage
value drops close to 1.67V), LCD displays no water and the buzzer is turned on. The user
would need to ensure that the tank is filled and then press the push button to check current
water level. Only if sufficient water is filled (Vsensor voltage close to Vcc), the buzzer goes off
and watering/monitoring starts again.
FLOWCHART
PIN DIAGRAM
The pin configuration diagram is shown below : shows all the hardware interfacing with the processor
CODE
The actual PSoC code in C language using specific APIs to control and interact with various components:
//--------------------------------------------------------------------------// C main line
//--------------------------------------------------------------------------#include <stdlib.h>
#include <m8c.h>
#include "PSoCAPI.h"
int input()
{
int row, col, result, final, c;
result=0;
final=0;
while (1)
{
while(result==0)
{
PRT1DR=0xF0;
col=PRT1DR;
PRT1DR=0x00;
PRT1DR=0x0F;
row=PRT1DR;
result=col&row;
switch(result)
{
case 17:result=1;
break;
case 18:result=2;
break;
case 20:result=3;
break;
case 33:result=4;
break;
case 34:result=5;
break;
case 36:result=6;
break;
case 65:result=7;
break;
case 66:result=8;
break;
case 68:result=9;
break;
case 130:result=10;
break;
case 136:result=11;
break;
case 129:result=-1;
break;
default:result=0;
break;
}
}
if(result<0) //Pressed E
break;
if(result==10)
result=0;
if(result==11) //Pressed D
{
final=0;
result=0;
LCD_1_Position(1,0);
LCD_1_PrCString("
");
}
else
{
final=(final*10)+result;
LCD_1_Position(1,0);
LCD_PrintInt(final);
}
result=10;
while(result!=0) //Wait until button is released
{
PRT1DR=0xF0;
col=PRT1DR;
PRT1DR=0x00;
PRT1DR=0x0F;
row=PRT1DR;
result=col&row;
}
}
return(final);
}
void nowater()
{
char c;
int f=0;
while(f==0)
{
PRT0DR=0xFF;
if((PRT0DR&0x10)==0x00)
{
Swtch_On();
c = SAR6_2_cGetSample();
c = c-224;
if(c > 32)
{
f=1;
Swtch_Off();
}
}
else
{
Swtch_Off();
}
}
}
void main(void)
{
int moist,delay,current;
char a, b;
M8C_EnableGInt;
LCD_1_Start();//LCD Initialization
LCD_1_Init();
motor_Start();//LED Initialization
buzzer_Start();
SleepTimer_1_Start();//SleepTimer Initialization
SleepTimer_1_SetInterval(24);
SleepTimer_1_EnableInt();
PGA_1_Start(3);//ADC & PGA for moisture Initialization
SAR6_1_Start(3);
PGA_2_Start(3);//ADC & PGA for water Initialization
SAR6_2_Start(3);
LCD_1_Position(0,0);
LCD_1_PrCString("Enter Moist");
SleepTimer_1_TickWait(1);
moist=input();
LCD_1_Position(1,0);
LCD_1_PrCString("
");
LCD_1_Position(0,0);
LCD_1_PrCString("Enter Delay");
SleepTimer_1_TickWait(1);
delay=input();
LCD_1_Position(1,0);
LCD_1_PrCString("
LCD_1_Position(0,0);
LCD_1_PrCString("
");
");
a = SAR6_1_cGetSample();
a = a-224;
current=(int)a;
while(1)
{
LCD_1_Position(1,5);
LCD_1_PrCString("
");
LCD_1_Position(1,6);
LCD_PrintInt(current);
if(current>moist)
{
b = SAR6_2_cGetSample();
b = b-224;
if(b < 32)
{
buzzer_On();
LCD_1_Position(0,4);
LCD_1_PrCString("No Water");
LCD_1_Position(1,5);
LCD_1_PrCString("
");
nowater();
buzzer_Off();
}
motor_On();
LCD_1_Position(0,4);
LCD_1_PrCString("Watering");
LCD_1_Position(1,6);
LCD_PrintInt(current);
while(current>=moist-6)
{
b = SAR6_2_cGetSample();
b = b-224;
if(b < 32)
{
motor_Off();
buzzer_On();
LCD_1_Position(0,4);
LCD_1_PrCString("No Water");
LCD_1_Position(1,5);
LCD_1_PrCString("
");
nowater();
buzzer_Off();
motor_On();
LCD_1_Position(0,4);
LCD_1_PrCString("Watering");
}
SleepTimer_1_TickWait(1);
a = SAR6_1_cGetSample();
a = a-224;
current=(int)a;
LCD_1_Position(1,6);
LCD_PrintInt(current);
}
motor_Off();
LCD_1_Position(0,4);
LCD_1_PrCString("
");
}
10
SleepTimer_1_TickWait(delay);
a = SAR6_1_cGetSample();
a = a-224;
current=(int)a;
}
}
11
CONCLUSION
The system can be implemented for household usage and can be extended to a work in a larger system,
such as a building or a farm. The system implements a soil moisture sensor, a keypad for entering
monitor parameters, a sensor to check for water sufficiency before watering, a buzzer to alert the user,
a LCD display notifying the current system status and a switch to turn off alarm when raised. These
features make the system user-friendly as well as reliable, and the components are easy to set up with
minimal cost.
12
BIBLIOGRAPHY
1 .CY8CKIT-001 documentation
13