Documentation 2
Documentation 2
Documentation 2
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
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
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
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.
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.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
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
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.
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
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
B.TECH
17 Department of ECE
2.2.5 Circuit Diagram:
The circuit diagram shown in fig 2.10
• 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
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
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
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
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
8. Each module has been shipped threshold comparator voltage adjusted by potentiometer good,
MCU )
3. OUT : small board digital output interface (0 and 1) The block diagram of the IR sensor as shown
in fig 2.14
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”.
Fig 2.15:BUZZER
2.5.3 Features:-
1.Input supply: 5 V DC
B.TECH
23 Department of ECE
3.Oscillating frequency:3.0 ±0.5 KHZ
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
• 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
1. GND, Ground (0 V)
6. RST, Reset
B.TECH
25 Department of ECE
7. CH_PD, Chip power-down
B.TECH
26 Department of ECE
CHAPTER-3
SOURCE CODE AND SOFTWARE DEVELOPMENT
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
#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.setCursor(0,1);
lcd.print("PROTECTION SYSM");
B.TECH
27 Department of ECE
delay(2000);
lcd.clear();
void setup() {
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\">";
if (east_flag==0)
else
(west_flag==0)
else
if (north_flag==0)
else
if (south_flag==0)
else
B.TECH
31 Department of ECE
}
else
if(esp8266.find("+IPD,"))
delay(10);
connectionId = esp8266.read()-48;
east_flag = 0;
else
east_flag = 1;
west_flag = 0;
else
west_flag = 1;
if(digitalRead(northir) == LOW)
north_flag = 0;
else
north_flag = 1;
south_flag = 0;
B.TECH
32 Department of ECE
else
south_flag = 1;
These are the steps you need to follow in order to be up and running:
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
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.
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
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
• Advantages
1.Arduino Uno and IR sensors provide a cost-effective solution for crop protection.
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
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