Professional Documents
Culture Documents
[ii]
[iii]
LIST OF CONTENT
LIST OF FIGURES i
LIST OF TABLES ii
LIST OF ACRONYMS iii
ABSTRACT v
1. INTRODUCTION 1
2 LITERATURE REVIEW 6
2.1 Existing Methods 7
2.1.1 Anti – theft vehicle tracking system using GPS 7
And location prediction
2.1.2 Design of an intelligent autonomous accident 7
Prevention ,detection and vehicle monitoring
System
2.1.3 GSM based accelerometer mounted 8
accident detection
2.1.4 Blackspot alert and accident 8
2.15 Arduino based accident prevention system with eye 9
twitch and alcohol sensor
2.2 Proposed method 10
3 ARDUINO UNO 11
3.1 Microcontroller
3.1.1Introduction
3.1.2 Arduino UNO Microcontroller 13
3.1.3 Arduino UNO board 14
[iv]
4 HARDWARE COMPONENTS 19
4.1 Regulated power supply 20
4.2 MEMS 25
4.3 GPS 33
4.4 LCD 36
4.6 BC547 39
DC Motor 41
4.7 GSM 44
4.8 Buzzer 44
5 SOFTWARE DESCRIPTION 47
5.1 Arduino IDE 42
REFERENCES 53
APPENDIX 55
[v]
LIST OF FIGURES
Fig No Name Page No.
1.1 Basic Block Diagram 4
1.2 Basic Structure of an Embedded system 4
2.1 Block Diagram of accident alert system 9
3.1 Arduino UNO Board 13
3.2 Pin Description 15
4.1 Block diagram of power supply 20
4.2 Circuit illustration of bridge rectifier 21
4.3 Transformer core 21
4.4 Flow current for positive half cycle 22
4.5 Flow current for negative half cycle 22
4.6 Output of rectifier 23
4.7 Capacitive smoothing of rectifier output 23
4.8 Schematic symbol of piezoelectric sensor 25
4.9 Frequency response of piezoelectric sensor 25
4.10 Metal disk 26
4.11 Mems 27
4.12 GPS Receiver 31
4.13 Pin diagram of 1x16 LCD 34
4.14 Left hand thumb rule 38
4.15 DC Motor 39
5.1 Standard USB cable 42
5.2 Download Arduino IDE software 42
5.3 Launch Arduino IDE 43
5.4 Open new file 44
5.5 Open Blink 44
5.6 Select the Arduino UNO 45
5.7 Select serial port 45
5.8 Upload the program to your board 46
6.1 Vehicle automatic accident alert 48
[vi]
LIST OF TABLES
[vii]
LIST OF ACRONYMS
Symbol Name
ACC Accumulator
B B register
PSW Program status word
SP Stack pointer
DPTR Data pointer 2 bytes
DPL Low byte
DPH High byte
P0 Port 0
P1 Port 1
P2 Port 2
Port 3
IP Interrupt priority control
IE Interrupt enable control
TMOD Timer/counter mode control
TCON Timer/counter control
T2CON Timer/counter 2 control
T2MOD Timer counter mode 2 control
TH0 Timer/control 0 high byte
TL0 Timer/control 0 low byte
TH1 Timer/control 1 high byte
TL1 Timer/control 1 low byte
TH2 Timer/control 2 high byte
TL2 Timer/control 2 low byte
SCON Serial control
SBUF Serial data buffer
[viii]
LCD Liquid crystal display
PC Personal computer
RPS Regulated power supply
RMS Root mean square
EEPROM Electrically erasable programmable ROM
ROM Read only memory
RAM Random access memory
BIOS Basic input output system
SRAM Static RAM
EPROM Erasable programmable ROM
DRAM Dynamic RAM
ISR Interrupt service routine
I2C Inter integrated chip
[ix]
ABSTRACT
Fire is the most boundless reason for the unfortunate death and causing many injuries.The detection system
is intended to keep away individual from the Fire .
When the system detect the gas,fire or smoke ,it will immediately display an alert Notification
on LCD display and also gives alert by buzzer along simultaneously sending an SMS alert to user through
GSM.And when the system detects any kind of fire an AC water pump activated by a relay and starts to
pump water on the fire detected areas.An ESP32 Camera is also implanted at some particular areas where
there will be a high possibility for fire accidents.By adding this camera there is no need of implanting
extra CCTV cameras.And it also connectable through WI-FI to any Mobile or Computer for continuous
live stream with in a limited range of radius.
It always streams the visual information not started only when the fire occurs and used for surveillance purpose.
[x]
CHAPTER 1
INTRODUCTION
1
1. INTRODUCTION
The number of vehicle collisions in India is among the highest in the world. One major factor that
leads to these accidents becoming fatal is the response of the emergency services which in most cases are
not notified sufficiently within time as the passengers of the vehicle may not be in a state to make calls
or raise alarms. Our systems will detect the occurrence of an accident, notify the emergency services
with the exact location of this collision and also inform a select number of emergency contacts that have
been set by the user. The proposed system will detect the occurrence of the accident using various
sensors present in the system, detect the location of the vehicle using the GPS module along with the use
of Google Maps data and send the emergency messages and distress signals automatically in case of an
accident where the passengers are not in a state to respond/raise an alarm. The messages will be sent
using a GSM module present in our system. The system will always provide a small window of time for
the user to cancel the distress call in case of a rare occurrence of a false detection by our system so as to
not disturb the emergency services and also to not cause panic amongst the family and friends of the
user. If the user does not respond within the time delay, the system is activated and the necessary
processes are carried out.
2
A small-scale embedded system may not have RTOS.
So, we can define an embedded system as a Microcontroller based, software driven, and
reliable, real-time control system.
3
1.3 HARDWARE AND SOFTWARE SYSTEMS
Software is used for more features and flexibility. Hardware is used for performance and security.
• Sensor – It measures the physical quantity and converts it to an electrical signal which can be
read by an observer or by any electronic instrument like an A2D converter. A sensor stores the
measured quantity to the memory.
• A-D Converter – An analog-to-digital converter converts the analog signal sent by the sensor
into a digital signal.
• Processor &ASICs – Processors process the data to measure the output and store it to the
memory. D-A Converter – A digital-to-analog converter converts the digital data fed by the
processor to analog data.
• Actuator – An actuator compares the output given by the D-A Converter to the actual (expected)
output stored in it and stores the approved output.
4
1.5 MAIN AIM OF THE PROJECT
The main aim of the project is to help the people who met with an accident .whenever accident
occurs the alert message was send to the family members and respected mobile numbers.The mems
sensor senses the accident and gsm module send message alert and gps module will send location with
it. From this attempt we can save the person who had met with an accident by providing medical
treatment at right time.
5
CHAPTER 2
LITERTURE REVIEW
6
2.LITERATURE REVIEW
2.1EXISTINGMETHODS
There exist five existing methods in the development of a smart fire detetction and surveillance system..
• Aim: The traditional fire alarm system contains several types of devices to detect the fire and worn the
people through visual and audible. This type of alarm can automatically activated from heat and smoke
detector
• Year: 2017
7
2.1.3 Fire detection system
• Aim: In this project the gas sensor will detect the fire and this device
is connected to the buzzer to give alarming. So, the peoples inside the
building were alert and saves their lives
• Year: 2019
• Authors: AL Mamari ,kazmi , pandey And AL Hinai.
• Advantages:
o Quick response..
• Disadvantages:
o Use of multiple sensors
o Operate in certain range.
• Aim: T h e f i r e a l a r m s y s t e m b y u s i n g A r d u i n o
with can be used in
order to send direct temperature and smoke sensor information such
as smoke or temperature detected value using a specific device wright
strait to the fire department as SMS and MMS.
•
• Year: 2020
• Author: P a n d e y e t a l .
• Advantages:
o The possibility for occurance of accident is reduced.
o Aqurate result
• Disadvantages:
o More number of sensors are used.
8
2.1.5 Arduino based Accident prevention system with eztwitch and alcohol
sensor
• Aim: T h i s m a c h i n e h a s a n a l c o h o l s e n s o r i n s t a l l e d i n t h e v e h i c l e
and an eye blinking sensor.The eye blinking and alcohol level in
the breath hits the set level the buzzer emits vibration,led giows
and the vehicle slowly stopped automatically
• Year: 2019
• Author: P . U p e n d e r , G . N i k h i l r e d d y , G . S a n t o s h i n i
• Advantages
• The accident due to drink and drive is reduced.
• Disadvantages:
o . The accident which are under below the threshold level is not detected
9
PROPOSED METHOD
The proposed system will check whether an accident has occurred and identify the seriousness of
the injury to the accident victim/driver. Once the decision of serious accident has taken, the system will
check for the nearest medical center and notify them about the incident.
10
3.ARDUINO UNO
3.1 MICROCONTROLLER
3.1.1 Introduction:
Microcontroller as the name suggest, a small controller. They are like single chip computers
that are often embedded into other systems to function as processing/controlling unit. For example,
the control you are using probably has microcontrollers inside that do decoding another controlling
functions. They are also used in automobiles, washing machines, microwaves ovens, toys….etc,
where automation is needed.
3.1.2 Arduino Uno Microcontroller:
The Arduino Uno is a microcontroller board based on the ATmega328 (datasheet). It has 14
digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz crystal
oscillator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything
needed to support the microcontroller; simply connect it to a computer with a USB cable or power it
with a AC-to-DC adapter or battery to get started. The Uno differs from all preceding boards in that it
does not use the FTDI USB-to-serial driver chip. Instead, it features the Atmega8U2 programmed as a
USB-to-serial converter. "Uno" means "One" in Italian and is named to mark the upcoming release of
Arduino 1.0. The Uno and version 1.0 will be the reference versions of Arduino, moving forward. The
Uno is the latest in a series of USB Arduino boards, and the reference model for the Arduino
platform; for a comparison with previous versions, see the index of Arduino boards.
The power pins are as follows:
● VIN: The input voltage to the Arduino board when it’s using an external power source
(as opposed to5 volts from the USB connection or other regulated power source). You
can supply voltage through this pin, or, if supplying voltage via the power jack, access it
through this pin.
● 5V:The regulated power supply used to power the microcontroller and other components
on the board. This can come either from VIN via an on-board regulator, or be supplied
by USB or another regulated 5V supply.
● 3.3V:A 3.3 volt supply generated by the on-board regulator. Maximum current draw is
50 mA GND. Ground pins.
11
Memory:
The Atmega328 has 32 KB of flash memory for storing code (of which 0,5 KB is used for the
bootloader); It has also 2 KB of SRAM and 1 KB of EEPROM (which can be read and written with
the EEPROM library).
Input and Output:
Each of the 14 digital pins on the Uno can be used as an input or output, using pinMode(),
digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can provide or receive a
maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In
addition, some pins have specialized functions:
● Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data.
These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL
Serial chip
● External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a
low value, arising or falling edge, or a change in value. See the attach Interrupt() function
for details.
● PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.
● SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI
communication, which although provided by the underlying hardware, is not currently
included in the Arduino language.
● LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH
value, the LED is on, when the pin is LOW, it's off.The Uno has 6 analog inputs, each of
which provide 10 bits of resolution (i.e. 1024 different values). By default they measure
from ground to 5 volts, though is it possible to change the upper end of the using
AREFpin and the analogReference() function.
● Additionally, some pins have specialized.
Communication:
The Arduino Uno has a number of facilities for communicating with a computer, another
Arduino, or other microcontrollers. The ATmega328 provides UART TTL (5V) serial
communication, which is available on digital pins 0 (RX) and 1 (TX). An ATmega8U2 on the board
channels this serial communication over USB and appears as a virtual com port to software on the
computer. The '8U2 firmware uses the standard USBCOM drivers, and no external driver is needed.
12
However, on Windows,
13
an *.inf file is required. The Arduino software includes a serial monitor which allows simple textual
data to be sent to and from the Arduino board. The RX and TX LEDs on the board will flash when
data is being transmitted via the USB-toserial chip and USB connection to the computer (but not for
serial communication on pins 0 and 1).
3.1.3 Arduino UNO Board:
The Arduino Uno is a microcontroller board based on the ATmega328. It has 14 digital
input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic
resonator, a USB connection, a power jack, an ICSP header, and a reset button. It contains
everything needed to support the microcontroller; simply connect it to a computer with a USB cable
or power it with a AC-to-DC adapter or battery to get started.
14
The Uno differs from all preceding boards in that it does not use the FTDI USB-to-serial driver chip.
Instead, it features the Atmega16U2 (Atmega8U2 up to version R2) programmed as a USB-to-serial
converters.
1. USB Interface:
Arduino board can be powered by using the USB cable from your computer. All you
need to do is connect the USB cable to the USB connection
2. Externalpower supply:
Arduino boards can be powered directly from the AC mains power supply by connecting it to
the power supply (Barrel Jack)
3. Voltage Regulator:
The function of the voltage regulator is to control the voltage given to the Arduino
board and stabilize the DC voltages used by the processor and other elements.
4. Crystal Oscillator:
The crystal oscillator helps Arduino in dealing with time issues. The number printed on top
of the Arduino crystal is 16.000H9H. It tells us that the frequency is 16,000,000 Hertz or 16 MHz.
It can reset your Arduino board, i.e., start your program from the beginning. It can reset the
UNO board in two ways.
9 Pins (3.3, 5, GND, Vin):
15
● 3.3V (6): Supply 3.3 output volt
● 5V (7): Supply 5 output volt
● Most of the components used with Arduino board works fine with 3.3 volt and 5 volt.
● GND (8)(Ground): There are several GND pins on the Arduino.
● Vin (9): This pin also can be used to power the Arduino board from an external power
source, like AC mains power supply.
Each Arduino board has its own microcontroller (11). You can assume it as the brain of your
board. The main IC (integrated circuit) on the Ardsuino is slightly different from board to board.
The microcontrollers are usually of the ATMEL Company.
16
Pin Description:
VCC: Digital supply voltage.
GND:Ground.
17
ICSP pin: Mostly, ICSP (12) is an AVR, a tiny programming header for the Arduino
consisting of MOSI, MISO, SCK, RESET, VCC, and GND. It is often referred to as an SPI
(Serial Peripheral Interface), which could be considered as an "expansion" of the output.
Actually, you are slaving the output device to the master of the SPI bus.
Power LED indicator: This LED should light up when you plug your Arduino into a power
source to indicate that your board is powered up correctly. If this light does not turn on, then
there is something wrong with the connection.
TX and RX LEDs: On your board, you will find two labels: TX (transmit) and RX (receive).
They appear in two places on the Arduino UNO board. First, at the digital pins 0 and 1, to
indicate the pins responsible for serial communication. Second, the TX and RX led (13). The
TX led flashes with different speed while sending the serial data.
Digital I / O: The Arduino UNO board has 14 digital I/O pins (15) (of which 6 provide PWM
(Pulse Width Modulation) output. These pins can be configured to work as input digital pins to
read logic values (0 or 1) or as digital output pins to drive different modules like LEDs, relays,
etc. The pins labeled “~” can be used to generate PWM.
AREF: AREF stands for Analog Reference. It is sometimes, used to set an external reference
voltage (between 0 and 5 Volts) as the upper limit for the analog input pins working.
18
CHAPTER 4
HARDWARE COMPONENTS
19
4. HARDWARE COMPONENTS
The Hardware components used in this project are
Regulated Power Supply
MEMS
GPS
LCD
BC547
DC Motor
GSM
4.1 REGULATED POWER SUPPLY
The power supplies are designed to convert high voltage AC mains electricity to a suitable low voltage
supply for electronics circuits and other devices. A RPS (Regulated Power Supply) is the Power
Supply with Rectification, Filtering and Regulation being done on the AC mains to get a Regulated
power supply for Microcontroller and for the other devices being interfaced to it.
A power supply can be broken down into a series of blocks, each of which performs a particular
function. A D.C power supply which maintains the output voltage constant irrespective of A.C mains
fluctuations or load variations is known as “Regulated D.C Power Supply”. For example, a 5V regulated
power supply system as shown below:
Power supply is a reference to a source of electrical power. A device or system that supplies
electrical or other types of energy to an output load or group of loads is called a power supply unit or
PSU. The term is most commonly applied to electrical energy supplies, less often to mechanical ones,
and rarely to others. This power supply section is required to convert AC signal to DC signal and also to
reduce the amplitude of the signal.
20
The available voltage signal from the mains is 230V/50Hz which is an AC voltage, but the
required is DC voltage (no frequency) with the amplitude of +5V and +12V for various applications.
21
The secondary induced voltage VS, of an ideal transformer, is scaled from the primary VP by a
factor equal to the ratio of the number of turns of wire in their respective windings:
22
common application, for conversion of alternating current (AC) input into direct current (DC) output, it
is known as a bridge rectifier. A bridge rectifier provides full-wave rectification from a two-wire AC
input, resulting in lower cost and weight as compared to a center-tapped transformer design, but has two
diode drops rather than one, thus exhibiting reduced efficiency over a center-tapped design for the same
output voltage.
Basic Operation
When the input connected at the left corner of the diamond is positive with respect to the one
connected at the right hand corner, current flows to the right along the upper colored path to the output,
and returns to the input supply via the lower one.
Simple current flow for sine wave half cycle
Fig 4.4 Flow current for positive half cycle of sine wave
Fig 4.5 Flow current for negative half cycle of sine wave
23
In each case, the upper right output remains positive with respect to the lower right one.
The function of this capacitor, known as a reservoir capacitor (aka smoothing capacitor) is
to lessen the variation in (or 'smooth') the rectified AC output voltage waveform from the bridge. One
explanation of 'smoothing' is that the capacitor provides a low impedance path to the AC component of
the output, reducing the AC voltage across, and AC current through, the resistive load. In less technical
terms, any drop in the output voltage and current of the bridge tends to be cancelled by loss of charge in
thecapacitor.
24
4.5 Fire Sensor
A sensor which is most sensitive to a normal light is known as a fire sensor. That’s why this sensor module is used in flame
alarms. This sensor detects fire otherwise wavelength within the range of 760 nm – 1100 nm from the light source. This sensor can
be easily damaged to high temperature. So this sensor can be placed at a certain distance from the fire. The fire detection
can be done from a 100cm distance and the detection angle will be 600. The output of this sensor is an analog signal or
digital signal. These sensors are used in firefighting robots like as a fire alarm.
these sensors is faster as well as more accurate compare with a heat/smoke detector because of its mechanism
while detecting the flame.
Working Principle
This sensor/detector can be built with an electronic circuit using a receiver like electromagnetic radiation. This
sensor uses the infrared flame flash method, which allows the sensor to work through a coating of oil, dust, water vapor,
otherwise ice.
The pin configuration of this sensor is shown below. It includes four pins which include the following. When this
module works with a microcontroller unit then the pins are
The fire sensor circuit is too sensitive and can detect a rise in temperature of 10 degree or more in its vicinity. Ordinary
signal diodes like IN 34 and OA 71 exhibits this property and the internal resistance of these devices will decrease when
temperature rises. In the reverse biased mode, this effect will be more significant.
Typically, the diode can generate around 600 milli volts at 5 degrees centigrade. For each degree rise in temperature; the
diode generates 2 mV output voltage. That is at 5 degree it is 10 mV and when the temperature rises to 50 degrees, the diode will
give 100 milli volts. This voltage is used to trigger the remaining circuit.
Transistor T1 is a temperature-controlled switch and its base voltage depends on the voltage from the diode and from VR and
R1. Normally T1 conducts (due to the voltage set by VR) and LED glows. This indicates normal temperature.
When T1 conducts, base pf T2 will be grounded and it remains off to inhibit the Alarm generator. IC UM 3561 is used in the
circuit to give a Fire force siren. This ROM IC has an internal oscillator and can generate different tones based on its pin
connections. Here pin 6 is shorted with the VCC pin 5 to get a fire force siren.
When the temperature near the diode increases above 50 degrees, it conducts and ground the base of T1. This makes T1 off
and T2 on. Alarm generator then gets current from the emitter of T2 which is regulated by ZD to 3.1 volt and buffered by C1.
Resistor R4 (220K) determines the frequency of oscillation and the value 220K is a must for correct tone.
To set the fire sensor circuit, keep a lighted candle near the diode and wait for 1 minute. Slowly adjust VR till the alarm
sounds. Remove the heat. After one minute, alarm will turn off. VR can be used for further adjustments for temperature levels.
26
Figure 4.13: Circuit Diagram of Fire Sensor
Photosensitivity is high
Response time is fast
Simple to use
Sensitivity is adjustable
Detection angle is 600
Accuracy can be adjustable
Operating voltage of this sensor is 3.3V to 5V
Analog voltage outputs and digital switch outputs
The PCB size is 3cm X 1.6cm
Power indicator & digital switch o/p indicator
If the flame intensity is lighter within 0.8m then the flame test can be activated, if the flame intensity is high, then the
detection of distance will be improved.
Applications
27
These sensors are used in several dangerous situations which include the following.
Hydrogen stations
Industrial heating
Fire detection
Fire Alarm
Firefighting robots
Drying systems
Industrial gas turbines
Domestic heating systems
Gas-powered cooking devices
The ESP32-CAM has a very competitive small-size camera module that can operate independently as a minimum system
with a footprint of only 27*40.5*4.5mm and a deep sleep current of up to 6mA.
ESP-32CAM can be widely used in various IoT applications. It is suitable for home smart devices, industrial wireless
control, wireless monitoring, QR wireless identification, wireless positioning system signals and other IoT applications. It is an
ideal solution for IoT applications.
ESP-32CAM adopts DIP package and can be directly inserted into the backplane to realize rapid production of products,
providing customers with high-reliability connection mode, which is convenient for application in various IoT hardware terminals.
Pinout Diagram
The following image shows the pinout diagram for the ESP32-CAM AI-Thinker.
28
Figure 4.14: ESP32-CAM Pin Diagram
Power Pins
The ESP32-CAM comes with three GND pins (colored in black color) and two power pins (colored with red
color): 3.3V and 5V.
You can power the ESP32-CAM through the 3.3V or 5V pins. However, many people reported errors when
powering the ESP32-CAM with 3.3V, so we always advise to power the ESP32-CAM through the 5V pin.
There’s also the pin labeled on the silkscreen as VCC (colored with a yellow rectangle). You should not use that
pin to power the ESP32-CAM. That is an output power pin. It can either output 5V or 3.3V.
In our case, the ESP32-CAM outputs 3.3V whether it is powered with 5V or 3.3V. Next to the VCC pin, there
are two pads. One labeled as 3.3V and other as 5V.
If you look closely, you should have a jumper on the 3.3V pads. If you want to have an output of 5V on the VCC
pin, you need to unsolder that connection and solder the 5V pads.
Serial Pins
29
GPIO 1 and GPIO 3 are the serial pins (TX and RX, respectively). Because the ESP32-CAM doesn’t have a
built-in programmer, you need to use these pins to communicate with the board and upload code. The best way to
upload code to the ESP32-CAM is using an FTDI programmer. Learn how to upload code to the ESP32-CAM AI-
Thinker. You can use GPIO 1 and GPIO 3 to connect other peripherals like outputs or sensors after uploading the code.
However, you won’t be able to open the Serial Monitor and see if everything is going well with your setup.
GPIO 0
GPIO 0 determines whether the ESP32 is in flashing mode or not. This GPIO is internally connected to a pull-up
10k Ohm resistor. When GPIO 0 is connected to GND, the ESP32 goes into flashing mode and you can upload code to
the board.
To make the ESP32 run “normally”, you just need to disconnect GPIO 0 from GND.
The following pins are used to interface with the microSD card when it is on operation.
CLK GPIO 14
CMD GPIO 15
DATA0 GPIO 2
DATA2 GPIO 12
DATA3 GPIO 13
If you’re not using the microSD card, you can use these pins as regular inputs/outputs.
Camera Connections
The connections between the camera and the ESP32-CAM AI-Thinker are shown in the following table.
30
Table 4.3: OV2640 CAMERA ESP32 Variable name in code Camera
Connections
D0 GPIO 5 Y2_GPIO_NUM
D1 GPIO 18 Y3_GPIO_NUM
D2 GPIO 19 Y4_GPIO_NUM
D3 GPIO 21 Y5_GPIO_NUM
D4 GPIO 36 Y6_GPIO_NUM
D5 GPIO 39 Y7_GPIO_NUM
D6 GPIO 34 Y8_GPIO_NUM
D7 GPIO 35 Y9_GPIO_NUM
31
Features
Low power 32-bit CPU, can also serve the application processor
Supports UART/SPI/I2C/PWM/ADC/DAC
A smoke sensor is a device that senses smoke, typically as an indicator of fire. Commercial smoke detectors
issue a signal to a fire alarm control panel as part of a fire alarm system. Smoke detectors, also known as smoke alarms,
generally issue an audible or visual alarm from the detector itself or several detectors if there are multiple devices
interlinked.
32
Smoke detectors are usually housed in plastic enclosures, typically shaped like a disk about 150 millimeters (6 in) in
diameter and 25 millimeters (1 in) thick, but shape and size vary. Smoke can be detected either optically (photoelectric) or by
physical process (ionization). Detectors may use one or both sensing methods. Sensitive alarms can be used to detect and deter
smoking in banned areas. Smoke detectors in large commercial and industrial buildings are usually connected to a central fire alarm
system. Domestic smoke detectors range from individual battery-powered units to several interlinked units with battery backup.
With interlinked units, if any of them detects smoke, all of the alarms will trigger.
The risk of dying in a residential fire is cut in half with working smoke detectors. The US National Fire Protection
Association reports 0.53 deaths per 100 fires in homes with working smoke detectors compared to 1.18 deaths without (2009–
2013). Some homes do not have any smoke alarms and some homes do not have any working batteries in their smoke alarms.
The working of MQ-2 is that it contains tin dioxide as semiconductor particles is heated in air at high temperature,oxygen
is absorbed on the surface.
In clean air,donor electrons in tin dioxide are attracted toward oxygen which is absorbed on the surface of the sensing
material.This prevents electric current flow.
In the presence of reducing gases,the surface density of absorbed oxygen decreases as it reacts with the reducing
gases.Electrons are then realised into the tin dioxide,allowing current flow freely through the sensor
33
DHT 11:-
DHT11 sensor is a low cost digital sensor for sensing temperature and humidity and if any of the sensed by it ,then it will
report it to the aurdino microcontroller.
The main working principle of this sensor is ,it consists of a capacitive humidity sensing element and a thermistor for
sensing temperature.The humidity sensing capacitor has two electrodes with a moistrure holding substrate as a bdielectric
between them.
Change in the capacitance value occurs with the change in humidity levels.The IC measure ,process this changed
resistance values and change them into digital form.
For measuring temperature this sensor uses a negative temperature coefficient thermistor,which causes a decrease in its
resistance value with increase in temperature.
The temperature range of DHT11 is from 0 to 50 degree Celsius with a 2-degree accuracy.Humidity range of this sensor is
from 20% to 80% with 5% accuracy
DHT11 sensor has four pins-VCC,GND,Data pin and a not connected pin.A pull-up resistor of 5k to 10k ohms is provided
for communication between sensor and aurdino board.
34
35
4.4LCD (Liquid Crystal Display)
THEORY:
A liquid crystal is a material (normally organic for LCDs) that will flow like a liquid but whose
molecular structure has some properties normally associated with solids. The Liquid Crystal Display
(LCD) is a low power device. The power requirement is typically in the order of microwatts for the LCD.
However, an LCD requires an external or internal light source. It is limited to a temperature range of
about 0C to 60C and lifetime is an area of concern, because LCDs can chemically degrade.
There are two major types of LCDs which are:
1. Dynamic-scattering LCDs
2. Field-effect LCDs
Field-effect LCDs are normally used in such applications where source of energy is a prime
factor (e.g., watches, portable instrumentation etc.). They absorb considerably less power than the
lightscattering type. However, the cost for field-effect units is typically higher, and their height is limited
to 2 inches. On the other hand, light-scattering units are available up to 8 inches in height. Field-effect
LCD is used in the project for displaying the appropriate information.
The turn-on and turn-off time is an important consideration in all displays. The response time of
LCDs is in the range of 100 to 300ms.The lifetime of LCDs is steadily increasing beyond 10,000+hours
limit. Since the color generated by LCD units is dependent on the source of illumination, there is a wide
range of color choice.
Shapes and sizes:
Even limited to character based modules, there is still a wide variety of shapes and sizes available.
Line lengths of 8,16,20,24, 32 and 40 characters’ are all standard, in one, two and four line versions.
Several different LC technologies exist. “Supertwist” types, for example, offer improved contrast and
36
viewing angle over the older “twisted nematic” types. Some modules are available with back lighting, so
that they can be viewed in dimly-lit conditions. The back lighting may be either “electroluminescent”,
requiring a high voltage inverter circuit, or simple LED illumination.
fig:16*2 LCD
PIN DESCRIPTION:
Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has 16 Pins (two pins are
extra in both for back-light LED connections).
37
38
CONTROL LINES:
EN:
Line is called "Enable." This control line is used to tell the LCD that you are sending it data. To send
data to the LCD, your program should make sure this line is low (0) and then set the other two control
lines and/or put data on the data bus. When the other lines are completely ready, bring EN high
(1) and wait for the minimum amount of time required by th9-e LCD datasheet (this varies from LCD to
LCD), and end by bringin0g it low (0) again.
RS:
Line is the "Register Select" line. When RS is low (0), the data is to be treated as a command or special
instruction (such as clear screen, position cursor, etc.). When RS is high (1), the data being sent is text
data which should be displayed on the screen. For example, to display the letter "T" on the screen you
would set RS high.
RW:
Line is the "Read/Write" control line. When RW is low (0), the information on the data bus is being
written to the LCD. When RW is high (1), the program is effectively querying (or reading) the LCD.
Only one instruction ("Get LCD status") is a read command. All others are write commands, so RW will
almost always be low..
Writing data to the LCD:
1) Set R/W bit to low
2) Set RS bit to logic 0 or 1 (instruction or character)
3) Set data to data lines (if it is writing)
4) Set E line to high
• Ehp[Set E line to low
Read data from data lines (if it is reading) on LCD:
1) Set R/W bit to high
2) Set RS bit to logic 0 or 1 (instruction or character)
3) Set data to data lines (if it is writing)
4) Set E line to high
5) Set E line to low
39
Features and Specifications
• Operating Voltage is 4.7V to 5.3V
• Current consumption is 1mA without backlight
• Alphanumeric LCD display module, meaning can display alphabets and numbers
• Consists of two rows and each row can print 16 characters.
• Each character is build by a 5×8 pixel box
• Can work on both 8-bit and 4-bit mode
• It can also display any custom generated characters
• Available in Green and Blue Backlight
BRIEF DESCRIPTION ON LCD MODULES
The 16×2 LCD is named so because; it has 16 Columns and 2 Rows. There are a lot of
combinations available like, 8×1, 8×2, 10×2, 16×1, etc. but the most used one is the 16×2 LCD. So, it
will have (16×2=32) 32 characters in total and each character will be made of 5×8 Pixel Dots.
Initialization by Instructions:
If the power conditions for the normal operation of the internal reset circuit are not satisfied,
then executing a series of instructions must initialize LCD unit. The procedure for this initialization
process is as above show.
40
4.7 GSM
A GSM module or a GPRS module is a chip or circuit that will be used to establish communication between a
mobile device or a computing machine and a GSM or GPRS system .GSM (Global System for Mobile
Communications, originally Groupe Spécial Mobile), is a standard developed by the European
Telecommunications Standards Institute (0).It was created to describe the protocols for second-generation (0)
digital cellular networks used by mobile phones and is now the default global standard for mobile
communications – with over 90% market share, operating in over 219 countries and
territories.
It’s functions include:
4.6.1 Send SMS messages.
4.6.2 Monitor the signal strength.
4.6.3 Monitor the charging status and charge level of the battery.
4.6.4 Read, write and search phone book entries.
41
4.8 BUZZER:
Types of buzzer:
Electromechanical
Early devices were based on an electromechanical system identical to an electric bell without the metal gong.
Similarly, a relay may be connected to interrupt its own actuating current, causing the contacts to buzz (the
contacts buzz at line frequency if powered by alternating current. Often these units were anchored to a wall or
ceiling to use it as a sounding board. The word "buzzer" comes from the rasping noise that electromechanical
buzzers made.
Mechanical
A joy buzzer is an example of a purely mechanical buzzer and they require drivers. Other examples of them are
doorbells.
42
A element may be driven by an electronic circuit or other source, Driven with a Sounds commonly used to indicate
43
A pump is a device that moves fluids (liquids or gases), or sometimes slurries,[1] by mechanical action, typically converted
from electrical energy into hydraulic energy. Pumps can be classified into three major groups according to the method they
use to move the fluid: direct lift, displacement, and gravity pumps.[2]
Pumps operate by some mechanism (typically reciprocating or rotary), and consume energy to perform mechanical
work moving the fluid. Pumps operate via many energy sources, including manual operation, electricity, engines, or wind
power, and come in many sizes, from microscopic for use in medical applications, to large industrial pumps.
Mechanical pumps serve in a wide range of applications such as pumping water from wells, aquarium filtering, pond filtering
and aeration, in the car industry for water-cooling and fuel injection, in the energy industry for pumping oil and natural gas or
for operating cooling towers and other components of heating, ventilation and air conditioning systems. In the medical
industry, pumps are used for biochemical processes in developing and manufacturing medicine, and as artificial
replacements for body parts, in particular the artificial heart and penile prosthesis.
When a casing contains only one revolving impeller, it is called a single-stage pump. When a casing contains two or more
revolving impellers, it is called a double- or multi-stage pump.
In biology, many different types of chemical and biomechanical pumps have evolved; biomimicry is sometimes used in
developing new types of mechanical pumps.
44
CHAPTER 5
SOFTWARE DESCRIPTION
45
5. SOFTWARE IMPLEMENTATION
5.1 Arduino IDE:
In this section, we will learn in easy steps, how to set up the Arduino IDE on our computer and
prepare the board to receive the program via USB cable.
Step 1 − First you must have your Arduino board (you can choose your favorite board) and a USB
cable. In case you use Arduino UNO, Arduino Duemilanove, Nano, Arduino Mega 2560, or
Diecimila, you will need a standard USB cable (A plug to 0B plug), the kind you would connect to
a USB printer as shown in the following image.
In case you use Arduino Nano, you will need an A to Mini-B cable instead as shown in below
46
an Arduino Diecimila, you have to make sure that the board is configured to draw power from
the USB connection. The power source is selected with a jumper, a small piece of plastic that
fits onto two of the three pins between the USB and power jacks. Check that it is on the two
pins closest to the USB port.
Connect the Arduino board to your computer using the USB cable. The green power LED
(labeled PWR) should glow.
Step 4 − Launch Arduino IDE.
After your Arduino IDE software is downloaded, you need to unzip the folder. Inside the
folder.
you can find the application icon with an infinity label (application.exe). Double-click the
icon to start the IDE.
47
To create a new project, select File → New.
48
Here, we are selecting just one of the examples with the name Blink. It turns the LED on
and off with some time delay. You can select any other example from the list.
Step 6 − Select your Arduino board.
To avoid any error while uploading your program to the board, you must select the correct
Arduino board name, which matches with the board connected to your computer.
Go to Tools → Board and select your board.
49
Step 8 − Upload the program to your board.
Before explaining how we can upload our program to the board, we must demonstrate the
function of each symbol appearing in the Arduino IDE toolbar.
error.
board.
F − Serial monitor used to receive serial data from the board and send the serial data to the board.
Now, simply click the "Upload" button in the environment. Wait a few seconds; you will see the RX and
TX LEDs on the board, flashing. If the upload is successful, the message "Done uploading" will appear
in the status bar.
50
CHAPTER 6
RESULTS
51
6. RESULTS
This is the snapshot of my project kit when we switch on the power supply.
This is the snapshot of my project kit when it sends a alert when accident occurred to the respected
mobile number.
Fig’s 6.1 arduino based vehicle accident alert system using gsm.gps and mems acclerometer
This is the snap shot of the message send to the mobile number when accident occurs
52
CHAPTER 7
ADVANTAGES AND APPLICATIONS
53
7. ADVANTAGES AND APPLICATIONS
Advantages
Sensitivity of the alarm system .
Speed of response or increases response times,as they are able to alert the correct people
in order to extinguish the fire .
Range of applications
Alert people of a potential fire
Prevent the damage to the property as well as to the lives.
As the ESP-32 camera installed there will be no need to install the CCTV cameras
additionally.
This module can be connected to sprinklers through through AC water pump that will
automatically respond when a fire is detected.
Applications
It is applicable in ambulance management system.
It is used in road travelling services.
Driver monitoring.
54
CHAPTER 8
CONCLUSION AND FUTURE SCOPE
55
CONCLUSION AND FUTURE SCOPE
Conclusion
The detection system is intended to keep away individual from the Fire . In future this device is connected to IOT
and WI-FI modules to sending the collected data to the website, where authorized persons can take action.
In future we can connect the camera actions to the website and can access through in mobile view also.
And it can also sends SMS along with Location to the near by FIRE CONTROL department.
56
References
Sourabh Jamadagni, Priyanka Sankpal, Shwetali Patil, Nikita Chougule and Shailesh Gurav “Gas Leakage and Fire Detection using
Raspberry Pi”, 3rd International Conference on Computing Methodologies and Communication (ICCMC) doi:10.1109/ICCMC.
2019.8819678
S. Bayoumi, E. AlSobky, M. Almohsin, M. Altwaim, M. Alkaldi and M. Alkahtani, "A Real-Time Fire Detection and
Notification System Based on Computer Vision", 2013 International Conference on IT Convergence and Security
(ICITCS), Macao, , 2013. doi: 10.1109/ICITCS.2013.6717783
Md. Mahamudul Hasan, M. Abdur Razzak. “An Automatic Fire Detection and Warning System Under Home Video
Surveillance”, IEEE 12th International Colloquium on Signal Processing & Its Applications (CSPA), doi:
10.1109/CSPA.2016.7515842
Shin-Juh Chen, et al. "Fire detection using smoke and gas sensors", Fire Safety Journal, Vol.42(8), pp.507-515.
57
APPENDIX
#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
SoftwareSerial iot(6, 7); // RX, TX
const int rs = 13, en = 12, d4 = 11, d5 = 10, d6 = 9, d7 = 8;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
#include <SimpleDHT.h>
int pinDHT11 = 2;
SimpleDHT11 dht11(pinDHT11);
int gas=3;
int sound=4;
int motor=5;
const int buzzer=A0;
void buzzerinit()
{
pinMode(buzzer, OUTPUT);digitalWrite(buzzer,LOW);delay(10);
}
void beep()
{
digitalWrite(buzzer,HIGH);delay(1000);digitalWrite(buzzer,LOW);delay(1000);
digitalWrite(buzzer,HIGH);delay(1000);digitalWrite(buzzer,LOW);delay(1000);
}
String number="9014475682";
int message=0;
int times=0;
String getmobilenumber()
{
/*String number="9014475682";
int message=0;*/
Serial.begin(9600);
lcd.clear();lcd.print("AT");Serial.print("AT\r\n");delay(1000);
lcd.clear();lcd.print("ATE0");Serial.print("ATE0\r\n");delay(1000);
lcd.clear();lcd.print("AT+CMGF=1");Serial.print("AT+CMGF=1\r\n");delay(1000);
lcd.clear();lcd.print("AT+CNMI=1,2,0,0");Serial.print("AT+CNMI=1,2,0,0\r\n");delay(1000);
lcd.clear();lcd.print("AT+CLIP=1");Serial.print("AT+CLIP=1\r\n");delay(1000);
lcd.clear();lcd.print("Ph.No:");
for(int i=7;i<=17;i++)
58
{
number[i-7]=siva[ourdata+i];
}
message=1;
lcd.print(number);delay(1000);
lcd.setCursor(0,1);lcd.print("Sending sms....");
Serial.end();delay(10000);Serial.begin(9600);delay(1000);
Serial.print("AT+CMGS=");
Serial.print('"');
Serial.print(number);
Serial.print('"');
Serial.print("\r\n");delay(1000);
Serial.print(number);Serial.print(":Number Registed");delay(100);
Serial.write(0x1A);delay(10000);
Serial.end();delay(10000);Serial.begin(9600);delay(1000);
lcd.clear();lcd.print("sms sent.....");
return number;
}
if(message==0)
goto back;
}
void setup()
{
buzzerinit();
pinMode(motor, OUTPUT);digitalWrite(motor,HIGH);delay(10);
Serial.begin(9600);iot.begin(9600);delay(1000);
pinMode(gas,INPUT);pinMode(sound,INPUT);delay(10);
lcd.begin(16, 2);lcd.print("SMART FIRE ");
lcd.setCursor(0, 1);lcd.print("DETECTION & SERIVALANCE");delay(1000);
getmobilenumber();
}
void loop()
{
/* byte temperature = 0;
byte humidity = 0;
int err = SimpleDHTErrSuccess;
if ((err = dht11.read(&temperature, &humidity, NULL)) != SimpleDHTErrSuccess) {
//Serial.print("Read DHT11 failed, err="); Serial.print(SimpleDHTErrCode(err));
//Serial.print(","); Serial.println(SimpleDHTErrDuration(err)); delay(1000);
//return;
}
int temp=((int)temperature);delay(100);
int hum=((int)humidity);delay(100);
}
*/
int gasval=digitalRead(gas);delay(10);
if(gasval==LOW)
{
iot.println("SMOKE_DETECTED._ALERT..");delay(100);
lcd.clear();lcd.print("SMOKE DETECTED");delay(1000);beep();
Serial.print("AT+CMGS=");
Serial.print('"');
Serial.print(number);
Serial.print('"');
Serial.print("\r\n");delay(1000);
Serial.print(number);Serial.print("SMOKE DETECTED. ALERT..");delay(100);
Serial.write(0x1A);delay(10000);
}
if(gasval==HIGH)
{
lcd.clear();lcd.print("SMOKE NOT FOUND");delay(1000);
}
int soundval=digitalRead(sound);delay(10);
if(soundval==LOW)
{
iot.println("FIRE_DETECTED,_ALERT");delay(100);
lcd.clear();lcd.print("FIRE
DETECTED");delay(1000);beep();digitalWrite(motor,LOW);delay(10);
Serial.print("AT+CMGS=");
Serial.print('"');
Serial.print(number);
Serial.print('"');
Serial.print("\r\n");delay(1000);
Serial.print(number);Serial.print("FIRE DETECTED, ALERT");delay(100);
Serial.write(0x1A);delay(10000);
}
if(soundval==HIGH)
{
lcd.clear();lcd.print("FIRE NOT FOUND");delay(1000);digitalWrite(motor,HIGH);delay(10);
}
60
if(message==0)
goto back;
}
void beep()
{
digitalWrite(buzzer,HIGH);
delay(1000);
digitalWrite(buzzer,LOW);
del ay(1000);
digitalWrite(buzzer,HIGH);
delay(1000);
digitalWrite(buzzer,LOW);
del ay(1000);
}
void setup()
{
pinMode(motor,OUTPUT);
digitalWrite(motor,LOW);
pinMode(buzzer,OUTPUT);
digitalWrite(buzzer,LOW);
beep();
Serial.begin(9600);
lcd.begin(16,2);
lcd.print("Accident Alert");
lcd.setCursor(0,1);
lcd.print("System Usin GSM");
delay(2000);
lcd.clear();
lcd.print("Initializing");
lcd.setCursor(0,1);
lcd.print("Please Wait.................");
delay(1000);
beep();
regnumber();
lcd.clear();
void loop()
{
back:
int x=analogRead(A4);
delay(10);
int y=analogRead(A5);
delay(10);
lcd.clear();
lcd.print("x:");
lcd.print(x);
lcd.print(" y:");
lcd.print(y);
delay(1000);
if((x<300)||(x>370)||(y>370)||(y<300))
{
lcd.clear();
lcd.print("VIBRATION ALERT...");
delay(1000);
beep();
digitalWrite(motor,LOW);
delay(1000);
data="vibration_occured";
delay(1000);
Send();
goto back;
}
else{
digitalWrite(motor,HIGH);
delay(1000);
lcd.clear();
lcd.print("NO PROBLEM HERE");
delay(1000); 62
}
}
void gpsEvent()
{
gpsString="";
while(1)
{
while (gps.available()>0) //Serial incoming data from
GPS
{
char inChar = (char)gps.read();
gpsString+= inChar; //store incoming data from GPS to
temparary string str[]
i++;
// Serial.print(inChar); if (i < 7)
{
Serial.println(latitude);
Serial.print("Longitude:");
Serial.println(longitude);
Serial.print("Speed(in knots)=");
Serial.println(Speed);*/
delay(2000);
lcd.clear();
// lcd.print("Speed(Knots):");
//lcd.setCursor(0,1);
//lcd.print(Speed);
}
64
void coordinate2dec()
{
String lat_degree="";
for(i=19;i<=20;i++)
lat_degree+=gpsString[i];
// Serial.println(lat_degree);
String lat_minut="";
for(i=21;i<=30;i++)
lat_minut+=gpsString[i];
//Serial.println(lat_minut);
String log_degree="";
for(i=32;i<=34;i++)
log_degree+=gpsString[i];
//Serial.println(log_degree);
String log_minut="";
for(i=35;i<=44;i++)
log_minut+=gpsString[i];
// Serial.println(log_minut);
Speed="";
for(i=45;i<48;i++) //extract longitude from string
Speed+=gpsString[i];
minut= log_minut.toFloat();
minut=minut/60;
degree=log_degree.toFloat();
logitude=degree+minut;
//Serial.println(logitude);
}
void Send()
{
lcd.clear();
lcd.print("Sending Sms");
lcd.setCursor(0,1);
lcd.print("To");l
cd.print(number);
delay(1000);
Serial.println("AT");
delay(500);
65
Serial.println("AT+CMGF=1");
delay(500);
Serial.print("AT+CMGS=");
Serial.print('"');
Serial.print(number); //mobile no. for SMS alert
Serial.println('"');
delay(1000);
Serial.print(data); serial.print(" ");
Serial.print("Latitude:");
Serial.println(latitude,6);
delay(500);
Serial.print(" longitude:");
Serial.println(logitude,6);
delay(500);
66
67
68