You are on page 1of 48

“SMART CROP PROTECTION USING

PIC18F4520 AND PIR SENSOR”


Team Numbers:
Name - Rollno
D.Dilip Kumar-18311A0471
G.Anil Kumar -18311A0474
B.Manoj Kumar-18311A0481
Problem Statement
➢ Nowadays ,farmers crop have threat due to the animals entering
in to the field in absence of farmer .
➢ When the animals enters the field ,it disturbs the crop,and eats
some of crop. So,inorder to avoid this a safety measure has to be
taken to not allow the damage of crop.
➢ Here we thought of a smart crop protection system for farmers
which identifies whenever animal got entered into the field.And
this information is sent to farmer and proper measures are taken
by farmer to prevent the damage of the crop.
Proposed Method
• The Existing method for this problem is fencing our field area ,but the
major drawback for this method is, it is difficult to remove fencing
whenever it is to be removed for use and during ploughing the field
,farmer cant plough through the corners of the field.So,some part of
the field remains un ploughed
• Hence,Inorder to prevent the damage of crop,the entry of animals
into the crop is informed to the farmer.
• Here,we use PIR sensor for detection of animals in field and the
information is sent to the farmer through call or text message with
the help of GSM module and PIC18F4520 microcontroller to his
mobile.
BLOCK DIAGRAM
COMPONENTS
Hardware:
PIC18F4520 microcontroller
GSM module
PIR sensor
Buzzer
Button
16x2 LCD Display
Battery
Software:
Proteous 8 Professional
MPLABX IDE
XC8 compiler
Code
#include<pic18f4520.h> /*HEADER FILE*/
void Delay_us(int us); /* FUNCTION DECLARATIONS*/
void Data(int Value);
void Cmd(int Value);
void Send2Lcd(const char Adr, const char *Lcd);
void main() /*MAIN FUNCTION*/
{
/* If you want your microcontroller to work at 1MHZ then comment the three lines below */
OSCCONbits.IRCF0 = 1 ; // set internal clock to 8 MHz
OSCCONbits.IRCF1 = 1; // For Avoiding switch debouncing problem
OSCCONbits.IRCF2= 1; //
ADCON1bits.PCFG0 = 1; // These 4 settings below determines the analog or digital input
ADCON1bits.PCFG1 = 1; // In our case we are making all the pins digital
ADCON1bits.PCFG2 = 1; // by setting them as 1111
ADCON1bits.PCFG3 = 1; // Check with the datasheet for a nice desc of these bits and config.
ADCON0bits.ADON = 0; // Disabled ADC
TRISA=0xff; //PORTA CONFIGURED AS INPUT
TRISC=0X00; //PORTC CONFIGURED AS OUTPUT
TRISD=0X00; //PORTD CONFIGURED AS OUTPUT
if(PORTAbits.RA1==1)
{
Delay_us(25);
Cmd(0X30); //LCD SPECIFICATION COMMANDS
Delay_us(25);
Cmd(0X30); //LCD SPECIFICATION COMMANDS
Delay_us(25);
Cmd(0X30); //LCD SPECIFICATION COMMANDS
Delay_us(25);
Cmd(0X38); //DOUBLE LINE DISPLAY COMMAND
Cmd(0X06); //AUTO INCREMENT LOCATION ADDRESS COMMAND
Cmd(0X0C);//LCD DISPLAY ON COMMAND
Cmd(0X01);//CLEAR DISPLAY COMMAND
Send2Lcd(0x84," Hello Welcome");//DISPLAYS STRING IN THE FIRST LINE
Send2Lcd(0xc0," to the project");//DISPLAYS STRING IN THE SECOND LINE
Delay_us(100000);
while(PORTAbits.RA1==1){ //IF BUTTON IS ON

if(PORTAbits.RA0==1) // IF PIR SENSOR IS HIGH(ANIMAL IS DETECTED)


{
PORTCbits.RC2=1; //BUZZER GETS TURNED ON
Cmd(0X01); // CLEARS THE LCD
Send2Lcd(0x84," detected"); // PRINTS DETECTED ON LCD
Delay_us(10000);
}
else
{
PORTCbits.RC2=0; //BUZZER GETS TURNED OFF
Cmd(0X01); // CLEARS SCREEN
Send2Lcd(0x84," Not detected");// PRINTS NOT DETECTED
Delay_us(10000);
}

}
}
else
{
Cmd(0X01);//CLEAR SCREEN OF LCD
PORTCbits.RC2=0;//BUZZER GETS OFF
}
}
void Cmd(int Value)
{
PORTD= Value; //WRITE THE COMMAND TO DATA LINES
PORTCbits.RC0 = 0; //RS-0(COMMAND REGISTER)
PORTCbits.RC1 = 1; //E-1(ENABLE)
Delay_us(25);
PORTCbits.RC1 = 0; //E-0(ENABLE)
}
void Data(int Value)
{
PORTD= Value; // WRITE THE CHARACTER TO DATA LINES
PORTCbits.RC0 = 1; //RS-1(DATA REGISTER)
PORTCbits.RC1 = 1; //E-1(ENABLE)
Delay_us(25);
PORTCbits.RC1 = 0; //E-0(ENABLE)
}
void Send2Lcd(const char Adr, const char *Lcd)
{
Cmd(Adr); //ADDRESS OF LOCATION TO DISPLAY STRING
while(*Lcd!='\0') //CHECK FOR TERMINATION CHARACTER
{
Data(*Lcd); // DISPLAYS THE CHARACTER
Lcd++; //INCREMENT THE POINTER
}
}
void Delay_us(int us)
{
us=us>>1;
while(us!=1)
us--;
} //end of the code
WORKING
WORKING
CONCLUSIONS
➢ Hence the project has been successfully made and
demonstrated through simulation in proteous
software with the help of pic18f4520
microcontroller.
➢ The project is also found useful in many cases like it
can be used in various domains like house
protection from thiefs at night times.
Applications
➢The project is found to be useful in various domains
and other places .
➢At night times ,this can be used for finding thiefs
entering in to house.
➢It can be used to know whether the child has slept
or wokeup by his movement in cradle, and message
can be sent to parent nearby at work in home .
FUTURE SCOPE
➢ One of the most needed advancement in the project is ,it
should be inculcated with different sounds in buzzer which
frightens animals ,which to some extends makes the animal
to leave the field by the time farmer takes necessary action
to avoid the crop damage in prior.
➢ It is one of the smart approach to avoid the damage of the
crop.The use of this system gives good output in future
keeping in mind the importance of crop and agriculture .
THANK YOU
Internship Project Report
on

SMART CROP PROTECTION SYSTEM

Submitted in the partial fulfilment of the requirements for


the award of the degree of

BACHELOR OF TECHNOLOGY
In
ELECTRONICS AND COMMUNICATION ENGINEERING
By

GUJJARI ANIL KUMAR 18311A0474


DUDALA DILIP KUMAR 18311A0471
MANOJ KUMAR BYROJU 18311A0481

UNDER THE GUIDANCE OF


Dr.G.PRASAD ACHARYA
Associate Professor
Department of ECE

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING


SREENIDHI INSTITUTE OF SCIENCE AND TECHNOLOGY
(Autonomous)
Yamnampet (V), Ghatkesar (M), Hyderabad – 501 301.
April 2020-July 2020

1
SREENIDHI INSTITUTE OF SCIENCE AND TECHNOLOGY
(Affiliated to Jawaharlal Nehru Technological University, Hyderabad)
Yamnampet (V), Ghatkesar (M), Hyderabad – 501 301

Department of Electronics and Communication Engineering

CERTIFICATE

This is to certify that the project report entitled “SMART CROP


PROTECTION SYSTEM” is being submitted by

GUJJARI ANIL KUMAR 18311A0474


DUDALA DILIP KUMAR 18311A0471
MANOJ KUMAR BYROJU 18311A0481
in partial fulfilment of the requirements for the award of Bachelor of
Technology degree in Electronics and Communication Engineering to
Sreenidhi Institute of Science and Technology affiliated to Jawaharlal
Nehru Technological University, Hyderabad (Telangana). This record is a
bona fide work carried out by them under our guidance and supervision.
The results embodied in the report have not been submitted to any other
University or Institution for the award of any degree or diploma.

Internal guide:
Dr.G.PRASAD ACHARYA
Associate Professor,Department of ECE

Head of the Department


Dr. S.P.V. SUBBA RAO
Professor, Department of ECE

2
DECLARATION

We hereby declare that the work described in this thesis titled “SMART
CROP PROTECTION SYSTEM” which is being submitted by us in partial
fulfilment for the award of Bachelor of Technology in the Department of
Electronics and Communication Engineering, Sreenidhi Institute Of
Science and Technology is the result of investigations carried out by us
under the guidance of Dr.G.PRASAD ACHARYA, Associate Professor,
Department of ECE, Sreenidhi Institute of Science and Technology,
Hyderabad.

No part of the thesis is copied from books/ journals/ internet and whenever
the portion is taken, the same has been duly referred. The report is based on
the project work done entirely by us and not copied from any other source.
The work is original and has not been submitted for any Degree/Diploma of
this or any other university.

Place: Hyderabad
Date: 05-09-2020

GUJJARI ANIL KUMAR 18311A0474


DUDALA DILIP KUMAR 18311A0471
MANOJ KUMAR BYROJU 18311A0481

3
ACKNOWLEDGEMENTS

Acknowledgement to Internal guide


Acknowledgement to Coordinators
Acknowledgement to HoD
Acknowledgement to Principal
Acknowledgement to Executive Director
Acknowledgement to some other person(s)

4
ABSTRACT

Crops in farms are many times ravaged by local animals like


buffaloes, cows, goats, birds etc. This leads to huge losses for the farmers. It
is not possible for farmers to barricade entire fields or stay on field 24 hours
and guard it. So here we propose automatic crop protection system from
animals. This is a microcontroller based system using PIC family
microcontroller. This system uses a motion sensor to detect wild animals
approaching near the field. In such a case the sensor signals the
microcontroller to take action. The microcontroller now sounds an alarm to
woo the animals away from the field as well as sends sms to the farmer so
that he may know about the issue and come to the spot in case the animals
don’t turn away by the alarm. This ensures complete safety of crops from
animals thus protecting the farmers loss.Nowadays ,farmers crop have
threat due to the animals entering in to the field in absence of farmer .When
the animals enters the field ,it disturbs the crop,and eats some of
crop.So,inorder to avoid this a safety measure has to be taken to not allow
the damage of crop.Here we thought of a smart crop protection system from
animals which identifies whenever animal got entered into the field,this
information is sent to farmer using the GSM module and control unit.Here
the detection of animal is done by using the PIR sensor ,which is connected
to the control unit.Here we also include the buzzer sound ,such that it alerts
the animal and to some extend it makes animal to fear and leave the
field.Meanwhile the information is received by farmer by message to his
mobile through GSM module,hence proper measure can be taken and crop
can be protected from the farmer.Here we are using PIC18F4520
microcontroller ,GSM module for sending message to farmer and a PIR
sensor to detect the animal.These PIR sensor allows to sense motion and
detect whether a animal has moved in or out of the sensor range.

5
Contents

Acknowledgments 4
Abstract 5
CHAPTER1 INTRODUCTION 6
1.1 Motivation 1
1.2 Problem statement (Existing and proposed method) 3
1.3 Objectives 4
CHAPTER 2 HARDWARE REQUIREMENTS 11
2.1 PIC18F4520 MicroController 11
2.2 GSM Module 14
2.3 Passive Infra-Red (PIR) Sensor 16
2.4 Buzzer 17
2.5 Buttons or Switches 17
2.6 16X2 LCD Display 18
2.7 Battery(9V-12V) 19
CHAPTER 3 SOFTWARE REQUIREMENTS 20
3.1 Proteous 8 Professional 20
3.2 MPLABX IDE 21
3.3 XC8 Compiler 23
CHAPTER 4 WORKING 24
4.1 Block Diagram 24
4 .2 Circuit Diagram 25
4.3 Program Code 25
4.4 Working Description 28
CHAPTER 5 CONCLUSIONS & FUTURE SCOPE 28
5.1 Conclusions 28
5.2 Future Scope 28
References 29

6
List of figures
Figure No Name Page No
1.1 Pin Description of PIC18 17
1.2 GSM Module 15
1.3 PIR Sensor 16
1.4 Buzzer 17
1.5 Push Button 17
1.6 16X2 LCD Display 19
1.7 Proteous Interface 21
1.8 Proteous Working 21
1.9 MPLABX IDE 22
2.0 Block Diagram 24
2.1 Circuit Diagram 25

7
1.INTRODUCTION

Surveillance plays a major role in many fields be it at home, hospitals,


schools, public places, farmlands etc. It helps us to monitor a certain
area and prevent theft and also provides proof of evidence. In the case
of farmlands or agricultural lands surveillance is very important to
prevent unauthorized people from gaining access to the area as well as
to protect the area from animals. Various methods aim only at
surveillance which is mainly for human intruders, but we tend to forget
that the main enemies of such farmers are the animals which destroy
the crops. This leads to poor yield of crops and significant financial loss
to the owners of the farmland. This problem is so pronounced that
sometimes the farmers decide to leave the areas barren due to such
frequent animal attacks. This system helps us to keep away such wild
animals from the farmlands as well as provides surveillance
functionality. Animal attacks in India are a common story nowadays.
Due to the unavailability of any detection system these attacks kill
villagers and also destroy their crops. Due to lack of proper safety
measures, these villagers are left helpless to their fate. Therefore a
proper detection system could help save their lives and also to the
preservation of crops. Also thecrops of villagers are destroyed due to
frequent generated and the cameras employed are turned ON which
capture an image and start recording the video for some time which
will be stored on the SD card as well as stored on cloud i.e, dropbox,
the land owner can then view the video on any smart device, as well as
access it later. All the sensors and components are interfaced to the
Raspberry pi board. Hence we come up with such a product that can
be very useful for farmers, it prevents the loss of crops and increases
the yield, also protects the farm from intruders. interference of animals.
The crops and paddy fields cannot be always fenced. So the possibility
of crops being eaten away by cows and goats are very much present.
This could result in huge wastage of crops produced by the farmers. To
make the best use of mobile communication technology, the objectives

8
of this paper therefore utilizes global system for mobile. service (SMS).
This system helps us to keep away such wild animals from the
farmlands as well as provides surveillance functionality. It has been
found the odour of rotten egg helps to keep the wild pigs and deer from
destroying the crops, hence the farmers manually spray the rotten egg
solution on their fields, and firecrackers are used to ward off the wild
elephants that destroy the crops.This project is based on surveillance
with an animal ward-off system employed in farmlands in order to
prevent crop vandalization by wild animals. In addition to providing
protection this system distinguishes between an intruder and an
authorized person using RFID’s, various PIR sensors are deployed in
the area to detect any motion and hence turns ON a camera when
movement is detected, thereby providing realtime monitoring. It
involves automation of certain methods used to prevent the wild
animals from entering the farmlands and destroying the crops, an
electronic fire cracker (for bigger animals, like elephant) and a rotten
egg spray (for smaller animals like wild pigs and deer) which have been
found useful to ward off the wild animals, we use Haar feature based
cascade classifiers for object detection to distinguish between the
animal and human. When such intrusions occur, a message will be
automatically.

1.1 MOTIVATION
 Nowadays ,farmers crop have threat due to the animals entering
in to the field in absence of farmer .
 When the animals enters the field ,it disturbs the crop,and eats
some of crop. So,inorder to avoid this a safety measure has to be
taken to not allow the damage of crop.
 Here we thought of a smart crop protection system for farmers
which identifies whenever animal got entered into the field.And
this information is sent to farmer and proper measures are taken
by farmer to prevent the damage of the crop.

9
1.2. PROBLEM STATEMENT (PROPOSED AND EXISTING
METHODS)
The Existing method for this problem is fencing our field area ,but the
major drawback for this method is, it is difficult to remove fencing
whenever it is to be removed for use and during ploughing the field
,farmer cant plough through the corners of the field. So,some part of
the field remains un ploughed Hence,Inorder to prevent the damage of
crop,the entry of animals into the crop is informed to the farmer.
Here,we use PIR sensor for detection of animals in field and the
information is sent to the farmer through call or text message with the
help of GSM module and PIC18F4520 microcontroller to his mobile.
The existing systems mainly provide the surveillance functionality. Also
these systems don’t provide protection from wild animals, especially in
such an application area. They also need to take actions based on the
on the type of animal that tries to enter the area, as different methods
are adopted to prevent different animals from entering such restricted
areas. Also the farmers resort to the other methods by erecting human
puppets and effigies in their farms, which is ineffective in warding off
the wild animals, though is useful to some extent to ward off birds .The
other commonly used methods by the farmers in order to prevent the
crop vandalization by animals include building physical barriers, use of
electric fences and manual surveillance and various such exhaustive
and dangerous methods. In the proposed system, Crop monitoring
is done where sensors are used to collect information in the
agricultural field. In our proposed work, PIR, Smoke sensor and GSM is
used. When animals come near to the PIR sensor and it detects the
animal movement. After getting that initial input signal, it is passed for
further processing. Then it will be given to the microcontroller. Our
system will be activated, immediately buzzer will be on, at the same
time it sends an SMS and makes call to the owner. Microcontroller
Block is used for reading the inputs from PIR and Smoke sensor. Whole
process is controlled by microcontroller. The GSM module is used for

10
sending SMS and making call to farmer when movement or smoke is
detected. It also turns ON the motor, when smoke is detected. It alerts
the farmer that some animals try to enter into the farm. Our LCD data
will be display for SMS sending.
1.3 OBJECTIVES
 To design a security system for farm protection.
 Prohibit the entry of animal into the farm.
 Use GSM module for alerting us.
 Design a system that sounds through solar animal repellent
when animal tries to enter into the farm.
 In night flash light will focus on that side.
 The system ensures that the alarm is not triggered by the
presence of a human in the field, or via any random motion.
 The system is capable of turning On/Off automatically and
warding off the animals thus protecting the fields from any
damage also we can setup a Timer as per farmer’s requirement.

2.HARDWARE REQUIREMENTS
Different Hardware Components used in this project are as below
 PIC18F4520 MicroController
 GSM Module
 Passive Infra-Red (PIR) Sensor
 Buzzer
 Buttons or Switches
 16X2 LCD Display
 Battery(9V-12V)

2.1.PIC18F4520 MICROCONTROLLER

 PIC18F4520 is a PIC microcontroller, introduced Microchip, and


mainly used in automation and embedded systems. It comes in three
packages known as PDIP, QFN, and TQFP where the first one is 40-

11
pin (mostly used) while other two come with a 44-pin interface.
 This microcontroller version comes with CPU, timers, 10-Bit ADC and
other peripherals that are mainly used to develop a connection with
external devices.
 This PIC version, like other models in the PIC community, contains
everything that is required to make an embedded system and drive
automation.
 The PIC18F4520 contains 256 bytes of EEPROM data memory, 1536
bytes of RAM, and program memory of 32KB.
 It also incorporates 2 Comparators,10-bit Analog-to-Digital (A/D)
converter with 13 channels, and houses decent memory endurance
around 1,000,000 for EEPROM and 100,000 for program memory.
 The Enhanced Universal Asynchronous Receiver Transmitter
(EUSART) feature is useful for developing the serial communication
with other devices.

This PIC model is capable of performing many functions similar to


other controllers in the PIC community. Following are the main
functions of PIC18F4520.PIC18F4520 comes with three 16-bit and one
8-bit timer that can be used as a timer as well as a counter. All three
timers contain internal and external clock select capability.The timer
mode mainly increments the instruction cycle while the counter mode
is used to increment the rising and falling edge of the pin.The BOR is a
very useful function that allows this controller to reset once the Vdd
(voltage supply) drops below a brownout threshold voltage. The
multiple voltage ranges are used and provided to protect the chip once
the power drops at the voltage supply line.The Power Up Timer must
be kept enabled, in order to put the delay in returning the device from
a BOR function, tThe BOR mode can be configured both ways i.e.
through BOREN settings in a register as well through programming.

12
Figure No:1.1 Pin diagram of PIC18F4520
In-Circuit Serial Programming

In circuit serial programming (ICSP), is also called as the In-


system programming (ISP), is a feature added to this device that makes
it enable to be programmed in the required system after installation,
setting it free from programming the device before making it
compatible with the certain project.This controller version comes with
USART module, that stands for Universal Synchronous and
Asynchronous Receiver and Transmitter, and is mainly used for
setting up the serial communication with external devices.There are
two parts of this module called TX and RX where former is known as
transmitting component that is used for transmitting the serial
data. while later is known as receiving component, used for receiving
the serial data across the attached devices. PIC18F4520 contains a
built-in watchdog timer that brings the controller in reset position if
the program hangs up during compilation or gets stuck in the infinite
loop.It is worth mentioning here, this timer must be reset to the initial
value after every 3 instructions in order to avoid it going to zero value

13
in normal conditions.The watchdog timer is more or less a countdown
timer that starts from 1000 and ultimately goes down to zero.Power On
Reset function is very helpful and resets the controller and starts it
from scratch when Vdd raises above a certain threshold value. This
function is very useful to prevent the device from malfunctioning.
PIC18F4520 provides total 7 operating modes that help in more
efficient power management. These modes offer multiple options for
selective power conservation in a variety of applications. The power
managed modes are mainly divided into three main categories called:

 Run modes
 Sleep modes
 Idle modes

These categories help in identifying the areas of the device that are
clocked at a specific speed. The Idle and Run modes can operate in any
of three clock sources named primary, secondary, and internal
oscillator block while Sleep mode is not involved in any clock
source.The switching feature is added in the power managed modes
that use the Timer1 oscillator as a replacement of a primary oscillator.
All clocks will be cleared and stopped working in the Sleep mode.The
MCLR pin is used for calling the external reset for the chip. The reset is
triggered by keeping this pin at a LOW value and is not dependent on
the internal resets.The noise filter is added in the MCLR executing
process that helps in detecting and removing the small pulses. The
MCLRE configuration bit can also be used to disable MCLR input.

2.2.GSM MODULE

GSM is a mobile communication modem; it is stands for global system


for mobile communication (GSM). The idea of GSM was developed at
Bell Laboratories in 1970. It is widely used mobile communication
system in the world. GSM is an open and digital cellular technology
used for transmitting mobile voice and data services operates at the

14
850MHz, 900MHz, 1800MHz and 1900MHz frequency bands.GSM
system was developed as a digital system using time division multiple
access (TDMA) technique for communication purpose. A GSM digitizes
and reduces the data, then sends it down through a channel with two
different streams of client data, each in its own particular time slot.
The digital system has an ability to carry 64 kbps to 120 Mbps of data
rates.

Figure No:1.2 GSM Module

Features of GSM Module:

 Improved spectrum efficiency


 International roaming
 Compatibility with integrated services digital network (ISDN)
 Support for new services.
 SIM phonebook management
 Fixed dialing number (FDN)
 Real time clock with alarm management
 High-quality speech

15
 Uses encryption to make phone calls more secure
 Short message service (SMS)

2.3.PASSIVE INFRA-RED (PIR) SENSOR

PIR sensors allow you to sense motion, almost always used to detect
whether a human has moved in or out of the sensors range. They are
small, inexpensive, low-power, easy to use and don't wear out. For that
reason they are commonly found in appliances and gadgets used in
homes or businesses. PIRs are basically made of a pyroelectric sensor,
which can detect levels of infrared radiation. Everything emits some low
level radiation, and the hotter something is, the more radiation is
emitted. The sensor in a motion detector is actually split in two halves.
The reason for that is that we are looking to detect motion (change) not
average IR levels. The two halves are wired up so that they cancel each
other out. If one half sees more or less IR radiation than the other, the
output will swing high or low.
Features:
Output: Digital pulse high (3V) when triggered (motion detected) digital
low when idle (no motion detected). Pulse lengths are determined by
resistors and capacitors on the PCB and differ from sensor to sensor.
Power supply: 5V-12V input voltage for most modules (they have a
3.3V regulator), but 5V is ideal in case the regulator has different
specs.

Figure No:1.3 PIR Sensor

16
2.4.BUZZER

Figure No:1.4 Buzzer


Specifications
Rated Voltage : 6V DC
Operating Voltage : 4 to 8V DC
Rated Current* : ≤30mA
Sound Output at 10cm* : ≥85dB
Resonant Frequency : 2300 ±300Hz
Tone : Continuous
A buzzer is a loud noise maker. Most modern ones are civil defense or
air- raid sirens, tornado sirens, or the sirens on emergency service
vehicles such as ambulances, police cars and fire trucks. There are two
general types, pneumatic and electronic.

2.5.PUSH BUTTONS

Figure No:1.5 Push Button

17
A push button (also spelled push button) or simply button is a
simple switch mechanism to control some aspect of a machine or
a process. Buttons are typically made out of hard material,
usually plastic or metal .The surface is usually flat or shaped to
accommodate the human finger or hand, so as to be easily depressed
or pushed. Buttons are most often biased switches, although many un-
biased buttons (due to their physical nature) still require a spring to
return to their un-pushed state. Terms for the "pushing" or working of
it is being using for the button as well as by the manually and
include pressing, depressing, mashing, slapping, hitting, and punching.

2.6 16X2 LED DISPLAY

Liquid crystal display is a type of display which used in digital watches


and many portable computers. LCD displays utilize two sheets of
polarizing material with a liquid crystal solution between them.
An electric current passed through the liquid causes the crystals to
align so that light cannot pass through them. Each crystal, therefore, is
like a shutter, either allowing light to pass through or blocking the
light.
The liquid crystals can be manipulated through an applied electric
voltage so that light is allowed to pass or is blocked. By carefully
controlling where and what wavelength (color) of light is allowed to
pass, the LCD monitor is able to display images. A back light provides
LCD monitor’s brightness. Other advances have allowed LCD’s to
greatly reduce liquid crystal cell response times. Response time is
basically the amount of time it takes for a pixel to “change colors”. In
reality response time is the amount of time it takes a liquid crystal cell
to go from being active to inactive.

18
Figure No:1.6 16x2 LCD Display

They make complicated equipment easier to operate. LCD’s come in


many shapes and sizes but the most common is the 16 character x 4
line (16x4) display with no backlight. It requires only 11 connections –
eight bits for data (which can be reduced to four if necessary) and three
control lines (we have only used two here). It runs off a 5V DC supply
and only needs about 1mA of current. The display contrast can be
varied by changing the voltage into pin 3 of the display.
2.7.BATTERY

A battery is a device consisting of one or more electrochemical cells


with external connections for powering electrical devices such as
flashlights, mobile phones, and electric cars. When a battery is supply
electric power, its positive terminal is the cathode and its negative
terminal is the anode. The terminal marked negative is the source of
electrons that will flow through an external electric circuit to the
positive terminal. When a battery is connected to an external electric
load, a redox reaction converts high-energy reactants to lower-energy
products, and the free energy difference is delivered to the external
circuit as electrical energy. Historically the term "battery" specifically
referred to a device composed of multiple cells, however the usage has
evolved to include devices composed of a single cell.

Primary (single-use or "disposable") batteries are used once and


discarded, as the electrode materials are irreversibly changed during
discharge; a common example is the alkaline battery used for

19
flashlights and a multitude of portable electronic devices. Secondary
batteries (rechargeable) can be discharged and recharged multiple
times using an applied electric current; the original composition of the
electrodes can be restored by reverse current. Examples include
the lead acid batteries used in vehicles and lithium ion batteries used
for portable electronics such as laptops and mobile phones.

3.SOFTWARE REQUIREMENTS

3.1.PROTEOUS 8 PROFESSIONAL

Proteus is a simulation and design software tool developed by


Labcenter Electronics for Electrical and Electronic circuit design. It
also possess 2D CAD drawing feature. It deserves to bear the tagline
“From concept to completion”

It is a software suite containing schematic, simulation as well as PCB


designing.

 ISIS is the software used to draw schematics and simulate the


circuits in real time.The simulation allows human access during
run time,thus providing real time simulation.
 ARES is used for PCB designing.It has the feature of viewing output
in 3D view of the designed PCB along with components.
 The designer can also develop 2D drawings for the product.
ISIS has wide range of components in its library. It has sources, signal
generators, measurement and analysis tools like oscilloscope,
voltmeter, ammeter etc., probes for real time monitoring of the
parameters of the circuit, switches, displays, loads like motors and
lamps, discrete components like resistors, capacitors, inductors,
transformers, digital and analog Integrated circuits, semi-conductor
switches, relays, microcontrollers, processors, sensors etc.
ARES offers PCB designing up to 14 inner layers, with surface mount
and through hole packages. It is embedded with the foot prints of
different category of components like ICs, transistors, headers,
connectors and other discrete components. It offers Auto routing and

20
manual routing options to the PCB Designer. The schematic drawn in
the ISIS can be directly transferred ARES.

Figure No:1.7 Proteous Interface

Figure No:1.8 Proteous working

3.2 MPLABX IDE

MPLAB® X Integrated Development Environment (IDE) is an


expandable, highly configurable software program that incorporates
powerful tools to help you discover, configure, develop, debug and
qualify embedded designs for most of Microchip’s microcontrollers and
digital signal controllers. MPLAB X IDE works seamlessly with the

21
MPLAB development ecosystem of software and tools, many of which
are completely free. MPLAB X IDE brings a host of features to help you
quickly debug your projects and minimize your development time.
Some newer features include:

 Data Visualizer: No need to purchase extra visualizations tools


since real-time streaming data can be viewed in Data Visualizer
 I/O View: Pin states can be verified and manipulated with I/O
View for fast hardware verification
 Helpful Design Resources: Save time with useful links to software
libraries, datasheets and user guides that are provided
automatically
 Easy to Use: Register and bit definitions are now just a click
away.

Figure No:1.9 MPLABX IDE

MPLAB X IDE provides an extensive array of features for developing


and debugging applications on any device from the PIC microcontroller
product family. However, as with any feature-rich program, it can be a
challenge to learn to use all of its capabilities or even to find out what
all of those capabilities are. The goal of this section of the Developer
Help site is to help you to discover and learn how to use the many

22
available features that are sure to simplify and enhance your
development activities.

3.3.XC8 COMPILER

Available as free,and unrestricted-use downloads, our award-winning


MPLAB® XC C Compilers are comprehensive solutions for your project’s
software development. Finding the right compiler to support your
device is simple:

 MPLAB XC8 compiler supports all the 8-bit PIC® and


AVR® microcontrollers (MCUs).
 MPLAB XC16 supports all 16-bit PIC MCUs and dsPIC ® Digital
Signal Controllers (DSCs).
 MPLAB XC32/32++ supports all 32-bit PIC and SAM MCUs and
MPUs.

The MPLAB XC8 C Compiler is a free-standing, optimizing ISO C90


(popularly known as ANSI C) compiler. It supports all 8-bit PIC®
microcontrollers: PIC10, PIC12, PIC16 and PIC18 series devices, as well
as the PIC14000 device. The compiler is available for several popular
operating systems, including 32- and 64-bit Windows® and Mac OS® X
10.5. The compiler might also run on the various Linux® distributions,
such as Oracle Enterprise Linux 5, Ubuntu 8.x and 10.04, Red Hat
Enterprise Linux. The compiler is available in three operating modes:
Free, Standard or PRO. The Standard and PRO operating modes are
licensed modes and require a serial number to enable them. Free mode
is available for unlicensed customers. The basic compiler operation,
supported devices and available memory are identical across all modes.
The modes only differ in the level of optimization employed by the
compiler.

23
4.WORKING

4.1.BLOCK DIAGRAM

The block diagram below depicts the Architecture of the idea.

Figure No :2.0 Block Diagram

24
4.2.CIRCUIT DIAGRAM

Figure No:2.1 Circuit Diagram

4.3.PROGRAM CODE

#include<pic18f4520.h>/*HEADER FILE*/
void Delay_us(int us); /* FUNCTION DECLARATIONS*/
void Data(int Value);
void Cmd(int Value);
void Send2Lcd(const char Adr, const char *Lcd);
void main() /*MAIN FUNCTION*/
{
/* If you want your microcontroller to work at 1MHZ then comment the
three lines below */
OSCCONbits.IRCF0 = 1 ; // set internal clock to 8 MHz
OSCCONbits.IRCF1 = 1; // For Avoiding switch debouncing problem

25
OSCCONbits.IRCF2= 1;
ADCON1bits.PCFG0 = 1; // These 4 settings below determines the
analog or digital input
ADCON1bits.PCFG1 = 1; // In our case we are making all the pins
digital
ADCON1bits.PCFG2 = 1; // by setting them as 1111
ADCON1bits.PCFG3 = 1; // Check with the datasheet for a nice desc of
these bits and config.
ADCON0bits.ADON = 0; // Disabled ADC
TRISA=0xff; //PORTA CONFIGURED AS INPUT
TRISC=0X00; //PORTC CONFIGURED AS OUTPUT
TRISD=0X00; //PORTD CONFIGURED AS OUTPUT
if(PORTAbits.RA1==1)
{
Delay_us(25);
Cmd(0X30); //LCD SPECIFICATION COMMANDS
Delay_us(25);
Cmd(0X30); //LCD SPECIFICATION COMMANDS
Delay_us(25);
Cmd(0X30); //LCD SPECIFICATION COMMANDS
Delay_us(25);
Cmd(0X38); //DOUBLE LINE DISPLAY COMMAND
Cmd(0X06); //AUTO INCREMENT LOCATION ADDRESS COMMAND
Cmd(0X0C);//LCD DISPLAY ON COMMAND
Cmd(0X01);//CLEAR DISPLAY COMMAND
Send2Lcd(0x84," Hello Welcome");//DISPLAYS STRING IN THE FIRST
LINE
Send2Lcd(0xc0," to the project");//DISPLAYS STRING IN THE SECOND
LINE
Delay_us(100000);
while(PORTAbits.RA1==1){ //IF BUTTON IS ON
if(PORTAbits.RA0==1) // IF PIR SENSOR IS HIGH(ANIMAL IS
DETECTED)

26
{
PORTCbits.RC2=1; //BUZZER GETS TURNED ON
Cmd(0X01); // CLEARS THE LCD
Send2Lcd(0x84," detected"); // PRINTS DETECTED ON LCD
Delay_us(10000);
}
else
{
PORTCbits.RC2=0; //BUZZER GETS TURNED OFF
Cmd(0X01); // CLEARS SCREEN
Send2Lcd(0x84," Not detected");// PRINTS NOT DETECTED
Delay_us(10000);
}

}
}
void Send2Lcd(const char Adr, const char *Lcd)
{
Cmd(Adr); //ADDRESS OF LOCATION TO DISPLAY STRING
while(*Lcd!='\0') //CHECK FOR TERMINATION CHARACTER
{
Data(*Lcd); // DISPLAYS THE CHARACTER
Lcd++; //INCREMENT THE POINTER
}
}
void Delay_us(int us)
{
us=us>>1;
while(us!=1)
us--;
} //end of the code

27
4.4 WORKING DESCRIPTION

Working is an essence of our project. The working of our project is


completed successfully in proteous software simulation .
Basic targets of our idea is to intimate the farmer about the information
that animals entered into the field and to some extend try to frighthen
the animal with different types of sounds.The PIC18F4520
microcontroller is the control unit which is connected with GSM module
,LCD display ,PIR sensor,and Buzzer.
The GSM module is equipped with the farmers mobile contact .The
buzzer is loaded with different types of sounds.So,when ever the animal
comes into the field the PIR sensor gets interrupted and becomes
high.This information is sent to PIC18 micro controller.Now the PIC18
sents the information to GSM module to sent message or call to the
farmer.And also a message is diaplayed on the 16X2 LCD display that
the animal is detected and also buzzer rings continuosly.In this way the
intimation is sent to farmer through GSM module and also attention is
given to farmers near by that animal entered into the field using the
buzzer sounds and also message through LCD display.

5.CONCLUSIONS &FUTURE SCOPE


5.1.CONCLUSION
Hence the project has been successfully made and demonstrated
through simulation in proteous software with the help of pic18f4520
microcontroller.The project is also found useful in many cases like it can
be used in various domains like house protection from thiefs at night
times.

5.2.FUTURE SCOPE
The project is found to be useful in various domains and other places .
At night times ,this can be used for finding thiefs entering in to house.
It can be used to know whether the child has slept or wokeup by his
movement in cradle, and message can be sent to parent nearby at work

28
in home .One of the most needed advancement in the project is ,it
should be inculcated with different sounds in buzzer which frightens
animals ,which to some extends makes the animal to leave the field by
the time farmer takes necessary action to avoid the crop damage in prior.
It is one of the smart approach to avoid the damage of the crop.The use
of this system gives good output in future keeping in mind the
importance of crop and agriculture.

References

[1].Ms. Sneha Nahatkar, Prof. Avinash Gaur, Prof. Tareek M. Pattewa


“Design of a Home Embedded Surveillance System with Pyroelectric
Infrared Sensor & Ultra-Low Alert Power” International Journal of
Advanced Communication Engineering (IJARECE) Volume 1, Issue 3,
September 2012.
[2].M. Sathishkumar1, S.Rajini “Smart Surveillance System Using PIR
Sensor Network and GSM” International Journal of Advanced Research
in Computer Engineering & Technology (IJARCET) Volume 4 Issue 1,
January 2015.] S. Sivagamasundari, S. Janani, “Home surveillance
system based on MCU and GSM”, International journal of
communications and engineering, 2014, volume 06– no.6.
[3]. Padmashree S. Dhake, Sumedha S. Borde, “Embedded Surveillance
System Using PIR Sensor”, International Journal of Advanced
Technology in Engineering and Science, www.ijates.com Volume No.02,
Issue No. 03, March 2014.

29

You might also like