Documentation 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 40

CHAPTER-I

INTRODUCTION
1.1 INTRODUCTION
An Embedded System is a combination of computer hardware and software, perhaps
additional mechanical or other parts, designed to perform a specific function. A good example is the
microwave oven. Almost every household has one, and tens of millions of them are used every day,
but very few people realize that a processor and software are involved in the preparation of their
lunch or dinner.
This is in direct contrast to the personal computer in the family room. It too is comprised of
computer hardware and software and mechanical components (disk drives, for example). However,
a personal computer is not designed to perform a specific function rather; it is able to do many
different things. Many people use the term general-purpose computer to make this distinction clear.
As shipped, a general-purpose computer is a blank slate; the manufacturer does not know what the
customer will do wish it. One customer may use it for a network file server another may use it
exclusively for playing games, and a third may use it to write the next great American novel.
Frequently an embedded system is a component within some larger system. For example, modern
cars and trucks contain many embedded systems. One embedded system controls the antilock brakes,
other monitors and controls the vehicle’s emissions, and a third displays information on the
dashboard. In some cases, these embedded systems are connected by some sort of a communication
network, but that is certainly not a requirement.
At the possible risk of confusing you, it is important to point out that a general-purpose
computer is itself made up of numerous embedded systems. For example, my computer consists of a
keyboard, mouse, video card, modem, hard drive, floppy drive, and sound card-each of which is an
embedded system. Each of these devices contains a processor and software and is designed to
perform a specific function. For example, the modem is designed to send and receive digital data
over analog telephone line. That’s it and all of the other devices can be summarized in a single
sentence as well.
If an embedded system is designed well, the existence of the processor and software could
be completely unnoticed by the user of the device. Such is the case for a microwave oven, VCR, or
alarm clock. In some cases, it would even be possible to build an equivalent device that does not
contain the processor and software. This could be done by replacing the combination with a custom

B.TECH 1 Department of ECE


integrated circuit that performs the same functions in hardware. However, a lot of flexibility is lost
when a design is hard-cooled in this way. It is much easier, and cheaper, to change a few lines of
software than to redesign a piece of custom hardware.
1.2 REAL TIME SYSTEMS
One subclass of embedded is worthy of an introduction at this point. As commonly defined,
a real-time system is a computer system that has timing constraints. In other words, a real-time system
is partly specified in terms of its ability to make certain calculations or decisions in a timely manner.
These important calculations are said to have deadlines for completion. And, for all practical
purposes, a missed deadline is just as bad as a wrong answer.
The issue of what if a deadline is missed is a crucial one. For example, if the real-time system
is part of an airplane’s flight control system, it is possible for the lives of the passengers and crew to
be endangered by a single missed deadline. However, if instead the system is involved in satellite
communication, the damage could be limited to a single corrupt data packet. The more severe the
consequences, the more likely it will be said that the deadline is “hard” and thus, the system is a hard
real-time system. Real-time systems at the other end of this discussion are said to have “soft”
deadlines.
1.3 APPLICATIONS OF REAL TIME SYSTEMS
Nearly 99 percent of the processors manufactured end up in embedded systems. The
embedded system market is one of the highest growth areas as these systems are used in very market
segment- consumer electronics, office automation, industrial automation, biomedical engineering,
wireless communication, data communication, telecommunications, transportation, military and so
on.
a) Office Automation:
The office automation products using embedded systems are copying machine, fax machine,
key telephone, modem, printer, scanner etc.
b) Industrial Automation:
Today a lot of industries use embedded systems for process control. These include
pharmaceutical, cement, sugar, oil exploration, nuclear energy, electricity generation and
transmission. The embedded systems for industrial use are designed to carry out specific tasks such
as monitoring the temperature, pressure, humidity, voltage, current etc., and then take appropriate
action based on the monitored levels to control other devices or to send information to a centralized

B.TECH 2 Department of ECE


monitoring station. In hazardous industrial environment, where human presence has to be avoided,
robots are used, which are programmed to do specific jobs. The robots are now becoming very
powerful and carry out many interesting and complicated tasks such as hardware assembly.
c) Computer Networking:
Computer networking products such as bridges, routers, Integrated Services Digital
Networks (ISDN), Asynchronous Transfer Mode (ATM), X.25 and frame relay switches are
embedded systems which implement the necessary data communication protocols. For example, a
router interconnects two networks. The two networks may be running different protocol stacks. The
router’s function is to obtain the data packets from incoming pores, analyze the packets and send
them towards the destination after doing necessary protocol conversion. Most networking equipment,
other than the end systems (desktop computers) we use to access the networks, are embedded
systems.
d) Telecommunications:
In the field of telecommunications, the embedded systems can be categorized as subscriber
terminals and network equipment. The subscriber terminals such as key telephones, ISDN phones,
terminal adapters, web cameras are embedded systems. The network equipment includes
multiplexers, multiple access systems, Packet Assemblers Dissemblers (PADs), sate11ite modems
etc. IP phone, IP gateway, IP gatekeeper etc. are the latest embedded systems that provide very low
cost voice communication over the Internet.
e) Wireless Technologies:
Advances in mobile communications are paving way for many interesting applications using
embedded systems. The mobile phone is one of the marvels of the last decade of the 20th century. It
is a very powerful embedded system that provides voice communication while we are on the move.
The Personal Digital Assistants and the palmtops can now be used to access multimedia services
over the Internet. Mobile communication infrastructure such as base station controllers, mobile
switching centers are also powerful embedded systems.
f) Security:
Security of persons and information has always been a major issue. We need to protect our
homes and offices; and the information we transmit and store. Developing embedded systems for
security applications is one of the most lucrative businesses nowadays. Security devices at homes,

B.TECH 3 Department of ECE


offices, airports etc. for authentication and verification are embedded systems. Encryption devices
are nearly 99 percent of the processors that are manufactured end up in embedded systems.
Embedded systems find applications in every industrial segment consumer electronics,
transportation, avionics, biomedical engineering, manufacturing, process control and industrial
automation, data communication, telecommunication, defense, security etc. Used to encrypt the
data/voice being transmitted on communication links such as telephone lines. Biometric systems
using fingerprint and face recognition are now being extensively used for user authentication in
banking applications as well as for access control in high security buildings.

RPS
A
A
T LCD
T
IR- sensor-1 M
M
E
E
IR-sensor-2 G IOT
G MODULE
33

IR-sensor-3 22

88
BUZZER
PP
IR-sensor-4

1.4 BLOCK DIAGRAM FOR PROPOSED SYSTEM:


Block Diagram for Proposed System as shown in fig 1.1

B.TECH 4 Department of ECE


CHAPTER-2

HARDWARE DESCRIPTION
2.1 ARDUINO UNO
2.1.1 General Description of ARDUINO
Arduino is an open source microcontroller which can be easily programmed, erased and
reprogrammed at any instant of time. Introduced in 2005 the Arduino platform was designed to
provide an inexpensive and easy way for hobbyists, students and professionals to create devices that
interact with their environment using sensors and actuators. Based on simple microcontroller boards,
it is an open source computing platform that is used for constructing and programming electronic
devices. It is also capable of acting as a mini computer just like other microcontrollers by taking
inputs and controlling the outputs for a variety of electronics devices. It is also capable of receiving
and sending information over the internet with the help of various Arduino shields, which are
discussed in this paper. Arduino uses a hardware known as the Arduino development board and
software for developing the code known as the Arduino IDE (Integrated Development Environment).
Built up with the 8-bit Atmel AVR microcontroller's that are manufactured by Atmel or a 32-bit
Atmel ARM, these microcontrollers can be programmed easily using the C or C++ language in the
Arduino IDE. Unlike the other microcontroller boards in India, the Arduino boards entered the
electronic market only a couple of years ago, and were restricted to small scale projects only. People
associated with electronics are now gradually coming up and accepting the role of Arduino for their
own projects. This development board can also be used to burn (upload) a new code to the board by
simply using a USB cable to upload. The Arduino IDE provides a simplified integrated platform
which can run on regular personal computers and allows users to write programs for Arduino using
C or C++. With so many Arduino boards available in the market, selecting a particular development
board needs a variety of survey done with respect to their specifications and capabilities, which can
be used for the project execution according to its specified applications.[2]

B.TECH 5 Department of ECE


2.1.2 ARDUINO Features
High performance, low power AVR 8-bit micro controller
• Advanced RISC architecture
• 131 powerful instructions – most single clock cycle execution 8 general purpose
working registers ● 32
• Fully static operation
• Up to 16MIPS throughput at 16MHz
• On-chip 2-cycle multiplier
• High endurance non-volatile memory segments
• 32K bytes of in-system self-programmable flash program memory
• 1Kbytes EEPROM
• 2Kbytes internal SRAM
• Write/erase cycles: 10,000 flash/100,000 EEPROM
• Optional boot code section with independent lock bits
• In-system programming by on-chip boot program
• True read-while-write operation
• Programming lock for software security
• Peripheral features
• Two 8-bit Timer/Counters with separate prescaler and compare mode
• One 16-bit Timer/Counter with separate prescaler, compare mode, and capture
mode
• Real time counter with separate oscillator
• Six PWM channels
• 8-channel 10-bit ADC in TQFP and QFN/MLF package
• Temperature measurement
• Programmable serial USART
• Master/slave SPI serial interface
• Byte-oriented 2-wire serial interface (Phillips I2 C compatible)
• Programmable watchdog timer with separate on-chip oscillator
• On-chip analog comparator
• Interrupt and wake-up on pin change
• Special microcontroller features
• Power-on reset and programmable brown-out detection
• Internal calibrated oscillator
• External and internal interrupt sources
• Six sleep modes: Idle, ADC noise reduction, power-save, power-down, standby,
and extended standby.

B.TECH 6 Department of ECE


2.1.3 Types of ARDUINO Boards
Arduino boards are available with many different types of built-in modules in it. Boards such
as
a) ARDUINO BT: Use a built-in Bluetooth module, for wireless communication. These built-in
modules can also be available separately which can then be interfaced (mounted) to it. These
modules are known as Shield. Some of the most commonly used Shields are:
b) ARDUINO Ethernet shield: It that allows an Arduino board to connect to the internet using the
Ethernet library and to read and write an SD card using the SD library
c) ARDUINO Wireless shield: It allows your Arduino board to communicate wirelessly using
Zigbee
d) ARDUINO Motor Driver Shield: It allows your Arduino boards to interface with driver of a
motor etc.

2.1.4 Elements of ARDUINO Boards


Elements of an Arduino Board can be done into two categories:
• Hardware
• Software
HARDWARE
The Arduino Development Board consists of many components that together makes it work.
Here are some of those main component blocks that help in its functioning: [2]
a) Microcontroller: This is the heart of the development board, which works as a mini
computer and can receive as well as send information or command to the peripheral
devices connected to it. The microcontroller used differs from board to board; it also has
its own various specifications.
b) External Power Supply: This power supply is used to power the Arduino development
board with a regulated voltage ranging from 9 – 12 volts.
c) USB Plug: This plug is a very important port in this board. It is used to upload (burn) a
program to the microcontroller using a USB cable. It also has a regulated power of 5V
which also powers the Arduino board in cases when the External Power Supply is absent.
d) Internal Programmer: The developed software code can be uploaded to the
microcontroller via USB port, without an external programmer.

B.TECH 7 Department of ECE


e) Rese Button: This button is present on the board and can be used to resets the Arduino
microcontroller.
f) Analog Pins: There are some analog input pins ranging from A0 – A7 (typical). These
pins are used for the analog input / output. The no. of analog pins also varies from board
to board.
g) Digital I/O Pins: There are some digital input pins also ranging from 2 to 16 (typical).
These pins are used for the digital input / output. The no. of these digital pins also varies
from board to board.
h) Power and GND Pins: There are pins on the development board that provide 3.3, 5 volts
and ground through them.
SOFTWARE
The program code written for Arduino is known as a sketch. The software used for
developing such sketches for an Arduino is commonly known as the Arduino IDE. This IDE contains
the following parts in it:
a) Text Editor: This is where the simplified code can be written using a simplified version of C++
programming language.
b) Message Area: It displays error and also gives a feedback on saving and exporting the code.
c) Text: The console displays text output by the Arduino environment including complete error
messages and other information
d) Console Toolbar: This toolbar contains various buttons like Verify, Upload, New, Open, Save
and Serial Monitor. On the bottom right hand

B.TECH 8 Department of ECE


2.1.5 Pin Description:
The pin description is shown in fig 2.1[2]

Fig 2.1: Pin Description


ARDUINO Uno pinout – Power Supply
There are 3 ways to power the Arduino Uno:
• Barrel Jack - The Barrel jack, or DC Power Jack can be used to power your Arduino board.
The barrel jack is usually connected to a wall adapter. The board can be powered by 5-20
volts but the manufacturer recommends to keep it between 7-12 volts. Above 12 volts, the
regulators might overheat, and below 7 volts, might not suffice.
• VIN Pin -This pin is used to power the Arduino Uno board using an external power source.
The voltage should be within the range mentioned above.
• USB cable - when connected to the computer, provides 5 volts at 500mA.
There is a polarity protection diode connecting between the positive of the barrel jack to the VIN pin,
rated at 1 Ampere.

B.TECH 9 Department of ECE


The power source you use determines the power you have available for your circuit. For instance,
powering the circuit using the USB limits you to 500mA. Take into consideration that this is also
used for powering the MCU, its peripherals, the on-board regulators, and the components connected

B.TECH 10 Department of ECE


to it. When powering your circuit through the barrel jack or VIN, the maximum capacity available is
determined by the 5 and 3.3 volts regulators on-board the Arduino.
• 5v and 3v3
They provide regulated 5 and 3.3v to power external components according to manufacturer
specifications.
• GND
In the Arduino Uno pinout, you can find 5 GND pins, which are all interconnected. The GND
pins are used to close the electrical circuit and provide a common logic reference level throughout
your circuit. Always make sure that all GNDs (of the Arduino, peripherals and components) are
connected to one another and have a common ground.
• RESET - resets the Arduino
• IOREF -This pin is the input/output reference. It provides the voltage reference with which
the microcontroller operates.
• ARDUINO Uno Pinout – Analog IN
The Arduino Uno has 6 analog pins, which utilize ADC (Analog to Digital converter).
These pins serve as analog inputs but can also function as digital inputs or digital outputs.
Analog to Digital Conversion
ADC stands for Analog to Digital Converter. ADC is an electronic circuit used to convert
analog signals into digital signals. This digital representation of analog signals allows the processor
(which is a digital device) to measure the analog signal and use it through its operation. Arduino Pins
A0-A5 are capable of reading analog voltages. On Arduino the ADC has 10-bit resolution, meaning
it can represent analog voltage by 1,024 digital levels. The ADC converts voltage into bits which the
microprocessor can understand.
One common example of an ADC is Voice over IP (VoIP). Every smartphone has a
microphone that converts sound waves (voice) into analog voltage. This goes through the device’s
ADC, gets converted into digital data, which is transmitted to the receiving side over the internet.
Arduino Uno Pinout – Digital Pins
• Pins 0-13 of the Arduino Uno serve as digital input/output pins.
• Pin 13 of the Arduino Uno is connected to the built-in LED.
• In the Arduino Uno – pins 3,5,6,9,10,11 have PWM capability.

B.TECH
11 Department of ECE
It’s important to note that:

Each pin can provide/sink up to 40 mA max. But the recommended current is 20 mA. The
absolute max current provided (or sank) from all pins together is 200mA
• PWM
In general, Pulse Width Modulation (PWM) is a modulation technique used to encode a
message into a pulsing signal. A PWM is comprised of two key components: frequency and duty
cycle. The PWM frequency dictates how long it takes to complete a single cycle (period) and how
quickly the signal fluctuates from high to low. The duty cycle determines how long a signal stays
high out of the total period. Duty cycle is represented in percentage.
In Arduino, the PWM enabled pins produce a constant frequency of ~ 500Hz, while the duty cycle
changes according to the parameters set by the user. See the following illustration:
PWM signals are used for speed control of DC motors, dimming LEDs and more.
• Communication Protocols
• Serial (TTL) – Digital pins 0 and 1 are the serial pins of the Arduino Uno.

They are used by the onboard USB module.


• SPI – SS/SCK/MISO/MOSI pins are the dedicated pins for SPI communication. They
can be found on digital pins 10-13 of the Arduino Uno and on the ICSP headers.
• I2C – SCL/SDA pins are the dedicated pins for I2C communication. On the Arduino
Uno they are found on Analog pins A4 and A5.
• AREF – Reference voltage for the analog inputs.
• Interrupt – INT0 and INT1. Arduino Uno has two external interrupt pins.
• External Interrupt – An external interrupt is a system interrupt that occurs when
outside interference is present. Interference can come from the user or other hardware
devices in the network. Common uses for these interrupts in Arduino are reading the
frequency a square wave generated by encoders or waking up the processor upon an
external event.

Arduino has two forms of interrupt:


• External
• Pin Change

B.TECH
12 Department of ECE
There are two external interrupt pins on the Atmega168/328 called INT0 and INT1. Both INT0 and
INT1 are mapped to pins 2 and 3. In contrast, Pin Change interrupts can be activated on any of the
pins.
• ARDUINO Uno Pinout – ICSP Header

ICSP stands for In-Circuit Serial Programming. The name originated from In-System
Programming headers (ISP). Manufacturers like Atmel who work with Arduino have developed their
own in-circuit serial programming headers. These pins enable the user to program the Arduino
boards’ firmware. There are six ICSP pins available on the Arduino board that can be hooked to a
programmer device via a programming cable.
2.2 POWER SUPPLY
All digital circuits require regulated power supply. In this article we are going to learn how
to get a regulated positive supply from the mains supply.

Fig 2.2 Power supply


Figure 2.2 shows the basic block diagram of a fixed regulated power supply. Let us go through
each block. 2.2.1 Transformer:
The diagram of the transformer shown in fig 2.3

Fig 2.3:Transformer
A transformer consists of two coils also called as “WINDINGS” namely PRIMARY &
SECONDARY.

B.TECH
13 Department of ECE
They are linked together through inductively coupled electrical conductors also called as
CORE. A changing current in the primary causes a change in the Magnetic Field in the core & this
in turn induces an alternating voltage in the secondary coil. If load is applied to the secondary then
an alternating current will flow through the load. If we consider an ideal condition then all the energy
from the primary circuit will be transferred to the secondary circuit through the magnetic field.

2.2.2 Rectifier:
A rectifier is a device that converts an AC signal into DC signal. For rectification purpose we
use a diode, a diode is a device that allows current to pass only in one direction i.e. when the anode
of the diode is positive with respect to the cathode also called as forward biased condition & blocks
current in the reversed biased condition.
Rectifier can be classified as follows: a)
Half Wave rectifier:
The diagram of the half wave rectifier shown in fig 2.4

Fig 2.4:Half wave rectifier

This is the simplest type of rectifier as you can see in the diagram a half wave rectifier consists
of only one diode. When an AC signal is applied to it during the positive half cycle the diode is
forward biased & current flows through it. But during the negative half cycle diode is reverse biased
& no current flows through it. Since only one half of the input reaches the output, it is very inefficient
to be used in power supplies.
b) Full wave rectifier:
The Full wave rectifier as shown in fig 2.5

B.TECH
14 Department of ECE
Fig 2.5:Full wave rectifier

Half wave rectifier is quite simple but it is very inefficient, for greater efficiency we would like to
use both the half cycles of the AC signal. This can be achieved by using a center tapped transformer
i.e. we would have to double the size of secondary winding & provide connection. So during the
positive half cycle diode D1 conducts & D2 is in reverse biased condition. During the negative half
cycle diode D2 conducts & D1 is reverse biased. Thus we get both the half cycles across the load.

One of the disadvantages of Full Wave Rectifier design is the necessity of using a center
tapped transformer, thus increasing the size & cost of the circuit. This can be avoided by using the
Full Wave Bridge Rectifier.
c)Bridge Rectifier:
The diagram of bridge rectifier shown in fig 2.6

Fig 2.6: Positive Cycle of Bridge Rectifier

As the name suggests it converts the full wave i.e. both the positive & the negative half cycle
into DC thus it is much more efficient than Half Wave Rectifier & that too without using a center
tapped transformer thus much more cost effective than Full Wave Rectifier.

Full Bridge Wave Rectifier consists of four diodes namely D1, D2, D3 and D4. During the
positive half cycle diodes D1 & D4 conduct whereas in the negative half cycle diodes D2 & D3
conduct thus the diodes keep switching the transformer connections so we get positive half cycles in
the output The full bridge wave rectifier as shown in fig 2.7

B.TECH
15 Department of ECE
Fig 2.7:Negative Cycle of bridge Rectifier

If we use a center tapped transformer for a bridge rectifier we can get both positive & negative half
cycles which can thus be used for generating fixed positive & fixed negative voltages.

2.2.3 Filter Capacitor

Even though half wave & full wave rectifier give DC output, none of them provides a constant
output voltage. For this we require to smoothen the waveform received from the rectifier. This can
be done by using a capacitor at the output of the rectifier this capacitor is also called as “FILTER
CAPACITOR” or “SMOOTHING CAPACITOR” or “RESERVOIR CAPACITOR”. Even after
using this capacitor a small amount of ripple will remain.

We place the Filter Capacitor at the output of the rectifier the capacitor will charge to the peak
voltage during each half cycle then will discharge its stored energy slowly through the load while the
rectified voltage drops to zero, thus trying to keep the voltage as constant as possible .The output
wave form of filter capacitor as shown in fig 2.8

Fig 2.8: waveform of filter capacitor

B.TECH
16 Department of ECE
If we go on increasing the value of the filter capacitor then the Ripple will decrease. But then
the costing will increase. The value of the Filter capacitor depends on the current Consumed by the
circuit, the frequency of the waveform & the accepted ripple.

Where,
Vr = accepted ripple voltage.( should not be more than 10% of the voltage)
I= current consumed by the circuit in Amperes.
F= frequency of the waveform. A half wave rectifier has only one peak in one cycle so F=25hz
Whereas a full wave rectifier has Two peaks in one cycle so F=100hz.
2.2.4 Voltage Regulator
A Voltage regulator is a device which converts varying input voltage into a constant regulated
output voltage. Voltage regulator can be of two types
• Linear Voltage Regulator
Also called as Resistive Voltage regulator because they dissipate the excessive voltage resistively
as heat.
• Switching Regulators
They regulate the output voltage by switching the Current ON/OFF very rapidly. Since their
output is either ON or OFF it dissipates very low power thus achieving higher efficiency as compared
to linear voltage regulators. But they are more complex & generate high noise due to their switching
action. For low level of output power switching regulators tend to be costly but for higher output
wattage they are much cheaper than linear regulators. The switch regulator shown in fig 2.9

Fig 2.9:Switching Regulators


After filtering the rectifier output the signal is given to a voltage regulator. The maximum
input voltage that can be applied at the input is 35V.

B.TECH
17 Department of ECE
2.2.5 Circuit Diagram:
The circuit diagram shown in fig 2.10

Fig 2.10 Circuit Diagram of power supply

• IC 7805:
7805 is an integrated three-terminal positive fixed linear voltage regulator. It supports an
input voltage of 10 volts to 35 volts and output voltage of 5 volts. It has a current rating of 1
amp although lower current models are available. Its output voltage is fixed at 5.0V. The 7805
also has a built-in current limiter as a safety feature. 7805 is manufactured by many companies,
including National Semiconductors and Fairchild Semiconductors.
2.3 LCD ( Liquid Crystal Display)
To display interactive messages we're using LCD Module. We take a look at an smart LCD
show of lines, sixteen characters in keeping with line this is interfaced to the controllers. The protocol
(handshaking) for the display is as proven. Whereas D0 to D7th bit is the Data strains, RS, RW and
EN pins are the control pins and last pins are +5V, -5V and GND to offer supply. Where RS is the
Register Select, RW is the Read Write and EN is the Enable pin.
The display consists of internal byte-wide registers, one for instructions (RS=zero) and the second
for characters to be displayed (RS=1). It additionally includes a user-programmed RAM vicinity (the
man or woman RAM) that may be programmed to generate any favored character that can be
fashioned the usage of a dot matrix. To distinguish among these two facts regions, the hex command
byte 80 could be used to indicate that the display RAM deal with 00h can be selected.Port1 is used
to grant the command or statistics type, and ports 3.2 to3.4 provide register pick and study/write
ranges.
The show takes various quantities of time to perform the features as listed. LCD bit 7 is
monitored for common sense high (busy) to ensure the display is overwritten.

B.TECH
18 Department of ECE
Liquid Crystal Display also called as LCD may be very useful in offering user interface in addition
to for debugging purpose. The most not unusual sort of LCD controller is HITACHI 44780 which
provides a easy interface between the controller & an LCD. These LCD's are quite simple to interface
with the controller as well as are price effective. The LCD is shown in fig 2.11

Fig 2.11: 2x16 LCD Display


The most commonly used ALPHANUMERIC displays are 1x16 (Single Line & 16 characters),
2x16 (Double Line & 16 character per line) & 4x20 (four lines & Twenty characters per line). The
LCD requires 3 control lines (RS, R/W & EN) & 8 (or 4) data lines. The number on data lines depends
on the mode of operation. If operated in 8-bit mode then 8 data lines + 3 control lines i.e. total 11
lines are required and if operated in 4-bit mode then 4 data lines + 3 control lines i.e. 7 lines are
required. How do we decide which mode to use? It’s simple if you have sufficient data lines you can
go for 8 bit mode & if there is a time constrain i.e. display should be faster then we have to use 8-bit
mode because basically 4-bit mode takes twice as more time as compared to 8-bit mode.
Pin Symbol Function
1 VSS Ground
2 VDD Supply Voltage
3 Vo Contrast Setting
4 RS Register Select
5 R/W Read/Write Select
6 EN Chip Enable
Signal
7-14 DB0- Data Lines
DB7
15 A/VEE GND for
backlight
16 K VCC for backlight

Table 1

B.TECH
19 Department of ECE
When RS is low (zero), the statistics is to be handled as a command. When RS is excessive (1), the
records being sent is taken into consideration as textual content data which must be displayed on the
screen. When R/W is low (0), the facts at the statistics bus is being written to the LCD. When RW is
high (1), the program is effectively analyzing from the LCD. Most of the instances there's no need to
read from the LCD so this line can immediately be linked to GND for that reason saving one
controller line. The LCD interfacing shown in fig 2.12

Fig 2.12 :LCD Interfacing


2.3.1 Commands Used In LCD

2.4 Arduino IR Infrared Obstacle Avoidance Sensor Module:


The IR sensor shown in fig 2.13

Fig 2.13: Arduino IR Infrared Obstacle Avoidance Sensor Module

B.TECH
20 Department of ECE
The sensor module adaptable to ambient light, having a pair of infrared emitting and

receiving tubes, transmitting tubes emit infrared certain frequency, when the direction of an

obstacle is detected (reflection surface), the infrared reflected is received by the reception

tube, After a comparator circuit processing, the green light is on, but the signal output

interface output digital signal (a low-level signal), you can adjust the detection distance knob

potentiometer, the effective distance range of 2 ~ 30cm, the working voltage of 3.3V- 5V.

Detection range of the sensor can be obtained by adjusting potentiometer, with little

interference, easy to assemble, easy to use features, can be widely used in robot obstacle

avoidance, avoidance car, line count, and black and white line tracking and many other

occasions. [3]

2.4.1 Specifications

1.When the module detects an obstacle in front of the signal, the green indicator lights

on the board level, while the OUT port sustained low signal output, the module detects

the distance 2 ~ 30cm, detection angle 35 °, the distance can detect potential is

adjusted clockwise adjustment potentiometer, detects the distance increases; counter

clockwise adjustment potentiometer, reducing detection distance.

2.The sensor active infrared reflection detection, target reflectivity and therefore the

shape is critical detection distance. Where the minimum detection distance black,

white, maximum; small objects away from a small area, a large area from the Grand.

3. The sensor module output port OUT port can be directly connected to the

microcontroller IO can also be directly drive a 5V relay; Connection: VCC-VCC;

B.TECH
21 Department of ECE
GND-GND; OUT-IO

4. Comparators LM393, stable; 5. The module can be 3-5V DC power supply. When the power is
turned on, the red

5.power indicator lights;

6. With the screw holes 3mm, easy fixed installation;

7. Board size: 3.2CM * 1.4CM

8. Each module has been shipped threshold comparator voltage adjusted by potentiometer good,

non-special case, do not adjustable potentiometer.

Module Interface Description

1. VCC : 3.3V-5V external voltage (can be directly connected to 5v and 3.3v

MCU )

2. GND : GND External

3. OUT : small board digital output interface (0 and 1) The block diagram of the IR sensor as shown

in fig 2.14

Fig 2.14: BLOCK DIAGRAM OF IR SENSOR

2.5 BUZZER
2.5.1 General Description
A buzzer or beeper is an audio signaling device, which may be mechanical, electro

B.TECH
22 Department of ECE
mechanical, or piezoelectric. Typical uses of buzzers and beepers include alarm devices, timers and
confirmation of user input such as a mouse click or keystroke. Buzzer is an integrated structure of
electronic transducers, DC power supply, widely used in computers, printers, copiers, alarms,
electronic toys, automotive electronic equipment, telephones, timers and other electronic products
for sound devices. Active buzzer 5V Rated power can be directly connected to a continuous sound,
this section dedicated sensor expansion module and the board in combination, can complete a simple
circuit design, to “plug and play”.

2.5.2 Product Description


A buzzer or beeper is an audio Signaling device, which may be mechanical, electro
mechanical, or piezoelectric. Typical uses of buzzers and beepers include alarm devices, timers, and
confirmation of user input such as a mouse click or key stroke .It generates consistent single tone
sound just by applying D.C voltage Using a suitably designed resonant system, this type can be used
where large sound volumes are needed. At Future Electronics we stock many of the most common
types categorized by Type, Sound Level, Frequency, Rated Voltage, Dimension and Packaging
type.The diagram of the buzzer is shown in fig 2.15

Fig 2.15:BUZZER

2.5.3 Features:-

1.Input supply: 5 V DC

2.Current consumption: 9.0 mA max.

B.TECH
23 Department of ECE
3.Oscillating frequency:3.0 ±0.5 KHZ

4.Sound Pressure Level: 85dB min.

2.6 ESP8266 Wi-Fi MODULE

The diagram of the Wi-Fi module shown in fig 2.16

Fig2.16: Wi-Fi Module


The ESP8266 Wi-Fi Module is a self contained SOC with integrated TCP/IP protocol stack
that can give any microcontroller access to your Wi-Fi network. The ESP8266 is capable of either
hosting an application or offloading all Wi-Fi networking functions from another application
processor. Each ESP8266 module comes pre-programmed with an AT command set firmware,
meaning, you can simply hook this up to your microcontroller device and get about as much Wi-Fi
ability as a Wi-Fi Shield offers (and that's just out of the box)! The ESP8266 module is an extremely
cost effective board with a huge, and ever growing, community.

This module has a powerful enough on-board processing and storage capability that allows
it to be integrated with the sensors and other application specific devices through its GPIOs with
minimal development up-front and minimal loading during runtime. Its high degree of on-chip
integration allows for minimal external circuitry, including the front-end module, is designed to
occupy minimal PCB area. The ESP8266 supports APSD for VoIP applications and Bluetooth
coexistance interfaces, it contains a self-calibrated RF allowing it to work under all operating
conditions, and requires no external RF parts.

There is an almost limitless fountain of information available for the ESP8266, all of which
has been provided by amazing community support. In the Documents section below you will find

B.TECH
24 Department of ECE
many resources to aid you in using the ESP8266, even instructions on how to transform this module
into an IOT (Internet of Things) solution.

2.6.1 Features

ESP-01 module wireframe

• Processor: L106 32-bit RISC microprocessor core based on the Tensilica Xtensa Diamond
Standard 106Micro running at 80 MHz[5] Memory:
o 32 KiB instruction RAM o 32
KiB instruction cache RAM o 80
KiB user-data RAM o 16 KiB
ETS system-data RAM
• External QSPI flash: up to 16 MiB is supported (512 KiB to 4 MiB typically included)
• IEEE 802.11 b/g/n Wi-Fi o Integrated TR switch, balun, LNA, power amplifier and matching
network o WEP or WPA/WPA2 authentication, or open networks
• 17 GPIO pins
• SPI
• I²C (software implementation)[7]
• I²S interfaces with DMA (sharing pins with GPIO)
• UART on dedicated pins, plus a transmit-only UART can be enabled on GPIO2
• 10-bit ADC (successive approximation ADC)
2.6.2 Pin out of ESP-01

ESP-01 module pinout

The pinout is as follows for the common ESP-01 module:

1. GND, Ground (0 V)

2. GPIO 2, General-purpose input/output No. 2

3. GPIO 0, General-purpose input/output No. 0

4. RX, Receive data in, also GPIO3

5. VCC, Voltage (+3.3 V; can handle up to 3.6 V)

6. RST, Reset

B.TECH
25 Department of ECE
7. CH_PD, Chip power-down

8. TX, Transmit data out, also GPIO1

2.7 SCHEMATIC DIAGRAM OF THE PROPOSED SYSTEM:


The schematic diagram of the proposed system shown in fig 2.17

Fig 2.17: Schematic diagram of the proposed system

B.TECH
26 Department of ECE
CHAPTER-3
SOURCE CODE AND SOFTWARE DEVELOPMENT

3.1 SOURCE CODE


#include <Software Serial.h>

#include <Liquid Crystal.h>

Liquid Crystal lcd(8, 9, 10, 11, 12, 13); // 8-RS, 9-EN, 10-D4, 11-D5, 12-D6, 13-D7

long duration; int distance cm, distance Inch; int east_flag = 0; int west_flag = 0; int

north_flag= 0; int south_flag= 0;

Software Serial esp8266(6,7);

#define eastir 2

#define westir 3

#define southir 4

#define northir 5

#define buzzer A0

void title(void)

{ lcd.clear();

lcd.setCursor(0,0);

lcd.print("IOT BASED CROP ");

lcd.setCursor(0,1);

lcd.print("PROTECTION SYSM");

B.TECH
27 Department of ECE
delay(2000);

lcd.clear();

void setup() {

Send Data("AT+CWSAP=\"IOT_CROP\",\"12345678\",5,3\r\n",1000,DEBUG); // configure for


multiple connections

Send Data("AT+CIFSR\r\n",1000,DEBUG); // get ip address

Send Data("AT+CIPMUX=1\r\n",1000,DEBUG); // turn on server on port 80 Send

Data("AT+CIPSERVER=1,80\r\n",1000,DEBUG); // turn on server on port 80

lcd.clear();

lcd.begin(16, 2);

title();

delay(2000);

pinMode(eastir, INPUT);

pinMode(westir, INPUT);

pinMode(northir, INPUT);

pinMode(southir, INPUT);

pinMode(buzzer, OUTPUT);

title();

delay(2000);

lcd.clear();

} void loop() { if

(east_flag==0)

Digital Write(buzzer,HIGH);

B.TECH
28 Department of ECE
lcd.setCursor(0, 0);

lcd.print("EAST:US"); delay(1000);

else

lcd.setCursor(0, 0);

lcd.print("EAST:SF");

digitalWrite(buzzer,LOW);

if (west_flag==0)

Digital Write(buzzer,HIGH);

lcd.setCursor(9, 0);

lcd.print("WEST:US");

delay(1000);

else

lcd.setCursor(9, 0);

lcd.print("WEST:SF");

Digital Write(buzzer,LOW);

if (north_flag==0)

Digital Write(buzzer,HIGH);

B.TECH
29 Department of ECE
lcd.setCursor(0, 1);

lcd.print("NRTH:US");

delay(1000);

else

lcd.setCursor(0, 1);

lcd.print("NRTH:SF");

Digital Write(buzzer,LOW);

if (south_flag==0)

Digital Write(buzzer,HIGH);

lcd.setCursor(9, 1);

lcd.print("SUTH:US");

delay(1000);

else

lcd.setCursor(9, 1);

lcd.print("SUTH:SF");

Digital Write(buzzer,LOW);

if(connection Id >= 0)

B.TECH
30 Department of ECE
String web page = "<html><meta http-equiv=\"refresh\" content=\"10\">";

Web page += "<center><h1 style=\"color:red;text-align:center\">IOT BASED CROP


PROTECTION SYSTEM</h1>";

Web page += "<p><h2 style=\"color:green;text-align:center\">By ECE BATCH A1 </h2>";

Web page += "<p><h2>";

if (east_flag==0)

Web page+= "EAST_STATUS:UNSAFE";

else

Web page+= "EAST_STATUS:SAFE ";

Web page += "</p></h2>"; if

(west_flag==0)

Web page+= "WEST_STATUS:UNSAFE";

else

Web page+= "WEST_STATUS:SAFE ";

Web page += "</p></h2>";

if (north_flag==0)

Web page+= "NORTH_STATUS:UNSAFE";

else

Web page+= "NORTH_STATUS:SAFE ";

Web page += "</p></h2>";

if (south_flag==0)

Web page+= "SOUTH_STATUS:UNSAFE";

else

Web page+= "SOUTH_STATUS:SAFE ";

Web page += "</p></h2>";

B.TECH
31 Department of ECE
}

else

if(esp8266.available()) // check if the esp is sending a message

if(esp8266.find("+IPD,"))

delay(10);

connectionId = esp8266.read()-48;

if(digital Read(eastir) == LOW)

east_flag = 0;

else

east_flag = 1;

if(digital Read(westir) == LOW)

west_flag = 0;

else

west_flag = 1;

if(digitalRead(northir) == LOW)

north_flag = 0;

else

north_flag = 1;

if(digital Read(southir) == LOW)

south_flag = 0;

B.TECH
32 Department of ECE
else

south_flag = 1;

3.2 SOFTWARE DEVELOPMENT

These are the steps you need to follow in order to be up and running:

1. Get an Arduino board

2. Download the Arduino environment

3. Install the USB drivers


4. Connect the board
5. Upload a program

3.3 GET AN ARDUIN BOARD

Fig 3.1:Arduino board

B.TECH
33 Department of ECE
The Arduino I/O board is a simple circuit featuring the ATmega328P processor from Atmel.
The board is composed of a printed circuit board and electronic parts. Arduino board shown in fig
3.1

There are a few ways to get an Arduino board:


buy a ready made board. See how you can buy a board or just the PCB.

o European distributor

o US distributor

Build your own board. If you want you can build your own PCB just by downloading the
CAD files from the Hardware page. Extract the BRD file and send it to a PCB manufacturer. Be
aware that manufacturing a single PCB will be very expensive. It's better to get together with other
people and make 20 or 30 at a time. Since you get the full CAD files you can make your own
customized version of Arduino.

• Purchase parts

Purchase the parts from any electronics store. The Serial version in particular has been
designed to use the most basic parts that can be found anywhere in the world. The USB version
on the other hand requires some advanced soldering skills because of the FTDI chip that is an
SMD part.
• Assemble the board

We put together a step by step guide on how to build an Arduino board. Newbies: never
soldered before? afraid of trashing thousands of boards before getting one properly soldered?
fear not :) learn to master the art of soldering.

• Program the boot loader

In order for the development environment to be able to program the chip, this has to be
programmed with a piece of code called bootloader. See the bootloader page on how to program
it on your chip.

B.TECH
34 Department of ECE
3.4 DOWNLOAD THE ARDUINO ENVIRONMENT
To program the Arduino board you need the Arduino environment.
Download Arduino: From the software page.
Linux note: For help getting the Arduino IDE running on Debian, please see the FAQ
Mac OS X note: After downloading the IDE, run the macosx_setup.command. It corrects
permissionon a few files for use with the serial port and will prompt you for your password. You
may need to reboot after running this script. If you are using a USB Arduino, you will need to install
the drivers for the FTDI chip on the board. These can be found in the drivers directory of the Arduino
distribution. On Windows, you will need to unzip FTDI USB Drivers.zip. Then, when you plug in
the Arduino board, point the Windows Add Hardware wizard to the FTDI USB Drivers directory.
On the Mac, mount the FTDIUSB SerialDriver_v2_1_6.dmg (on PPC machines) or the FTDIUSB
Serial Driver_v2_2_6_Intel.
3.5 CONNECT THE BOARD
If you're using a serial board, power the board with an external power supply (6 to 25 volts
DC, with the core of the connector positive). Connect the board to a serial port on your computer.
On the USB boards, the power source is selected by the jumper between the USB and power plugs.
To power the board from the USB port (good for controlling low power devices like LEDs), place
the jumper on the two pins closest to the USB plug. To power the board from an external power
supply (needed for motors and other high current devices), place the jumper on the two pins closest
to the power plug. Either way, connect the board to a USB port on your computer. On Windows, the
Add New Hardware wizard will open; tell it you want to specify the location to search for drivers
and point to the folder containing the USB drivers you unzipped in the previous step.
The power LED should go on.
3.6 UPLOAD A PROGRAM
Open the LED blink example sketch: File > Sketchbook > Examples > Led_blink Here's what
the code for the LED blink example looks like, Select the serial device of the Arduino board from
the Tools | Serial Port menu. On Windows, this should be COM1 or COM2 for a serial Arduino
board, or COM3, COM4, or COM5 for a USB board. On the Mac, this should be something like
/dev/cu.usbserial-1B1 for a USB board, or something like /dev/cu.USA19QW1b1P1.1

B.TECH
35 Department of ECE
CHAPTER- 4 RESULTS DISCUSSION
4.1 RESULTS
The result of the project as shown in fig 4.1

Fig 4.1:output of the project


4.2 IMPLEMENTATION OF HARDWARE:
The smart crop protection system using sensors like IR Sensor. The IR sensor is used for obstacle
detection in the field and a buzzer is used to make the person alert. This ensures the complete safety
of crops from animals and from fire thus protecting the farmer's loss. This is an Arduino Uno-based
system using a microcontroller. This system uses a motion sensor to detect wild animals.

Fig 4.2:Output in the LCD

B.TECH
36 Department of ECE
CHAPTER-5
CONCLUSION AND FUTURE SCOPE
5.1 CONCLUSION:
This project has been designed and implemented on IOT based crop protection system from
animals using IR, IOT, ARDUINO components. The IR sensor that we are using measures the
distance, and buzzer that beeps when an obstacle is encountered. The IR Sensor senses whether there
is an object near it or not. IOT module helps them to give information to guardian where the person
is located.
We executed and got the satisfied results.

B.TECH
37 Department of ECE
5.2 APPLICATIONS AND ADVANTAGES

• Applications

1. Main application it is used to protect farm.


2. To be used in orchard/fruit garden.
3. To be used for vegetable garden.
4. To be used for security system for houses.[4]

• Advantages

1.Arduino Uno and IR sensors provide a cost-effective solution for crop protection.

2.They offer real-time monitoring and response capabilities.

3.The integration of Arduino Uno and IR sensors can reduce crop losses and increase overall
agricultural productivity[4]

B.TECH
38 Department of ECE
5.3 FUTURE SCOPE

In future, there will be very large scope, the protection system is planned to develop a smart
agro wireless communication system to connect with Fire sensor Soil moisture sensor for irrigation
system Temperature sensor in field Web camera functioning to detecting wild animal and for
monitoring field.

B.TECH
39 Department of ECE
REFERANCES:

1.2019 2nd International Conference on Intelligent Computing, Instrumentation and Control Technologies
(ICICICT)
Link-IoT Based Automated Crop Protection System | IEEE Conference Publication | IEEE Xplore

2. geeksforgeeks website link- What is Arduino? - GeeksforGeeks

3. T.Gayathri, S.Ragul, S.Sudharshanan, Corn farmland monitoring using wireless sensor network,
International Research Journal of Engineering and Technology (IRJET), e-ISSN: 2395-0056,
Volume: 02 Issue: 08 | Nov-2015

4. A. V. Deshpande, “Design and implementation of an intelligent security system for farm protection
from wild animals,” International Journal of Science and Research, ISSN (Online), pp. 2319–7064,
2016.

B.TECH
40 Department of ECE

You might also like