Вы находитесь на странице: 1из 57

Design and Implementation of Car Black Box

With Collision Avoidance System


PROJECT REPORT
Submitted in partial fulfillment of the
requirement for the award of the
Degree of

BACHELOR OF TECHNOLOGY

In

ELECTRONICS & COMMUNICATION ENGINEERING

By

ARUN KUMAR-1209731025
ASHUTOSH MANI TRIPATHI-1209731026
BIKASH KR. MISHRA-1209731031
BRIJESH BAJPAI-1209731032
Under the Guidance of

Mr. SACHIN KUMAR PAL


ASSISTANT PROFESSOR, GCET

GALGOTIAS COLLEGE OF
ENGINEERING AND TECHNOLOGY
DECLARATION

We hereby declare that this submission is our own work and to the best of our
knowledge and belief, it contains no material previously published or written by
any other person nor material which to a substantial extent has been accepted
for the award of any other degree or diploma of the university or other institute
of higher learning, except where due acknowledgement has been made in the
text.

Arun Kumar (1209731025)

Ashutosh Mani Tripathi (1209731026)

Bikash Kumar Mishra (1209731031)

Brijesh Bajpai (1209731032)


CERTIFICATE

This is to certify that “ARUN KUMAR, ASHUTOSH MANI TRIPATHI,


BIKASH KUMAR MISHRA, BRIJESH BAJPAI” have carried out the
project work presented in this report entitled “DESIGN AND
IMPLEMENTATION OF CAR BLACK BOX WITH COLLISION
AVOIDANCE SYSTEM” for award of degree of Bachelor of Technology
(E.C.E) from UPTU, under my guidance and supervision. The report embodies
the result of original work and studies are carried out by the students
themselves.

Mr Pradyot Kala Mr Sachin Kumar Pal


H.O.D (EC Dept.) Project Guide
Assistant Professor (EC Dept.)
ACKNOWLEDGEMENT

We wish to express our deep sense of gratitude to Mr Sachin Kumar Pal,


Assistant Professor (EC), our project guide for his valuable guidance and
suggestions at all stages of this work. His constructive criticism of our approach
to the problems and results obtained during the course of this work helped us to
a great extent in bringing this work to its present state.
We are grateful to Mr Pradyot Kala (HOD EC) for his encouragement and help
with resources in accomplishing the project.

Arun Kumar (1209731025)

Ashutosh Mani Tripathi (1209731026)

Bikash Kumar Mishra (1209731031)

Brijesh Bajpai (1209731032)


TABLE OF CONTENTS

A) ABSTRACT………………………………………………...……………...1
B) LIST OF SYMBOLS………………………………………..……………...2

1. INTRODUCTION
1.1 BACKGROUND....………………………………………..………..….3

1.2 PROBLEM STATEMENT....…………………………...……………...4


1.3 OBJECTIVES…………………………………………...……………...4
1.4 FUTURE SCOPE………………………...……………………………..5

2. DESCRIPTION OF COMPONENTS USED IN THE PROJECT

2.1 MICROCONTROLLER (ATmega32)

2.1.1 DESCRIPTION…………………………………………………..6
2.1.2 PIN CONFIGRUATION……………………………...…………9
2.1.3 PIN DESCRIPTION………………………………..…....……...10
2.1.4 BLOCK DIAGRAM…………………………….……….……...12
2.1.5 MEMORY ORGANIZATION………………….……….……...13
2.1.6 INTERRUPTS…………………………………….…………….14
2.2 SENSORS
2.2.1 TEMPERATURE SENSOR (LM35)………………….………..15
2.2.2 ULTRASONIC SENSOR (HC-SR04)…………………….……17
2.2.3 GAS SENSOR/ALCOHOL SENSOR (MQ5)…………….……18
2.2.4 INFRARED SENSOR FOR SPEED MEASUREMENT………20
2.3 MOTOR
2.3.1 DESCRIPTION………………………….…………………...…26
2.4 TRANSFORMER
2.4.1 DESCRIPTION………………………………….…………27
2.4.2 TRASFORMER WORKING…………………….………...28
2.4.3 E.M.F. EQUATION OF A TRANSFORMER…….……….30
2.5 LCD
2.5.1 DESCRIPTION……………………………………....……32
2.6 LM741 OPERATIONAL AMPLIFIER…………………………..34
2.7 PIEZOELECTRIC BUZZER……………………………………..35
2.8 L7805CV VOLTAGE REGULATOR……………………………36
2.9 RELAY, POTENTIOMETER, BATTERIES…………………….37

3. PROJECT IMPLEMENTATION
3.1 SOFTWARE DESCRIPTION……………….………………..40
3.2 CIRCUIT DIAGRAM………………………….……………...41
3.3 SIMULATION IN PROTEUS………………….……………..42
3.4 WORKING PRINCIPLE……………………………………...45

4. CONCLUSION……………………………………….………………46

5. FUTURE ENHANCEMENTS………………………...…………….47

6. APPENDIX (CODE)…………………………………………………48

7. REFERENCES………………………………....…………………….51
ABSTRACT

Automobile Black Box is a digital data recorder used to record information


related to accidents in automobiles. It provides critical data for crash
investigation as the Black box in an aircraft provides critical data for air crash
investigations. Black box can effectively track the happenings in vehicles
during and after the crash. The data from the Black box is accompanied by the
inputs given by victims and eye witnesses.

The main purpose of this project is to develop a prototype of Black Box For
vehicle diagnosis that can be installed into any vehicle. This prototype can be
designed with minimum number of circuits. This can contribute to construct
safer vehicles, improving the treatment for crash victims, helping insurance
companies with their vehicle crash investigations, and enhancing road status in
order to decrease the death rate.

This project presents an advanced step to the concept of car black-box in


developing a comprehensive vehicle safety system which would not only record
the all the necessary information, but also try to prevent a possible collision by
taking certain precautions, such as the use of alcohol sensor which won’t allow
the person to drive car if alcohol is detected.

1
LIST OF SYMBOLS

SYMBOLS MEANING

NA Number of turns in primary

NB Number of turns in secondary

Ø Flux in the core

F Frequency of alternating current input in Hertz

EA r.m.s value of induced e.m.f in primary

EB r.m.s value of induced e.m.f in secondary

K Voltage Transformation Ratio

B Magnetic Field Intensity

2
1. INTRODUCTION

1.1 BACKGROUND

The vehicle accident is a major public problem in many countries, particularly


India. Despite awareness campaign, this problem is still increasing due to rider's
poor behaviours such as speed driving, drunk driving, riding without sufficient
sleep, etc. The numbers of death and disability are very high because of late
assistance to people who got the accident. These cause huge social and
economic burdens to people involved. Therefore, several research group and
major motorcycle manufacturers have developed safety devices to protect riders
from accidental injuries. However, good safety device for vehicles is difficult to
implement and very expensive. On the roadway driver usually keep a safety
distance from one another. On the other hand, due to the driver’s interruption,
long-time driving tiredness, or a sudden break applied by another car, a serious
collision may occur. Even though the driver is in a conscious mind, he cannot
respond immediately to control his/her vehicle. Sometimes crash may occurs
due to bad weather situations as mist, vapour, fog and so on.

Therefore, with the help of obstacle detection and distance measurement sensor,
a front end collision warning system is developed to prevent vehicle from the
collision is named as VVCAU. Many cases remain pending due to unknown
reason of an accident. To avoid these problems, a design is proposed to enhance
on-board recording device (i.e. Black Box). Car black box is a digital electronic
device, which records and store vehicle speed, real time and vehicle's other
status information. It helps to discover and to analyse the reason of an accident
easily and to settle many disputes related to car accident such as crash litigation,
insurance settlements.

It can be used to not only reconstruct what happened before an accident by


Insurance agents and police but improve vehicle design, roadway design and
emergency medical service by automakers, government and hospital. Hence a
combined system is essential to provide the solution for all the above problems.
The proposed system will make use of all the above mentioned modules like
VVCAU, and BB at a low cost.

3
1.2 PROBLEM STATEMENT

According to the World Health Organization, more than a million people in the
world die each year because of transportation-related accidents. In order to react
to this situation, the black box system draws the first step to solve problem. Like
flight data recorders in aircraft, "Black Box” technology can now play a key
role in motor vehicle crash investigations.

A significant number of vehicles currently on the roads contain electronic


systems that record in the event of a crash. That is why it is so important to have
recorders that objectively track what goes on in vehicles before, during and after
a crash as a complement to the was used. Subjective input that is taken usually
from victims, eye witnesses and police reports.

The number of on road vehicles is increasing every day which is leading to


many road accidents. In case of an accident, the passengers are protected by
means of various active and passive safety systems that are incorporated into the
vehicles. But identification of real cause of an accident is very important for
many reasons such as to find out the true culprit, for insurance agencies, for
crime cases etc. The true cause of accident can be found if the events that lead
to the accident are known. Thus, finding out the cause for the accident is
necessary which can be achieved using Black Box.

1.3 OBJECTIVES

The project aims to develop a prototype for a car black box which can perform
the function of data recording for the purpose to help in after crash
investigations and function of collision avoidance which will help in keeping
the driver alert so that any chances of possible collision can be averted. To
realize these two functions in our project we have two units which are explained
below:

I. Vehicle to vehicle collision avoidance unit: This unit will be responsible for
the avoidance of collision at any cost. It consist of sensors such as ultrasonic
sensor which will alert the driver if it approach some other car or border of the
road too close and gas/alcohol sensor which will detect if the driver is under the
influence of alcohol or not; if driver is under the influence of alcohol then it
won’t allow the engine to start. Thus avoiding any possible collision.

4
II. Data recording unit: This function of this unit is to record the necessary
data which can help us in the after crash investigation in any possible way. Such
as engine temperature, speed of the car, distance, seat belt status, alcohol status
etc
(Although we have only used four sensors in our project which are ultrasonic
sensor, infrared sensor, alcohol sensor, temperature sensor. We can add whole
lot of different types of sensor in order to record different parameters.)

1.4 FUTURE SCOPE


Excessive speed is a significant factor in many road accident fatalities. Many
push above speed limits on urban streets and the open road. Is there a simple
way to monitor the behaviour of drivers, respond quickly to isolated accidents,
and greatly improve the attitudes and behaviour of drivers in order to make a
major impact on road accidents and trauma?

Yes, there is a way to do this and much more. We can use current technology to
monitor and educate all drivers everywhere at all times. We can do this without
invading the privacy or civil liberties of drivers. We can do it at a very small
cost compared with the potentially massive direct and indirect savings.

Black box are amazing devices and there is no doubt that the future scope for
these devices is very bright. In fact leading technology enthusiasts believe that
these devices would be one of the primary safety and monitoring devices that
would be installed inside car in the future. It is understandable that in recent
future these devices will become one of the important aspect behind the safety
of personal vehicles such as car and they will become significant part like they
have become in the safety of aeroplanes.

Some of the functions that would be performed by the car black box are given
below:

1. Better crash research that may produce improved driver education programs,
safer road designs and improve highway safety.
2. Collision data for research, data to improve vehicle design internally and
externally.
3. To not only record the relevant data, but also try and prevent a possible
collision by limiting the speed of the vehicle in accident-prone areas.
4. Wireless communication by transmission of alert message in the event of a
collision along with the time and location co-ordinates through GSM.

5
With the increasing pace of technology, internet applications can be added to
the project for making it faster, more efficient, and cost effective.

2. DESCRIPTION OF COMPONENTS USED IN THE


PROJECT

2.1 MICROCONTROLLER (ATmega32)

2.1.1 DESCRIPTION
The Atmel®AVR®ATmega32 is a low-power CMOS 8-bit microcontroller
based on the AVR enhanced RISC architecture. By executing powerful
instructions in a single clock cycle, the ATmega32 achieves throughputs
approaching 1 MIPS per MHz allowing the system designer to optimize power
consumption versus processing speed.

Features

1. High-performance, Low-power Atmel®AVR® 8-bit Microcontroller.


2. Advanced RISC Architecture
 131 Powerful Instructions – Most Single-clock Cycle Execution
 32 × 8 General Purpose Working Registers
 Fully Static Operation
 Up to 16 MIPS Throughput at 16MHz
 On-chip 2-cycle Multiplier
3. High Endurance Non-volatile Memory segments
 32Kbytes of In-System Self-programmable Flash program memory
 1024Bytes EEPROM
 2Kbytes Internal SRAM
 Write/Erase Cycles: 10,000 Flash/100,000 EEPROM
 Data retention: 20 years at 85°C/100 years at 25°C
 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
4. JTAG (IEEE std. 1149.1 Compliant) Interface
 Boundary-scan Capabilities According to the JTAG Standard
 Extensive On-chip Debug Support
 Programming of Flash, EEPROM, Fuses, and Lock Bits through the
JTAG Interface

6
5. Peripheral Features
 Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes
 One 16-bit Timer/Counter with Separate Prescalers, Compare Mode, and
Capture Mode
 Real Time Counter with Separate Oscillator
 Four PWM Channels
 8-channel, 10-bit ADC
 8 Single-ended Channels
 7 Differential Channels in TQFP Package Only
 2 Differential Channels with Programmable Gain at 1x, 10x, or
200x
 Byte-oriented Two-wire Serial Interface
 Programmable Serial USART
 Master/Slave SPI Serial Interface
 Programmable Watchdog Timer with Separate On-chip Oscillator
 On-chip analog Comparator
6. Special Microcontroller Features
 Power-on Reset and Programmable Brown-out Detection
 Internal Calibrated RC Oscillator
 External and Internal Interrupt Sources
 Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-
down, Standby and Extended Standby
7. I/O and Packages
 32 Programmable I/O Lines
 40-pin PDIP, 44-lead TQFP, and 44-pad QFN/MLF
8. Operating Voltages
 2.7V - 5.5V for ATmega32L
 4.5V - 5.5V for ATmega32
9. Speed Grades
 0 - 8MHz for ATmega32L
 0 - 16MHz for ATmega32
10. Power Consumption at 1MHz, 3V, 25°C
 Active: 1.1mA
 Idle Mode: 0.35mA
 Power-down Mode: < 1μA

7
The Atmel®AVR®AVR core combines a rich instruction set with 32 general
purpose working registers. All the 32 registers are directly connected to the
Arithmetic Logic Unit (ALU), allowing two independent registers to be
accessed in one single instruction executed in one clock cycle. The resulting
architecture is more code efficient while achieving throughputs up to ten times
faster than conventional CISC microcontrollers.

The ATmega32 provides the following features: 32Kbytes of In-System


Programmable Flash Program memory with Read-While-Write capabilities,
1024bytes EEPROM, 2Kbyte SRAM, 32 general purpose I/O lines, 32 general
purpose working registers, a JTAG interface for Boundary scan, On-chip
Debugging support and programming, three flexible Timer/Counters with
compare modes, Internal and External Interrupts, a serial programmable
USART, a byte oriented Two-wire Serial Interface, an 8-channel, 10-bit ADC
with optional differential input stage with programmable gain (TQFP package
only), a programmable Watchdog Timer with Internal Oscillator, an SPI serial
port, and six software selectable power saving modes. The Idle mode stops the
CPU while allowing the USART, Two-wire interface, A/D Converter, SRAM,
Timer/Counters, SPI port, and interrupt system to continue functioning. The
Power-down mode saves the register contents but freezes the Oscillator,
disabling all other chip functions until the next External Interrupt or Hardware
Reset. In Power-save mode, the Asynchronous Timer continues to run, allowing
the user to maintain a timer base while the rest of the device is sleeping. The
ADC Noise Reduction mode stops the CPU and all I/O modules except
Asynchronous Timer and ADC, to minimize switching noise during ADC
conversions. In Standby mode, the crystal/resonator Oscillator is running while
the rest of the device is sleeping. This allows very fast start-up combined with
low-power consumption. In Extended Standby mode, both the main Oscillator
and the Asynchronous Timer continue to run.

The device is manufactured using Atmel’s high density non-volatile memory


technology. The On chip ISP Flash allows the program memory to be
reprogrammed in-system through an SPI serial interface, by a conventional non
-volatile memory programmer, or by an On-chip Boot program running on the
AVR core. The boot program can use any interface to download the application
program in the Application Flash memory. Software in the Boot Flash section
will continue to run while the Application Flash section is updated, providing
true Read-While-Write operation. By combining an 8-bit RISC CPU with In-
System Self-Programmable Flash on a monolithic chip, the Atmel ATmega32 is
a powerful microcontroller that provides a highly-flexible and cost-effective
solution to many embedded control applications.

8
The Atmel AVR ATmega32 is supported with a full suite of program and
system development tools including: C compilers, macro assemblers, program
debugger/simulators, in-circuit emulators, and evaluation kits.

2.1.2 PIN CONFIGRUATION

9
2.1.3 PIN DESCRIPTIONS:
VCC - Digital supply voltage.

GND - Ground.

Port A (PA7..PA0) - Port A serves as the analog inputs to the A/D Converter.
Port A also serves as an 8-bit bi-directional I/O port, if the A/D Converter is not
used. Port pins can provide internal pull-up resistors (selected for each bit). The
Port A output buffers have symmetrical drive characteristics with both high sink
and source capability. When pins PA0 to PA7 are used as inputs and are
externally pulled low, they will source current if the internal pull-up resistors
are activated. The Port A pins are tri-stated when a reset condition becomes
active, even if the clock is not running.

10
Port B (PB7..PB0) - Port B is an 8-bit bi-directional I/O port with internal pull-
up resistors (selected for each bit). The Port B output buffers have symmetrical
drive characteristics with both high sink and source capability. As inputs, Port B
pins that are externally pulled low will source current if the pull-up resistors are
activated. The Port B pins are tri-stated when a reset condition becomes active,
even if the clock is not running.

Port C (PC7..PC0) - Port C is an 8-bit bi-directional I/O port with internal pull-
up resistors (selected for each bit). The Port C output buffers have symmetrical
drive characteristics with both high sink and source capability. As inputs, Port C
pins that are externally pulled low will source current if the pull-up resistors are
activated. The Port C pins are tri-stated when a reset condition becomes active,
even if the clock is not running. If the JTAG interface is enabled, the pull-up
resistors on pins PC5 (TDI), PC3 (TMS) and PC2(TCK) will be activated even
if a reset occurs. The TD0 pin is tri-stated unless TAP states that shift out data
are entered.

Port D (PD7..PD0) - Port D is an 8-bit bi-directional I/O port with internal pull-
up resistors (selected for each bit). The Port D output buffers have symmetrical
drive characteristics with both high sink and source capability. As inputs, Port D
pins that are externally pulled low will source current if the pull-up resistors are
activated. The Port D pins are tri-stated when a reset condition becomes active,
even if the clock is not running.

RESET - Reset Input. A low level on this pin for longer than the minimum
pulse length will generate a reset, even if the clock is not running. Shorter
pulses are not guaranteed to generate a reset.

XTAL1 - Input to the inverting Oscillator amplifier and input to the internal
clock operating circuit.

XTAL2 - Output from the inverting Oscillator amplifier.

AVCC - AVCC is the supply voltage pin for Port A and the A/D Converter. It
should be externally connected to VCC, even if the ADC is not used. If the
ADC is used, it should be connected to VCC through a low-pass filter.

AREF - AREF is the analog reference pin for the A/D Converter.

11
2.1.4 BLOCK DIAGRAM

12
2.1.5 MEMORY ORGANIZATION

In-System Reprogrammable Flash Program Memory


The ATmega32 contains 32 Kbytes On-chip In-System Reprogrammable Flash
memory for program storage. Since all AVR instructions are 16 or 32 bits wide,
the Flash is organized as 16K × 16. For software security, the Flash Program
memory space is divided into two sections, Boot Program section and
Application Program section. The Flash memory has an endurance of at least
10,000 write/erase cycles. The ATmega32 Program Counter (PC) is 14 bits
wide, thus addressing the 16K program memory locations.

SRAM Data Memory


The lower 2144 Data Memory locations address the Register File, the I/O
Memory, and the internal data SRAM. The first 96 locations address the
Register File and I/O Memory, and the next 2048 locations address the internal
data SRAM.

The five different addressing modes for the data memory cover: Direct, Indirect
with Displacement, Indirect, Indirect with Pre-decrement, and Indirect with
Post-increment. In the Register File, registers R26 to R31 feature the indirect
Addressing Pointer Registers.

The direct addressing reaches the entire data space.

The Indirect with Displacement mode reaches 63 address locations from the
base address given by the Y- or Z-register. When using register indirect
addressing modes with automatic pre-decrement and post-increment, the
address registers X, Y, and Z are decremented or incremented.

The 32 general purpose working registers, 64 I/O Registers, and the 2048 bytes
of internal data SRAM in the ATmega32 are all accessible through all these
addressing modes.

EEPROM Data Memory


The ATmega32 contains 1024 bytes of data EEPROM memory. It is organized
as a separate data space, in which single bytes can be read and written. The
EEPROM has an endurance of at least 100,000 write/erase cycles. The access
between the EEPROM and the CPU is described in the following, specifying
the EEPROM Address Registers, the EEPROM Data Register, and the
EEPROM Control Register.

13
2.1.6 INTERRUPTS

Interrupt and reset table for ATmeg32.

14
2.2 SENSORS

2.2.1 TEMPERATURE SENSOR (LM35)

DESCRIPTION:

The LM35 series are precision integrated-circuit temperature devices with an


output voltage linearly-proportional to the Centigrade temperature. The LM35
device has an advantage over linear temperature sensors calibrated in Kelvin, as
the user is not required to subtract a large constant voltage from the output to
obtain convenient Centigrade scaling. The LM35 device does not require any
external calibration or trimming to provide typical accuracies of ±¼°C at room
temperature and ±¾° Covers a full −55°C to 150°C temperature range. Lower
cost is assured by trimming and calibration at the wafer level. The low-output
impedance, linear output, and precise inherent calibration of the LM35 device
makes interfacing to readout or control circuitry especially easy.

The device is used with single power supplies, or with plus and minus supplies.
As the LM35 device draws only 60 µA from the supply, it has very low self-
heating of less than 0.1°C in still air. The LM35 device is rated to operate over a
−55°C to 150°C temperature range, while the LM35C device is rated for a
−40°C to 110°C range (−10° with improved accuracy).

15
The LM35-series devices are available packaged in hermetic TO transistor
packages, while the LM35C, LM35CA, and LM35D devices are available in the
plastic TO-92 transistor package. The LM35D device is available in an 8-lead
surface-mount small-outline package and a plastic TO-220 package

FEATURES:

 Calibrated Directly in Celsius (Centigrade)


 Linear + 10-mV/°C Scale Factor
 0.5°C Ensured Accuracy (at 25°C)
 Rated for Full −55°C to 150°C Range
 Suitable for Remote Applications
 Low-Cost Due to Wafer-Level Trimming
 Operates from 4 V to 30 V
 Less than 60-μA Current Drain
 Low Self-Heating, 0.08°C in Still Air
 Non-Linearity Only ±¼°C Typical
 Low-Impedance Output, 0.1 Ω for 1-mA Load
 ±0.5°C Temperature sensor with analog output with 30V capability

PINS:
PIN 1 – 4-20V SUPPLY.
PIN 2 – OUTPUT.
PIN 3 – GROUND.

16
2.2.2 ULTRASONIC SENSOR (HC-SR04)

DESCRIPTION:

The HC-SR04 ultrasonic sensor uses sonar to determine distance to an object


like bats do. It offers excellent non-contact range detection with high accuracy
and stable readings in an easy-to-use package. From 2cm to 400 cm or 1” to 13
feet. It operation is not affected by sunlight or black material like Sharp
rangefinders are (although acoustically soft materials like cloth can be difficult
to detect). It comes complete with ultrasonic transmitter and receiver module.

HC-SR04 is an ultrasonic ranging module that provides 2 cm to 400 cm non-


contact measurement function. The ranging accuracy can reach to 3mm and
effectual angle is < 15°. It can be powered from a 5V power supply.

17
FEATURES:
 Power Supply :+5V DC
 Quiescent Current : <2mA
 Working Current: 15mA
 Effectual Angle: <15°
 Ranging Distance : 2cm – 400 cm/1″ – 13ft
 Resolution : 0.3 cm
 Measuring Angle: 30 degree
 Trigger Input Pulse width: 10uS
 Dimension: 45mm x 20mm x 15mm
 Echo Output Signal Input TTL lever signal and the range in proportion

PINS:

 VCC: +5VDC
 Trig : Trigger (INPUT)
 Echo: Echo (OUTPUT)
 GND: GND

2.2.3 GAS SENSOR (MQ5)

18
DESCRIPTION:

Gas Sensor (MQ5) module is useful for gas leakage detection (in home and
industry). It is suitable for detecting H2, LPG, CH4, CO, ALCOHOL. Due to its
high sensitivity and fast response time, measurements can be taken as soon as
possible. The sensitivity of the sensor can be adjusted by using the
potentiometer.

FEATURES:

 Wide detecting scope


 Stable and long life
 Fast response and High sensitivity
 Adjustable sensitivity
 Signal output indicator
 Output voltage boosts along with the concentration of the measured gases
increases
 Sensitive for LPG, natural gas, coal gas

SPECIFICATIONS:

ITEM PARAMETER MIN TYPICAL MAX UNIT


VCC WORKING 4.9 5 5.1 V
VOLTAGE
PH HEAT 0.5 - 800 mW
CONSUMPTION
RL LOAD RESISTANCE - ADJUSTABLE
RH HEAT RESISTANCE 31±10% - Ω
Rs SENSING 10 - 60 kΩ
RESISTANCE
SCOPE DETECTING 200 - 10000 ppm
CONCENTERATION

19
2.2.4 INFRARED SENSOR

INTRODUCTION:

Infrared technology addresses a wide variety of wireless applications. The main


areas are sensing and remote controls. In the electromagnetic spectrum, the
infrared portion is divided into three regions: near infrared region, mid infrared
region and far infrared region.

The wavelengths of these regions and their applications are shown below.

 Near infrared region — 700 nm to 1400 nm — IR sensors, fiber optic


 Mid infrared region — 1400 nm to 3000 nm — Heat sensing
 Far infrared region — 3000 nm to 1 mm — Thermal imaging

The frequency range of infrared is higher than microwave and lesser than
visible light.

For optical sensing and optical communication, photo optics technologies are
used in the near infrared region as the light is less complex than RF when
implemented as a source of signal. Optical wireless communication is done with
IR data transmission for short range applications.

20
An infrared sensor emits and/or detects infrared radiation to sense its
surroundings.

The working of any Infrared sensor is governed by three laws: Planck’s


Radiation law, Stephen – Boltzmann law and Wien’s Displacement law.

Planck’s law states that “every object emits radiation at a temperature not equal
to 00K”. Stephen – Boltzmann law states that “at all wavelengths, the total
energy emitted by a black body is proportional to the fourth power of the
absolute temperature”. According to Wien’s Displacement law, “the radiation
curve of a black body for different temperatures will reach its peak at a
wavelength inversely proportional to the temperature”.

The basic concept of an Infrared Sensor which is used as Obstacle detector is to


transmit an infrared signal, this infrared signal bounces from the surface of an
object and the signal is received at the infrared receiver.

There are five basic elements used in a typical infrared detection system: an
infrared source, a transmission medium, optical component, infrared detectors
or receivers and signal processing. Infrared lasers and Infrared LED’s of
specific wavelength can be used as infrared sources. The three main types of
media used for infrared transmission are vacuum, atmosphere and optical fibers.
Optical components are used to focus the infrared radiation or to limit the
spectral response. Optical lenses made of Quartz, Germanium and Silicon are
used to focus the infrared radiation. Infrared receivers can be photodiodes,
phototransistors etc. some important specifications of infrared receivers are
photosensitivity, detectivity and noise equivalent power. Signal processing is
done by amplifiers as the output of infrared detector is very small.

TYPES OF IR SENSORS:

Infrared sensors can be passive or active. Passive infrared sensors are basically
Infrared detectors. Passive infrared sensors do not use any infrared source and
detects energy emitted by obstacles in the field of view. They are of two types:
quantum and thermal. Thermal infrared sensors use infrared energy as the
source of heat and are independent of wavelength. Thermocouples, pyroelectric
detectors and bolometers are the common types of thermal infrared detectors.

Quantum type infrared detectors offer higher detection performance and are
faster than thermal type infrared detectors. The photosensitivity of quantum
type detectors is wavelength dependent. Quantum type detectors are further
classified into two types: intrinsic and extrinsic types. Intrinsic type quantum
detectors are photoconductive cells and photovoltaic cells.

21
Active infrared sensors consist of two elements: infrared source and infrared
detector. Infrared sources include an LED or infrared laser diode. Infrared
detectors include photodiodes or phototransistors. The energy emitted by the
infrared source is reflected by an object and falls on the infrared detector.

INFRARED TRANSMITTER:

Infrared Transmitter is a light emitting diode (LED) which emits infrared


radiations. Hence, they are called IR LED’s. Even though an IR LED looks like
a normal LED, the radiation emitted by it is invisible to the human eye.

The picture of a typical Infrared LED is shown below.

22
There are different types of infrared transmitters depending on their
wavelengths, output power and response time.

A simple infrared transmitter can be constructed using an infrared LED, a


current limiting resistor and a power supply. The schematic of a typical IR
transmitter is shown below.

When operated at a supply of 5V, the IR transmitter consumes about 3 to 5 mA


of current. Infrared transmitters can be modulated to produce a particular
frequency of infrared light. The most commonly used modulation is OOK (ON
– OFF – KEYING) modulation.

IR transmitters can be found in several applications. Some applications require


infrared heat and the best infrared source is infrared transmitter. When infrared
emitters are used with Quartz, solar cells can be made.

23
INFRARED RECEIVERS:

Infrared receivers are also called as infrared sensors as they detect the radiation
from an IR transmitter. IR receivers come in the form of photodiodes and
phototransistors. Infrared Photodiodes are different from normal photo diodes as
they detect only infrared radiation. The picture of a typical IR receiver or a
photodiode is shown below.

Different types of IR receivers exist based on the wavelength, voltage, package,


etc. When used in an infrared transmitter – receiver combination, the
wavelength of the receiver should match with that of the transmitter.

A typical infrared receiver circuit using a phototransistor is shown below.

24
It consists of an IR phototransistor, a diode, a MOSFET, a potentiometer and an
LED. When the phototransistor receives any infrared radiation, current flows
through it and MOSFET turns on. This in turn lights up the LED which acts as a
load. The potentiometer is used to control the sensitivity of the phototransistor.

PRINCIPLE OF WORKING:

The principle of an IR sensor working as an Object Detection Sensor can be


explained using the following figure. An IR sensor consists of an IR LED and
an IR Photodiode; together they are called as Photo – Coupler or Opto –
Coupler.

When the IR transmitter emits radiation, it reaches the object and some of the
radiation reflects back to the IR receiver. Based on the intensity of the reception
by the IR receiver, the output of the sensor is defined.

25
2.3 DC MOTOR:

2.3.1 DESCRIPTION

(Electric gear motor)

An electric motor is an electrical machine that converts electrical energy into


mechanical energy. The reverse of this would be the conversion of mechanical
energy into electrical energy and is done by an electric generator.

In normal motoring mode, most electric motors operate through the interaction
between an electric motor’s magnetic field and winding currents to generate
force within the motor. In certain applications, such as the transportation
industry with traction motors, electric motor can operate in both motoring and
generating or braking modes to also produce electrical energy from mechanical
energy.

Found in application as diverse as industrial fans, blowers and pumps, machine


tools, household appliances, power tools, and disk drives, electric motors can be
powered by direct current (DC) sources, such as from batteries, motor vehicles

26
or rectifiers, or by alternating current (AC) sources, such as from the power
grid, inverters or generators. Small motors may be found in electric watches.
General purpose motors with highly standardized dimensions and characteristics
provide convenient mechanical power for industrial use. The largest of electric
motors are used for ship propulsion, pipeline compression and pumped storage
application with rating reaching 100 MWatts. Electric motors may be classified
by electric power source type, internal construction, application, type of motion
output and so on.

Electric motors are used to produce linear and rotary force (torque), and should
be distinguished from devices such as magnetic solenoids and loudspeakers that
convert electricity into motion but do not generate usable mechanical powers,
which are respectively referred to as actuators and transducers.

2.4 TRANSFORMER

2.4.1 DESCRIPTION

A transformer can be defined as a static device which helps in the


transformation of electric power in one circuit to electric power of the same
frequency in another circuit. The voltage can be raised or lowered in a circuit,
but with a proportional increase or decrease in the current ratings.

The main principle of operation of a transformer is mutual inductance between


two circuits which is linked by a common magnetic flux. A basic transformer
consists of two coils that are electrically separate and inductive, but are
magnetically linked through a path of reluctance. The working principle of the
transformer can be understood from the figure in next page.

27
Figure 15- Step-Down Transformer

2.4.2 TRASFORMER WORKING

The transformer has primary and secondary windings. The core laminations are
joined in the form of strips in between the strips you can see that there are some
narrow gaps right through the cross-section of the core. These staggered joints
are said to be ‘imbricated’. Both the coils have high mutual inductance. A
mutual electro-motive force is induced in the transformer from the alternating
flux that is set up in the laminated core, due to the coil that is connected to a
source of alternating voltage. Most of the alternating flux developed by this coil
is linked with the other coil and thus produces the mutual induced electro-
motive force. The so produced electro-motive force can be explained with the
help of Faraday’s laws of Electromagnetic Induction as

e=M*dI/dt

28
If the second coil circuit is closed, a current flows in it and thus electrical
energy is transferred magnetically from the first to the second coil.

The alternating current supply is given to the first coil and hence it can be called
as the primary winding. The energy is drawn out from the second coil and thus
can be called as the secondary winding.

In short, a transformer carries the operations shown below:

1. Transfer of electric power from one circuit to another.


2. Transfer of electric power without any change in frequency.
3. Transfer with the principle of electromagnetic induction.
4. The two electrical circuits are linked by mutual induction.

Figure 16- Transformer Structure

29
2.4.3 E.M.F. EQUATION OF A TRANSFORMER

Figure 17- Waveform

Let,

NA = Number of turns in primary


NB = Number of turns in secondary
Ømax = Maximum flux in the core in webers = Bmax X A
f = Frequency of alternating current input in hertz (HZ)
As shown in figure above, the core flux increases from its zero value to
maximum value Ømax in one quarter of the cycle , that is in ¼ frequency second.
Therefore, average rate of change of flux = Ømax/ ¼ f = 4f ØmaxWb/s
Now, rate of change of flux per turn means induced electro motive force in
volts.

Therefore, average electro-motive force induced/turn = 4f Ømaxvolt


If flux Ø varies sinusoidally, then r.m.s value of induced e.m.f is obtained by
multiplying the average value with form factor.

Form Factor = r.m.s. value/average value = 1.11

30
Therefore, r.m.s value of e.m.f/turn = 1.11 X 4f Ømax = 4.44f Ømax
Now, r.m.s value of induced e.m.f in the whole of primary winding

= (induced e.m.f./turn) X Number of primary turns

Therefore,

EA = 4.44f NAØmax = 4.44fNABmA


Similarly, r.m.s value of induced e.m.f in secondary is

EB = 4.44f NB Ømax = 4.44fNBBmA


In an ideal transformer on no load,

VA = EA and VB = EB , where VB is the terminal voltage

Voltage Transformation Ratio (K)


From the above equations we get

EB/ EA = VB/ VA = NB/NA = K


This constant K is known as voltage transformation ratio.

(1) If NB>NA, that is K>1, then transformer is called step-up transformer.


(2) If NB<1, that is K<1, then transformer is known as step-down transformer.
Again for an ideal transformer,

Input VA = output VA
VAIA = VBIB
Or, IB/IA = VA/VB = 1/K
Hence, currents are in the inverse ratio of the (voltage) transformation ratio.

31
2.5 LCD

2.5.1 DESCRIPTION

LCD (Liquid Crystal Display) screen is an electronic display module and find a
wide range of applications. A 16x2 LCD display is very basic module and is
very commonly used in various devices and circuits. These modules are
preferred over seven segments and other multi segment LEDs. The reasons
being: LCDs are economical; easily programmable; have no limitation of
displaying special & even custom characters (unlike in seven segments),
animations and so on.

A 16x2 LCD means it can display 16 characters per line and there are 2 such
lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has
two registers, namely, Command and Data.

The command register stores the command instructions given to the LCD. A
command is an instruction given to LCD to do a predefined task like initializing
it, clearing its screen, setting the cursor position, controlling display etc. The
data register stores the data to be displayed on the LCD. The data is the ASCII
value of the character to be displayed on the LCD. Click to learn more about
internal structure of a LCD.

32
PIN DIAGRAM:

Liquid Crystal Display is an electronically modulated optical device shaped into


a thin, flat panel made up of any number of colour and monochrome pixels
filled with liquid crystals and arrayed in front of a light source (backlight) or
reflectors. It is often utilized in battery, power electronic devices because it uses
very small amount of electric power.

The experiment used 16x2 LCD as it is economical, and easily programmable.


16x2 LCD means that it is able to display 16 characters per line on two lines.
This LCD has two resisters. Liquid Crystal Display (LCD) is an optical device
consisting crystals arranged on a thin surface. LCD has certain features such as;
its size is much less than the regular screen, light and easy to transport, does not
need high voltage of electricity like in the regular screens, comfortable for the
eyes compared to regular screen, their shape is much better than normal screen,
and its quality is higher than normal screens in terms of colours.

33
2.6 LM741 OPERATIONAL AMPLIFIER

DESCRIPTION:

The LM741 series are general-purpose operational amplifiers which feature


improved performance over industry standards like the LM709. They are direct,
plug-in replacements for the 709C, LM201, MC1439, and 748 in most
applications.

The amplifiers offer many features which make their application nearly fool
proof: overload protection on the input and output, no latch-up when the
common-mode range is exceeded, as well as freedom from oscillations.

The LM741C is identical to the LM741 and LM741A except that the LM741C
has their performance ensured over a 0°C to +70°C temperature range, instead
of −55°C to +125°C.

FEATURES:

34
 Overload Protection on the Input and Output
 No Latch-Up When the Common-Mode Range is exceeded.

2.7 PIEZOELECTRIC BUZZER

Piezo buzzer is an electronic device commonly used to produce sound. Light


weight, simple construction and low price make it usable in various applications
like car/truck reversing indicator, computers, call bells etc. Piezo buzzer is
based on the inverse principle of piezo electricity discovered in 1880 by Jacques
and Pierre Curie. It is the phenomena of generating electricity when mechanical
pressure is applied to certain materials and the vice versa is also true. Such
materials are called piezo electric materials. Piezo electric materials are either
naturally available or manmade. Piezoceramic is class of manmade material,
which poses piezo electric effect and is widely used to make disc, the heart of
piezo buzzer. When subjected to an alternating electric field they stretch or
compress, in accordance with the frequency of the signal thereby producing
sound.

The circuit starts by the base receiving a small current from the 220k resistor.
This produces a small magnetic flux in the inductor and after a very short period
of time the current does not increase. This causes the magnetic flux to collapse

35
and produce a voltage in the opposite direction that is higher than the applied
voltage.

3 wires are soldered to pieces of metal on the top and bottom sides of a ceramic
substrate that expands sideways when it sees a voltage. The voltage on the top
surface is passed to the small electrode and this positive voltage is passed to the
base to turn the transistor ON again. This time it is turned ON more and
eventually the transistor is fully turned ON and the current through the inductor
is not an INCREASING CURRENT but a STATIONARY CURRENT and once
again the magnetic flux collapses and produces a very high voltage in the
opposite direction. This voltage is passed to the piezo diaphragm and causes the
electrode to "Dish" and produce the characteristic sound. At the same time a
small amount is "picked-off" and sent to the transistor to create the next cycle.

2.8 L7805CV VOLTAGE REGULATOR

7805 is a voltage regulator integrated circuit. It is a member of 78xx series of


fixed linear voltage regulator ICs. The voltage source in a circuit may have
fluctuations and would not give the fixed voltage output. The voltage regulator
IC maintains the output voltage at a constant value. The xx in 78xx indicates
the fixed output voltage it is designed to provide. 7805 provides +5V regulated
power supply. Capacitors of suitable values can be connected at input and
output pins depending upon the respective voltage levels.

PIN DESCRIPTION:

Pin no. Function Name


1. Input voltage(5-18V) Input

36
2. Ground(0V) Ground
3. Regulated output; 5V Output

PIN DIAGRAM:

2.9 RELAY, POTENTIOMETER, BATTERIES


RELAYS:

37
A relay is an electrically operated switch. Many relays use an electromagnet to
mechanically operate a switch, but other operating principles are also used, such
as solid-state relays. Relays are used where it is necessary to control a circuit by
a low-power signal (with complete electrical isolation between control and
controlled circuits), or where several circuits must be controlled by one signal.
The first relays were used in long distance telegraph circuits as amplifiers: they
repeated the signal coming in from one circuit and re-transmitted it on another
circuit. Relays were used extensively in telephone exchanges and early
computers to perform logical operations.

POTENTIOMETER:

A potentiometer, informally a pot, is a three-terminal resistor with a sliding or


rotating contact that forms an adjustable voltage divider. If only two terminals
are used, one end and the wiper, it acts as a variable resistor or rheostat.

The measuring instrument called a potentiometer is essentially a voltage divider


used for measuring electric potential (voltage); the component is an
implementation of the same principle, hence its name.

Potentiometers are commonly used to control electrical devices such as volume


controls on audio equipment. Potentiometers operated by a mechanism can be
used as position transducers, for example, in a joystick. Potentiometers are
rarely used to directly control significant power (more than a watt), since the
power dissipated in the potentiometer would be comparable to the power in the
controlled load.

38
BATTERIES:

The nine-volt battery, or 9-volt battery, in its most common form was
introduced for the early transistor radios. It has a rectangular prism shape with
rounded edges and a polarized snap connector at the top. This type is commonly
used in walkie-talkies, clocks and smoke detectors. They are also used as
backup power to keep the time in certain electronic clocks. This format is
commonly available in primary carbon-zinc and alkaline chemistry, in primary
lithium iron di-sulfide, and in rechargeable form in nickel-cadmium, nickel-
metal hydride and lithium-ion.

39
3. PROJECT IMPLEMENTATION

3.1 SOFTWARE DESCRIPTION

INTRODUCTION TO BASCOM-AVR:
BASCOM-AVR is the original Windows BASIC COMPILER for
the AVR family. It is designed to run on XP/VISTA/WIN7 and WIN8

KEY BENEFITS:

 Structured BASIC with labels.


 Structured programming with IF-THEN-ELSE-END IF, DO-LOOP,
WHILE-WEND, SELECT- CASE.
 Fast machine code instead of interpreted code.
 Variables and labels can be as long as 32 characters.
 Bit, Byte, Integer, Word, Long, Single, Double and String variables.
 Large set of Trig Floating point functions.
 Date & Time calculation functions.
 Compiled programs work with all AVR microprocessors that have internal
memory.
 Statements are highly compatible with Microsoft’s VB/QB.
 Special commands for LCD displays, I2C chips and 1WIRE chips, PC
keyboard, matrix keyboard, RC5 reception, software UART, SPI, graphical
LCD, send IR RC5, RC6 or Sony code.
 TCP/IP with W3100A/W5100/W5200/W5300 chips.
 Built in AVR-DOS functions like MKDIR, CHDIR, DIR, OPEN, CLOSE,
etc. Just as they work in QB/VB!
 Local variables, user functions, library support.
 Integrated terminal emulator with download option.
 Integrated simulator for testing.
 Integrated ISP programmer (application note AVR910.ASM).
 Integrated STK200 programmer and STK300 programmer. Also supported is
the low cost Sample Electronics programmer. Can be built in 10 minutes!
Many other programmers supported via the Universal Interface.

40
 Many supported programmer like STK500, STK600, MKII, USBASP,
JTAG , Arduino.
 Editor with statement highlighting.

PROTEUS DESIGN SUITE:

Proteus is a Virtual System Modelling and circuit simulation application. The


suite combines mixed mode SPICE circuit simulation, animated components
and microprocessor models to facilitate co-simulation of complete
microcontroller based designs. Proteus also has the ability to simulate the
interaction between software running on a microcontroller and any analog or
digital electronics connected to it. It simulates Input / Output ports, interrupts,
timers, USARTs and all other peripherals present on each supported processor.

3.2 CIRCUIT DIAGRAM

41
3.3 SIMULATION IN PROTEUS:

CIRCUIT SIMULATION IN PROTEUS:

1. Above image shows simulation of circuit for black box.

2. LCD shows four parameters which are distance, temperature, rpm/speed,


alcohol concentration.

3. The distance and speed parameter cannot be simulated in Proteus Design


Suite hence we have taken a fixed frequency pulse to simulate these two
parameter, graph for these two parameter can be seen in oscilloscope in
next two pages.

4. The other two parameters which are alcohol concentration and temperature
can be varied and we can see the changes in the graph on the digital
oscilloscope.

42
GRAPH OF VARYING TEMPERATURE PARAMETER ON DIGITAL
OSCILLOSCOPE IS GIVEN BELOW:
TEMPERATURE INCREASING:

TEMPERATURE DECREASING:

43
GRAPH OF VARYING ALCOHOL CONCETRATION PARAMETER,
FIXED DISTANCE PULSE, FIXED SPEED PULSE ON DIGITAL
OSCILLOSCOPE:

BLUE: FIXED DISTANCE PULSE.

RED: FIXED SPEED PULSE.

GREEN: VARYING ALCOHOL CONCENTRATION.

44
3.4 WORKING PRINCIPLE

The aim of the project is to develop a device called Black Box which can record
various parameters in car such as engine temperature, speed etc. Apart from that
features for collision avoidance are also added like alcohol sensor which won’t
allow the driver to drive a car if alcohol is detected on the driver’s seat.

ATmega32 microcontroller is used because it is efficient, cheap microcontroller


and has inbuilt 1024Bytes EEPROM. System has four sensors which are
ultrasonic sensor for distance measurement, Infrared sensor for speed/rpm
measurement, temperature sensor for temperature measurement and gas sensor
for measurement of alcohol concentration. The status of all the sensors will be
shown on the LCD in real time. These four sensor will continuously sense the
parameters and the result is continuously stored in EEPROM of the
microcontroller. The system will continue to store latest value from all the
sensors and continue to overwrite the old values. This process will continue to
occur until trigger/impact will occur. A switch is used as a trigger for the
collision. After the switch is pressed, system will realize that the collision has
happened, so that the current values during which collision has occurred is
stored and won’t be overwrite by the system, although system will continue to
sense the latest values but the values at which collision has occurred won’t be
overwrite. Using the push button values of different sensors at which collision
has occurred can be displayed in the LCD. Values will remain stored until we
stop the trigger or we reset the values of EEPROM. This is event data recording.

Apart from the function of event data recording, system also has collision
avoidance features which is vehicle to vehicle collision avoidance unit. In this
unit we have two sensors which are ultrasonic sensor and gas sensor. Ultrasonic
sensor will continuously monitor the distance between its nearby vehicles and
will alert the driver by buzzer if the driver is in close proximity of another
vehicle or any other object. The gas sensor will sense the alcohol concentration
in the proximity of driver seat. If the alcohol is detected the system will shut
down the motor (engine), thus the driver will unable to drive car under the
influence of alcohol, this will help to stop any unfortunate collision which was
earlier bound to happen. This is vehicle to vehicle collision avoidance unit. The
system Black Box consist of above two units.

45
4. CONCLUSION

This project has presented a new vision for the vehicles industry, which is the
Black Box with Collision Avoidance System used for vehicles. We have
successfully implemented the idea through embedded system which gave good
results and expected functioning. A full and detailed description was made for
every part of this system. This project has also offered a user friendly embedded
program to analyse the data of the accident.

This Black Box system built can be implemented in any vehicle. As soon as the
driver starts the car, this system will also start and begin to collect the data from
all the sensors and stores in EEPROM. This Black Box system is also cheap and
highly efficient.
The data can be retrieved as required with great ease. The initial testing was
done with Proteus design Suite on PC instead of an actual hardware for
simplicity on trial purposes and later on the actual platform.

46
5. FUTURE ENHANCEMENTS

Use of GPS module with this system will be helpful in finding the accident
location and take quick rescue operations. We can enhance the present system
to check other parameters like fuel level, tyre pressure and working of
headlights before starting the vehicle .Many other critical parameters can be
read and stored in the memory.

Another useful add-on to the present system could be cameras on front and
backsides which keep recording live images and storing them in memory. This
video data would be much useful for accident investigation.

47
6. APPENDIX (CODE)

$regfile = "m32def.dat"
$crystal = 8000000

Config Pind.3 = Input


Config Portd.4 = Output
Config Portb = Input
Config Porta = Input
Config Portd.5 = Input
Config Portd.7 = Output
Config Clock = Soft

Portd.5 = 1
Portd.3 = 0
Portd.4 = 0
Portb = 255
Portd.7 = 0
Dim Distance As Word , W As Word , I As Byte
Dim A As Integer
Dim B As Word
Dim C As Word
Dim D As Word
Dim Addr1 As Word
Dim Addr2 As Word
Dim Addr3 As Word
Dim Addr4 As Word
Dim Addr5 As Word
Dim Addr6 As Word

Addr1 = 1
Addr2 = 3
Addr3 = 5
Addr4 = 7
Addr5 = 9
Addr6 = 11
Config Adc = Single , Prescaler = Auto
Config Lcd = 16 * 2
Config Lcdbus = 4
Config Lcdpin = Pin , Db7 = Portc.5 , Db6 = Portc.4 , Db5 = Portc.3 , Db4 =
Portc.2 , E = Portc.1 , Rs = Portc.0
Cursor Off
48
Start Adc
Distance = 0
Enable Interrupts

Cls
Locate 1 , 2
Lcd "Car Black Box"
Wait 1

Do
Pulseout Portd , 4 , 20 'Min. 10us pulse
'Waitms 100 'meant for testing error
Pulsein W , Pind , 3 , 1 'read distance
If Err = 0 Then
W = W * 10 'calculate to
W = W / 58 'centimeters
'W = W / 6 'milimeters
Distance = W
Else
Distance = 0
End If
B = Getadc(0)
B=B/4
Pulsein C , Pind , 5 , 0
D = Getadc(1)
D=D/4
C = C / 1000
Cls
Locate 1 , 1
Lcd "D:" ; Distance ; Chr(99) ; Chr(109) ; "Temp:" ; B
Locate 2 , 1
Lcd "RPM:" ; C ; Chr(32) ; "AL:" ; D

If Distance < 20 Then


Cls
Locate 1 , 1
Lcd "!!Alert!!"
Wait 1
Portd.7 = 1
Wait 1

Elseif Pinb.1 = 0 Then


Writeeeprom Distance , Addr1

49
Writeeeprom B , Addr3
Writeeeprom C , Addr5
Writeeeprom D , Addr6
Portd.7 = 0

Elseif Pinb.0 = 0 Then


Readeeprom A , Addr1
Readeeprom B , Addr3
Readeeprom C , Addr5
Readeeprom D , Addr6
Portd.7 = 0

Cls
Locate 1 , 1
Lcd "Dist:" ; A ; Chr(32) ; "Temp:" ; B
Locate 2 , 1
Lcd "RPM:" ; C ; Chr(32) ; "Al:" ; D
Wait 5
End If

If D > 200 Then


Cls
Locate 1 , 1
Lcd "ENGINE TURN OFF"
Wait 1
End If
Portd.7 = 0
Waitms 200
Loop
End 'end program

50
7. REFERENCES

1. Dae Geun Lee, Se Myoung Jung, Myoung Seob Lim, ―System on Chip
design of Embedded Controller for Car Black Box‖, Intelligent Vehicles
Symposium IEEE, Istanbul, 13-15 June 2007, pp 1174-1177, Print ISBN
: 1-4244-1067-3, DOI : 10.1109/IVS.2007.4290277.

2. Soundarraj.V, Rajasekar.L, “Design of Car Black Box Based on ARM”,


International Journal of Microsystems Technology and Its Applications
(IJMTA) Vol-1, No-2 January-2013.

3. K. Kowalick, "Black Boxes: Event Data Recorder Rulemaking for


Automobiles", MICAH, summer 2006.

4. Thomas K. Kowalick, "Fatal Exit: The Automotive Black Box Debate",


Wiley, IEEE Press, Feb. 2005.

5. Eunryung Lee, Jung Wook Lee, Jeongho Son, “OSEK/VDX-based


gateway for car black-box”, ICCE 2011, IEEE International Conference
on Consumer Electronics, pp. 521-522, USA, 2011

6. Dheeraj Pawar, Pushpak Poddar, ―Car Black Box with Speed Control in
Desired Areas for Collision Avoidance‖, ETASR - Engineering,
Technology & Applied Science Research, 2012, pp 281-284, Vol. 2.

7. Atmel ATmega32 datasheet.

8. www.stackoverflow.com

9. www.engineersgarage.com

10. http://en.wikipedia.org

11. www.atmel.com

─────────────────────

51

Вам также может понравиться