0% found this document useful (0 votes)
168 views90 pages

Alcohol and Drivers Drowsy Condition Detection in Vehicles

This document discusses a system to detect alcohol consumption and drowsiness in drivers to improve vehicle and driver safety. The system uses various sensors like a seat belt sensor, eye blink sensor, ultrasonic sensor, alcohol sensor, and GSM modem. The seat belt and alcohol sensors can lock the engine if the driver is not wearing a seat belt or is detected to be under the influence of alcohol. The eye blink sensor and ultrasonic sensor monitor driver alertness and distance to nearby vehicles, and can stop the vehicle automatically if drowsiness or a potential collision is detected. The system then sends an SMS notification using the GSM modem. The overall goal is to provide safety to drivers and vehicles in order to reduce accidents.

Uploaded by

surekha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
168 views90 pages

Alcohol and Drivers Drowsy Condition Detection in Vehicles

This document discusses a system to detect alcohol consumption and drowsiness in drivers to improve vehicle and driver safety. The system uses various sensors like a seat belt sensor, eye blink sensor, ultrasonic sensor, alcohol sensor, and GSM modem. The seat belt and alcohol sensors can lock the engine if the driver is not wearing a seat belt or is detected to be under the influence of alcohol. The eye blink sensor and ultrasonic sensor monitor driver alertness and distance to nearby vehicles, and can stop the vehicle automatically if drowsiness or a potential collision is detected. The system then sends an SMS notification using the GSM modem. The overall goal is to provide safety to drivers and vehicles in order to reduce accidents.

Uploaded by

surekha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 90

Alcohol and Drivers drowsy condition detection in vehicles

CHAPTER 1

INTRODUCTION

1.1INTRODUCTION TO PROJECT

This project design is aimed to provide the safety to the driver as well as vehicles.
For this system we use different sensors like seat belt sensor, eye blink sensor,
ultrasonic sensor, alcohol sensor and GSM modem.

In this design initially the seat belt sensor and alcohol sensor gets activated, with the
help of these sensors the engine of the vehicle gets locked when the driver of the vehicle
does not wear the seat belt and is found to be alcoholic.

While the vehicle is in motion and if the driver blinks his eyes continuously as he
feel sleepy, then the vehicles gets stopped automatically. For this we use Eye blink
sensor for detecting the sleepiness of the driver. The Ultrasonic sensor is used to
monitor the distance of the adjacent vehicles by which the vehicle slows down when it
is about to hit the nearby vehicles. If any of the above sensors gets activated then a SMS
will be sent to concerned person using GSM modem.

By this project we can provide the safety to vehicles and drivers, thus we can
achieve safety. The prototype of this project will be a robotic car using which the
operation of sensors will be displayed.

1.2 INTRODUCTION TO EMBEDDED SYSTEM

An embedded system is a special-purpose computer system designed to perform one


or a few dedicated functions, sometimes with real-time computing constraints. It is
usually embedded as part of a complete device including hardware and mechanical
parts. In contrast, a general-purpose computer, such as a personal computer, can do
many different tasks depending on programming. Embedded systems have become very
important today as they control many of the common devices we use.

Since the embedded system is dedicated to specific tasks, design engineers can
optimize it, reducing the size and cost of the product, or increasing the reliability and

KGRCET ECEPage 1
Alcohol and Drivers drowsy condition detection in vehicles

performance. Some embedded systems are mass-produced, benefiting from economies


of scale.

Physically embedded systems range from portable devices such as digital watches
and MP3 players, to large stationary installations like traffic lights, factory controllers,
or the systems controlling nuclear power plants. Complexity varies from low, with a
single microcontroller chip, to very high with multiple units, peripherals and networks
mounted inside a large chassis or enclosure.

In general, "embedded system" is not an exactly defined term, as many systems have
some element of programmability. For example, Hand held computers share some
elements with embedded systems such as the operating systems and microprocessors
which power them but are not truly embedded systems, because they allow different
applications to be load and peripherals to be connected.

An embedded system is some combination of computer hardware and software,


either fixed in capability or programmable, that is specifically designed for a particular
kind of application device.

Industrial machines, automobiles, medical equipment, cameras, household


appliances, airplanes, vending machines, and toys (as well as the more obvious cellular
phone and PDA) are among the myriad possible hosts of an embedded system.

Embedded systems that are programmable are provided with a programming


interface, and embedded systems programming is a specialized occupation.

Certain operating systems or language platforms are tailored for the embedded
market, such as Embedded Java and Windows XP Embedded. However, some low-end
consumer products use very inexpensive microprocessors and limited storage, with the
application and operating system both part of a single program. The program is written
permanently into the system's memory in this case, rather than being loaded into RAM
(random access memory), as programs on a personal computer are.

KGRCET ECEPage 2
Alcohol and Drivers drowsy condition detection in vehicles

1.2.1 CHARACTERISTIC OF EMBEDDED SYSTEM

 Speed (bytes/sec): Should be high speed


 Power (watts): Low power dissipation
 Size and weight: As far as possible small in size and low weight
 Accuracy (%error): Must be very accurate
 Adaptability: High adaptability and accessibility
 Reliability: Must be reliable over a long period of time

1.2.2 APPLICATIONS OF EMBEDDED SYSTEMS

We are living in the Embedded World. You are surrounded with many embedded
products and your daily life largely depends on the proper functioning of these gadgets.
Television, Radio, CD player of your living room, Washing Machine or Microwave
Oven in your kitchen, Card readers, Access Controllers, Palm devices of your work
space enable you to do many of your tasks very effectively. Apart from all these, many
controllers embedded in your car take care of car operations between the bumpers and
most of the times you tend to ignore all these controllers.

 Robotics: industrial robots, machine tools, Robocop soccer robots

 Automotive: cars, trucks, trains

 Aviation: airplanes, helicopters

 Home and Building Automation

 Aerospace: rockets, satellites

 Energy systems: windmills, nuclear plants

 Medical systems: prostheses, revalidation machine.

KGRCET ECEPage 3
Alcohol and Drivers drowsy condition detection in vehicles

1.2.3 MICROCONTROLLER VERSUS MICROPROCESSOR

What is the difference between a Microprocessor and Microcontroller? By


microprocessor is meant the general purpose Microprocessors such as Intel's X86 family
(8086, 80286, 80386, 80486, and the Pentium) or Motorola's 680X0 family (68000,
68010, 68020, 68030, 68040, etc). These microprocessors contain no RAM, no ROM,
and no I/O ports on the chip itself. For this reason, they are commonly referred to as
general-purpose Microprocessors.

A system designer using a general-purpose microprocessor such as the Pentium or


the 68040 must add RAM, ROM, I/O ports, and timers externally to make them
functional. Although the addition of external RAM, ROM, and I/O ports makes these
systems bulkier and much more expensive, they have the advantage of versatility such
that the designer can decide on the amount of RAM, ROM and I/O ports needed to fit
the task at hand. This is not the case with Microcontrollers.

A Microcontroller has a CPU (a microprocessor) in addition to a fixed amount of


RAM, ROM, I/O ports, and a timer all on a single chip. In other words, the processor,
the RAM, ROM, I/O ports and the timer are all embedded together on one chip;
therefore, the designer cannot add any external memory, I/O ports, or timer to it. The
fixed amount of on-chip ROM, RAM, and number of I/O ports in Microcontrollers
makes them ideal for many applications in which cost and space are critical.

In many applications, for example a TV remote control, there is no need for the
computing power of a 486 or even an 8086 microprocessor. These applications most
often require some I/O operations to read signals and turn on and off certain bits.

1.2.4 MICROCONTROLLERS FOR EMBEDDED SYSTEMS

In the Literature discussing microprocessors, we often see the term Embedded


System. Microprocessors and Microcontrollers are widely used in embedded system
products. An embedded system product uses a microprocessor (or Microcontroller) to
do one task only. A printer is an example of embedded system since the processor inside
it performs one task only; namely getting the data and printing it. Contrast this with a

KGRCET ECEPage 4
Alcohol and Drivers drowsy condition detection in vehicles

Pentium based PC. A PC can be used for any number of applications such as word
processor, print-server, bank teller terminal, Video game, network server, or Internet
terminal.

Software for a variety of applications can be loaded and run. Of course the reason a
pc can perform myriad tasks is that it has RAM memory and an operating system that
loads the application software into RAM memory and lets the CPU run it.

In this robot as the fire sensor senses the fire, it senses the signal to microcontroller.
In an Embedded system, there is only one application software that is typically burned
into ROM. An x86 PC contains or is connected to various embedded products such as
keyboard, printer, modem, disk controller, sound card, CD-ROM drives, mouse, and so
on. Each one of these peripherals has a Microcontroller inside it that performs only one
task.

KGRCET ECEPage 5
Alcohol and Drivers drowsy condition detection in vehicles

CHAPTER 2

LITERATURE SURVEY

2.1 PROBLEM STATEMENT

India had earned the questionable qualification of having more number of fatalities
because of street mishaps on the society. Street wellbeing is rising as a noteworthy
social worry far and wide particularly in India. Drinking and driving is as of now a
genuine general medical issue, which is probably going to rise as a standout amongst
the most critical issues sooner rather than later. The primary reason behind this task is
"Drunken driving detection". Since numerous mishaps are increasing due to the liquor
utilization of the driver or the individual who is driving the vehicle. Subsequently drunk
driving is a noteworthy reason of mischance’s in all nations everywhere throughout the
world.

Thus the framework diminishes the quantum of street mischance’s and fatalities
because of drunk driving in future. Drunk driving is the purpose for the vast majority of
the deaths, Since the Drunk Driving Detection and Car Ignition Locking Using Arduino
intends to change that with mechanized, straightforward, noninvasive liquor wellbeing
check in vehicles. Alcohol sensor is implanted on the steering of the car, to such an
extent that when the level of liquor crosses an admissible breaking point, where the start
of vehicle will stops ignition and the motor will stop. The Arduino processor always
uses the liquor sensor information to check drunk driving and works a bolt on the
vehicle. In 2009 alone, more than 10,000 activity fatalities were connected directly to
drivers who had more blood alcohol level as permitted. Numerous accidents occur
because of the carelessness with respect to driver. Numerous drivers drink and drive
which is a criminal offense.

Such drivers are a danger to society and ought to be captured rapidly. Despite the
fact that the nation has laws to check drunken driving yet its viable usage is still to be
worked upon and at times even questionable. For such reason we are outlining a
framework to decide if he/she is fit to drive or not. This framework is fundamentally an
Embedded System which is mix of both programming and equipment which can play

KGRCET ECEPage 6
Alcohol and Drivers drowsy condition detection in vehicles

out some particular capacities. There are developing worry about the quantity of
mischance caused by a man who driving vehicles particularly during drunken. Statistics
demonstrate the accident caused by drunken drivers expanded every year.

As indicated by the Insurance Information Institute, 16,068 individuals were killed in


2000 in liquor related engine vehicle crashes, a 1.8 percent expansion more than 1999,
and alcohol keeps on being a factor in 38 percent of all traffic fatalities. Everything have
identified with level of alcohol in the blood after they drunk. Blood Alcohol Content
(BAC) is typically communicated as a level of alcohol in the blood. High BAC of the
drunken driver will influence their practices likes obviousness, passionate swings, and
outrage or bitterness. There is the exploration about Blood Alcohol Concentration and
with 0.2mg/l or more, (estimated in mg of 1 liquor for each 100ml of blood, or mg/l) the
judgment, coordination and tangible discernment are impeded, response time moderates,
execution in scholarly tests falls, and vision is debilitated. So there is a requirement for
a effective framework to check drunken drivers and this drunk driving detection using
car ignition locking task can be one of the strategies to decrease this issue or more
particular to keep away the drunken driver itself to driving the vehicles.

Consistently, 40 individuals which underneath the age of 25 die due to highway


accidents. What's more, as per the world fitness association, car crashes caused an
around 1.24 million deaths within the year 2010, somewhat down from 1.26 million in
2000. That is one individual is passed on for at regular intervals. Just 28 global areas,
speaking to 449 million individuals (7% of the total population), have all around
legitimate rules that adapt to each of the five threat components. The five perils
components for street mischance’s are pace, drink– utilizing, protective caps, safety
belts and tyke restraints. Over a third piece of road site visitors dying are in low-and
center income nations are among walkers and cyclists. However, under 35% of low and
focus profit countries have directions in zone to monitor those street clients .The vital
point of this gadget is to avoid the charge mischance’s which can be generally happened
because of drunkenness of driving power. This gadget discover the drunkenness of
driving power and spare the passengers from riding, so this attempt to give one type of
security or insurance to driving power and spare remain.

KGRCET ECEPage 7
Alcohol and Drivers drowsy condition detection in vehicles

Alcohol influences the focal sensory system of a man. Indeed, even 0.05% BAC
understands judgment disabled and the capacity to control directing is influenced. In
this paper we have composed a programmed alcohol detector which is coordinated with
the steering wheel. This work identifies with mechanical assembly to prevent a
motorcar from being driven by a drunk driver. At the point when the sensor
distinguishes nearness of alcohol in the breath of the driver, car is bolted automatically.
"Drinking is not just damaging to drunken driver it likewise influence the encompassing
zone and individuals." Now a day’s street accident is real issue everywhere throughout
the world. As report by WHO (World Health Organization) in its first Global status
report (2014) 80,000 of Indian individuals are died on streets due to finished speeding,
drunk driving and different reasons.

Drunk driving is a central point for ascent of deaths on streets. Drink and drive not
just convey street dangers to others, yet in addition influences the wellbeing of his own
life. The greater part of the mischances is happening outside the urban areas because of
the drunk driving. In India consistently auto collision caused by drunk driving 3
thousands of deaths and more than 6 thousands of many wounds in year and its
expanding quickly. As indicated by the framework, the car is controlled automatically.
Other Wide zones of drunk fatalities are suicides, unmanned railroad crossing,
fundamental city activity. The greater part of nowadays, we hear lot of accidents
because of drunken driving. Drunken drivers won't be in stable condition thus the rash
driving is the burden for other road users and furthermore question of life and death for
the drunken driver and for others. The principle reason behind this project is "Drunk
driving detection". Presently, numerous accidents are occurring a direct result of the
liquor utilization of the driver or the individual who is driving the vehicle. In this way
Drunk driving is a noteworthy reason of mishaps in all nations everywhere throughout
the world.

2.2 EXISTING METHODOLOGY

The authors propose to use a smart helmet to avoid accidents. There are many flaws
with their design. A major shortcoming is the limitation of the its application to only
vehicles which use helmets, i.e. two wheelers which is not a feasible idea while driving,

KGRCET ECEPage 8
Alcohol and Drivers drowsy condition detection in vehicles

especially for short distances. Another drawback being, the system when implemented
makes the helmet too heavy which is not favorable for driving. [1]

The authors discuss about complex health monitoring systems and infrared sensor to
detect the presence of alcohol. A major drawback of this system is the possibility of a
false alarm. The system is designed in a manner that even a slight change in some
particular condition can result in ringing false alarms even though everything was
normal. In our project, we are using only the required technology thereby making the
system more reliable and cost effective when implemented. [2]

The authors have proposed a system to prevent the accidents due to drunken driving.
Major drawback of this system is that they have used PIC16F877A microcontroller
which is not as useful as Arduino Uno microcontroller that we are using. Also, they
have used an old design system which is not useful and increases the overall cost of the
system which makes it expensive and somewhat unaffordable to certain segments of
society thereby limiting its scope to be used. Hence, our system is more cost effective
and can be easily afforded. [3]

The authors discuss the problem of drunken driving and propose to solve it by
suggesting a system. However, the major drawback of their system is that they are using
MQ2 alcohol sensor which is not accurate and is not specifically sensitive to alcohol. In
our project, we are using a MQ3 sensor which is designed to be accurate towards
alcohol detection which gives more accurate results and saves from raising false alarms.
Also, they have used a PIC microcontroller which is expensive when compared to
Arduino Uno which is open sourced. [4]

The author has tried to design a system to tackle the problem of helmet negligence
and alcohol detection at the same time. The system is overly complex. Also, the author
has used P89V51RD2 microcontroller which is expensive when compared to Arduino
Uno. Also, this system has a limited scope is usage because it can work only with 2
wheelers and not with any other segment of vehicle. However, our system can be
integrated to not only 2 wheelers, but also with any kind of vehicle thereby preventing
more accidents and saving more people. [5]

KGRCET ECEPage 9
Alcohol and Drivers drowsy condition detection in vehicles

Previously Nissan a reputed company having a good market had tried to place a
system in their newly designed cars. A system which is using alcohol detector manually.
it was like when a person sits in a car then he or she has to take the alcohol detector in
his hand after rotating the keys and take that device in his mouth and breath with a good
pressure for three times then it use to check the value of ethanol level on the breath and
gave the readings. If the reading is above the set point then the car will not start. If the
reading is below then its ok and car will start quickly and you can drive. [6]

Now from here the main problem starts or we can say the drawback of the system
comes into existence the problem is that if one of my friend is travelling with me and I
am dunked then at the time of ignition what if my friend pass out the alcohol detection
process and then after starting the car i sit on the driver’s seat and drive the car. So in
this manner there is no use of this particular project and the system fails completely.
The biggest problem was that we are using the system manually due to which car
system can be fooled. And one more problem was that if the alcohol detected then the
car will not start so there is no way for that person to reach his way.

2.3 PROPOSED METHODOLOGY

Using Arduino Uno microcontroller, we propose to design a system consisting of an


alcohol sensor MQ3 to detect the presence of alcohol by analyzing a person’s breath and
shutting down the vehicle’s engine when a specific amount of alcohol is detected to
prevent any kind of mishap or accident that may occur due to the driver taking control
over the vehicle. Hence, drunken driving is controlled, thereby minimizing the loss of
life and property.

KGRCET ECEPage 10
Alcohol and Drivers drowsy condition detection in vehicles

CHAPTER 3

HARDWARE REQUIREMENT
Block diagram of alcohol and drivers drowsy condition detection in
vehicles

Power
Supply LCD Display

16X2

Seat belt
A

R
Alcohol
D DC Motor 1
Sensor
L293D
U

I
Eye blinking
N DC Motor 2
Sensor

Ultrasonic
GSM
Sensor
Modem

Figure 3.1: Block Diagram of Alcohol and Drivers drowsy condition detection in
vehicles

3.1 Microcontroller

3.1.1 Introduction

Microcontroller as the name suggests, a small controller. They are like single chip
computers that are often embedded into other systems to function as

KGRCET ECEPage 11
Alcohol and Drivers drowsy condition detection in vehicles

processing/controlling unit. For example, the control you are using probably has
microcontrollers inside that do decoding and other 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 Arduino Uno can be powered via the USB connection or with an external power
supply. The power source is selected automatically. External (non-USB) power can
come either from an AC-to-DC adapter (wall-wart) or battery.

The adapter can be connected by plugging a 2.1mm center-positive plug into the
board's power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers
of the POWER connector. The board can operate on an external supply of 6 to 20 volts.

If supplied with less than 7V, however, the 5Vpin may supply less than five volts
and the board may be unstable. If using more than 12V, the voltage regulator may
overheat and damage the board. The recommended range is 7 to 12 volts

KGRCET ECEPage 12
Alcohol and Drivers drowsy condition detection in vehicles

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.

Memory

The Atmega328 has 32 KB of flash memory for storing code (of which 0,5 KB is
used for the boot loader); 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-50k Ohms. 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.

KGRCET ECEPage 13
Alcohol and Drivers drowsy condition detection in vehicles

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 their range using the AREF pin and the analog Reference()
function. Additionally, some pins have specialized

Functionality

I2C: 4 (SDA) and 5 (SCL). Support I2C (TWI) communication using the Wire library.

There are a couple of other pins on the board:

Ref. Reference voltage for the analog inputs. Used with analog Reference().

Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset
button to shields which block the one on the board.

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. However, on Windows, 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

KGRCET ECEPage 14
Alcohol and Drivers drowsy condition detection in vehicles

the board will flash when data is being transmitted via the USB-to serial chip and USB
connection to the computer (but not for serial communication on pins 0 and 1).

A Software Serial library allows for serial communication on any of the Uno's digital
pins. The ATmega328 also support I2C (TWI) and SPI communication.

The Arduino software includes a Wire library to simplify use of the I2C bus

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.

Figure 3.1: Arduino Uno board

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.

KGRCET ECEPage 15
Alcohol and Drivers drowsy condition detection in vehicles

3.1.3.1 Technical Specifications

Table 3.1: Arduino Uno specifications

The Arduino Uno can be powered via the USB connection or with an external power
supply. The power source is selected automatically. External (non-USB) power can
come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be
connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads
from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector.
The board can operate on an external supply of 6 to 20 volts. If supplied with less than
7V, however, the 5V pin may supply less than five volts and the board may be unstable.
If using more than 12V, the voltage regulator may overheat and damage the board. The
recommended range is 7 to 12 volts.

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.

External power supply

Arduino boards can be powered directly from the AC mains power supply by
connecting it to the power supply (Barrel Jack)

KGRCET ECEPage 16
Alcohol and Drivers drowsy condition detection in vehicles

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.

Crystal Oscillator

The crystal oscillator helps Arduino in dealing with time issues. How does Arduino
calculate time? The answer is, by using the crystal oscillator. 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

5-17. Arduino Reset

It can reset your Arduino board, i.e., start your program from the beginning. It can
reset the UNO board in two ways. First, by using the reset button (17) on the board.
Second, you can connect an external reset button to the Arduino pin labelled RESET
(5).

6-9. Pins (3.3, 5, GND, Vin)

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, any of which can be
used to ground your circuit.

Vin (9): This pin also can be used to power the Arduino board from an external power
source, like AC mains power supply.

Analog pins

The Arduino UNO board has five analog input pins A0 through A5. These pins can
read the signal from an analog sensor like the humidity sensor or temperature sensor and
convert it into a digital value that can be read by the microprocessor.

KGRCET ECEPage 17
Alcohol and Drivers drowsy condition detection in vehicles

Main microcontroller

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 Arduino is slightly different from
board to board. The microcontrollers are usually of the ATMEL Company. You must
know what IC your board has before loading up a new program from the Arduino IDE.
This information is available on the top of the IC. For more details about the IC
construction and functions, you can refer to the data sheet.

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

Figure 3.2: Pin diagram

3.1.3.2 Pin Description

VCC: Digital supply voltage.

GND: Ground.

KGRCET ECEPage 18
Alcohol and Drivers drowsy condition detection in vehicles

Port B (PB [7:0]) XTAL1/XTAL2/TOSC1/TOSC2

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.

Depending on the clock selection fuse settings, PB6 can be used as input to the
inverting Oscillator amplifier and input to the internal clock operating circuit.

Depending on the clock selection fuse settings, PB7 can be used as output from the
inverting Oscillator amplifier.

If the Internal Calibrated RC Oscillator is used as chip clock source, PB[7:6] is used
as TOSC[2:1] input for the Asynchronous Timer/Counter2 if the AS2 bit in ASSR is
set.

Port C (PC [5:0])

Port C is a 7-bit bi-directional I/O port with internal pull-up resistors (selected for
each bit). The PC[5:0] 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.

PC6/RESET

If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the
electrical characteristics of PC6 differ from those of the other pins of Port C.

If the RSTDISBL Fuse is unprogrammed, PC6 is used as a 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.

KGRCET ECEPage 19
Alcohol and Drivers drowsy condition detection in vehicles

Port D (PD [7:0]): 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.

AVCC: AVCC is the supply voltage pin for the A/D Converter, PC[3:0], and PE[3:2].
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. Note that PC[6:4] use
digital supply voltage, VCC.

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

ADC [7:6] (TQFP and VFQFN Package Only): In the TQFP and VFQFN package,
ADC [7:6] serve as analog inputs to the A/D converter. These pins are powered from
the analog supply and serve as 10-bit ADC channels.

12. 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 saving the output device to the master of the SPI bus.

13. 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.

14. 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.
The speed of flashing depends on the baud rate used by the board. RX flashes during the
receiving process.

15. 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

KGRCET ECEPage 20
Alcohol and Drivers drowsy condition detection in vehicles

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.

16. 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.

3.2 Power Supply:

Dc Battery

A battery is a device that can store electricity. Some are rechargeable, and some are
not. They store direct current (DC) electricity.

A battery really means two or more wet or dry cells connected in series for more
voltage, or in parallel for more current, although people often call a cell a battery. AA,
AAA, C, and D batteries all have 1.5 volts. The voltage of a cell depends on the
chemicals used while the amount of power or current it can supply also depends on how
large the cell is; a bigger cell of a given type can supply more amps, or for a longer
time.

The chemical reactions that occur in a battery are exothermic reactions and, thus,
produce heat. For example, if you leave your laptop on for a long time, and then touch
the battery, it will be warm or hot. However, the batteries used in laptops are called
lithium-ion batteries and they sometimes do have a fire hazard (A few years ago, dell
laptops that that were powered by lithium batteries began to catch fire, though this event
was rare.).

Batteries come in lots of different shapes and sizes and voltages. It is possible, but
not easy, to run wires to use an odd size battery for an odd purpose.

Batteries are always more costly/expensive than mains electricity. But mains
electricity is not suitable for things that are mobile. Bicycles have tail-lights that can be
operated by batteries, and sometimes by a little generator powered by the wheels. Hand
and foot generators can be used to replace batteries in various devices, but they can be

KGRCET ECEPage 21
Alcohol and Drivers drowsy condition detection in vehicles

tiresome. Wind-up generators are now available to power small clockwork radios,
clockwork torches, etc.

Since clockwork clocks have been around for hundreds of years, and batteries for
two hundred, it is amazing that no-one thought of a clockwork torch until recently.

Rechargeable batteries are recharged by reversing the chemical reaction that occurs
within the battery. But a rechargeable battery can only be recharged a given amount of
time (recharge life). Even iPods, with built in batteries, cannot be recharged forever.
Moreover, each time a battery is recharged, its ability to hold a charge is degraded a bit.
Non-rechargeable batteries should not be charged as various caustic and corrosive
substances can leak out, such as potassium hydroxide.

KGRCET ECEPage 22
Alcohol and Drivers drowsy condition detection in vehicles

Figure 3.3 Batteries

The very first batteries were invented in the middle east around 1000 B.C. Then they
were buried and forgotten about. The first battery was invented in 1800 by Alessandro
Volta. Nowadays, his battery is called the voltaic pile. Later batteries were bottles with
a fluid and some metal rods in them. People had to be careful not to turn these batteries
upside-down so the fluid would spill.

In modern batteries, the fluid is "soaked up" in a kind of paste. And everything is put
in a completely tight case: Because of this case, nothing can spill out of the battery. An
exception is car batteries; they still have liquid inside.

KGRCET ECEPage 23
Alcohol and Drivers drowsy condition detection in vehicles

Types of batteries

 Alkaline battery, "alkaline", not rechargeable


 Leclanche battery, "super heavy duty", not rechargeable
 Nickel metal-hydride battery, "NiMH", rechargeable
 Nickel cadmium battery, "NiCd", rechargeable
 Lead acid battery, rechargeable, car battery
 Lithium battery, unrechargeable, "coin cell"
 Lithium-ion battery, rechargeable, used in cell phones and laptops
 Mercury battery, unrechargeable
 Silver oxide battery, unrechargeable, watch battery

Alternatives to Batteries

 Solar cell

3.3 Seat Belt

Fig 3.4: Seat Belt

A seat belt (also known as a seatbelt or safety belt) is a vehicle safety device


designed to secure the occupant of a vehicle against harmful movement that may result
during a collision or a sudden stop. A seat belt functions to reduce the likelihood
of death or serious injury in a traffic collision by reducing the force of secondary
impacts with interior strike hazards, by keeping occupants positioned correctly for
maximum effectiveness of the airbag (if equipped) and by preventing occupants being
ejected from the vehicle in a crash or if the vehicle rolls over.

KGRCET ECEPage 24
Alcohol and Drivers drowsy condition detection in vehicles

When in motion, the driver and passengers are travelling at the same speed as the
car. If the driver makes the car suddenly stop or crashes it, the driver and passengers
continue at the same speed the car was going before it stopped. A seatbelt applies an
opposing force to the driver and passengers to prevent them from falling out or making
contact with the interior of the car. Seatbelts are considered Primary Restraint Systems
(PRS), because of their vital role in occupant safety.

3.4 Alcohol Gas Sensor MQ3

Fig 3.5: Alcohol Gas Sensor MQ3

This module is made using Alcohol Gas Sensor MQ3. It is a low cost semiconductor
sensor which can detect the presence of alcohol gases at concentrations from 0.05 mg/L
to 10 mg/L. The sensitive material used for this sensor is SnO2, whose conductivity is
lower in clean air. It’s conductivity increases as the concentration of alcohol gases
increases. It has high sensitivity to alcohol and has a good resistance to disturbances due
to smoke, vapor and gasoline. This module provides both digital and analog outputs.
MQ3 alcohol sensor module can be easily interfaced with Microcontrollers, Arduino
Boards etc.

KGRCET ECEPage 25
Alcohol and Drivers drowsy condition detection in vehicles

This alcohol sensor is suitable for detecting alcohol concentration on your breath,
just like your common breathalyzer. It has a high sensitivity and fast response time.
Sensor provides an analog resistive output based on alcohol concentration. The drive
circuit is very simple, all it needs is one resistor. A simple interface could be a 0-3.3V
ADC.

3.5 Eye Blink Sensor


What Is Infrared?
Infrared is an energy radiation with a frequency below our eyes sensitivity, so we
cannot see it. Even that we can not "see" sound frequencies, we know that it exist, we
can listen them.

Fig 3.6: Infrared rays


Even that we cannot see or hear infrared, we can feel it at our skin temperature
sensors. When you approach your hand to fire or warm element, you will "feel" the
heat, but you can't see it. You can see the fire because it emits other types of radiation,
visible to your eyes, but it also emits lots of infrared that you can only feel in your skin.

3.5.1 IR GENERATION
To generate a 36 kHz pulsating infrared is quite easy, more difficult is to receive and
identify this frequency.  This is why some companies produce infrared receives, that
contains the filters, decoding circuits and the output shaper, that delivers a square wave,
meaning the existence or not of the 36kHz incoming pulsating infrared.

It means that those 3 dollars small units, have an output pin that goes high (+5V)
when there is a pulsating 36kHz infrared in front of it, and zero volts when there is not
this radiation.

KGRCET ECEPage 26
Alcohol and Drivers drowsy condition detection in vehicles

Fig 3.7: IR generation


A square wave of approximately 27uS (microseconds) injected at the base of a
transistor, can drive an infrared LED to transmit this pulsating light wave.  Upon its
presence, the commercial receiver will switch its output to high level (+5V).If you can
turn on and off this frequency at the transmitter, your receiver's output will indicate
when the transmitter is on or off.

Fig 3.8: IR generation


Those IR demodulators have inverted logic at its output, when a burst of IR is sensed
it drives its output to low level, meaning logic level = 1.

The TV, VCR, and Audio equipment manufacturers for long use infra-red at their
remote controls.
To avoid a Philips remote control to change channels in a Panasonic TV, they use
different codification at the infrared, even that all of them use basically the same
transmitted frequency, from 36 to 50 kHz.  So, all of them use a different combination
of bits or how to code the transmitted data to avoid interference. 

KGRCET ECEPage 27
Alcohol and Drivers drowsy condition detection in vehicles

RC-5
Various remote control systems are used in electronic equipment today. The RC5
control protocol is one of the most popular and is widely used to control numerous
home appliances, entertainment systems and some industrial applications including
utility consumption remote meter reading, contact-less apparatus control, telemetry data
transmission, and car security systems. Philips originally invented this protocol and
virtually all Philips’ remotes use this protocol. Following is a description of the RC5.

When the user pushes a button on the hand-held remote, the device is activated and
sends modulated infrared light to transmit the command. The remote separates
command data into packets. Each data packet consists of a 14-bit data word, which is
repeated if the user continues to push the remote button.

The data packet structure is as follows:


 2 start bits,
 1 control bit,
 5 address bits,
 6 command bits.

The start bits are always logic ‘1’ and intended to calibrate the optical receiver
automatic gain control loop. Next, is the control bit. This bit is inverted each time the
user releases the remote button and is intended to differentiate situations when the user
continues to hold the same button or presses it again. The next 5 bits are the address bits
and select the destination device. A number of devices can use RC5 at the same time.
To exclude possible interference, each must use a different address. The 6 command
bits describe the actual command. As a result, a RC5 transmitter can send the 2048
unique commands.

The transmitter shifts the data word, applies Manchester encoding and passes the
created one-bit sequence to a control carrier frequency signal amplitude modulator.

KGRCET ECEPage 28
Alcohol and Drivers drowsy condition detection in vehicles

The amplitude modulated carrier signal is sent to the optical transmitter, which
radiates the infrared light. In RC5 systems the carrier frequency has been set to 36 kHz.
Figure below displays the RC5 protocol.

The receiver performs the reverse function. The photo detector converts optical
transmission into electric signals, filters it and executes amplitude demodulation. The
receiver output bit stream can be used to decode the RC5 data word. This operation is
done by the microprocessor typically, but complete hardware implementations are
present on the market as well. Single-die optical receivers are being mass produced by a
number of companies such as Siemens, Temic, Sharp, Xiamen Hualian, Japanese
Electric and others. Please note that the receiver output is inverted (log. 1 corresponds to
illumination absence).

3.5.2 The IR Receiver


Many different receiver circuits exist on the market. The most important selection
criteria are the modulation frequency used and the availability in you region.

Fig 3.9: IR receiver

In the picture above, the typical block diagram of an IR receiver is shown. The
received IR signal is picked up by the IR detection diode on the left side of the diagram.
This signal is amplified and limited by the first 2 stages. The limiter acts as an AGC
circuit to get a constant pulse level, regardless of the distance to the handset. As it can
be seen, only the AC signal is sent to the Band Pass Filter. The Band Pass Filter is tuned
to the modulation frequency of the handset unit. Common frequencies range from 30
kHz to 60 kHz in consumer electronics.

The next stages are a detector, integrator and comparator. The purpose of these three
blocks is to detect the presence of the modulation frequency. If this modulation
frequency is present the output of the comparator will be pulled low.

KGRCET ECEPage 29
Alcohol and Drivers drowsy condition detection in vehicles

All these blocks are integrated into a single electronic component. There are many
different manufacturers of these components on the market. And most devices are
available in several versions each of which are tuned to a particular modulation
frequency.

It should be noted that the amplifier is set to a very high gain. Therefore, the system
tends to start oscillating very easily. Placing a large capacitor of at least 22µF close to
the receiver's power connections is mandatory to decouple the power lines.

Some data sheets recommend a resistor of 330 Ohms in series with the power supply
to further decouple the power supply from the rest of the circuit.

Some examples for such disturbance signals which are suppressed by the TSOP17 are:

 DC light (e.g. from tungsten bulb or sunlight)


 Continuous signal at 38 kHz or at any other frequency
 Signals from fluorescent lamps with electronic ballast (an example of the signal
modulation is in the figure below).

Fig 3.10: IR signal from Fluorescent Lamp with low Modulation


There are several manufacturers of IR receivers on the market. Siemens, Vishay and
Telefunken are the main suppliers here in Europe. Siemens has its SFH506-xx series,
where xx denotes the modulation frequency of 30, 33, 36, 38, 40 or 56 kHz. Telefunken

KGRCET ECEPage 30
Alcohol and Drivers drowsy condition detection in vehicles

had its TFMS5xx0 and TK18xx series, where xx again indicates the modulation
frequency the device is tuned to. It appears that these parts have now become obsolete.
They are replaced by the Vishay TSOP12xx, TSOP48xx and TSOP62xx product series.

Sharp, Xiamen Hualian and Japanese Electric are 3 Asian IR receiver producing
companies. Sharp has devices with very cryptic ID names, like: GP1UD26xK,
GP1UD27xK and GP1UD28xK, where x is related to the modulation frequency.
Hualian has its HRMxx00 series, like the HRM3700 and HRM3800. Japanese Electric
has a series of devices that don't include the modulation frequency in the part's ID. The
PIC-12042LM is tuned to 36.7 kHz, and the PIC12043LM is tuned to 37.9 kHz.
3.6 Relay

A relay is an electrically controllable switch widely used in industrial controls,


automobiles and appliances.

The relay allows the isolation of two separate sections of a system with two different
voltage sources i.e., a small amount of voltage/current on one side can handle a large
amount of voltage/current on the other side but there is no chance that these two
voltages mix up.

Fig 3.11: Circuit symbol of a relay

Operation

When current flows through the coil, a magnetic field are created around the coil i.e.,
the coil is energized. This causes the armature to be attracted to the coil. The armature’s
contact acts like a switch and closes or opens the circuit. When the coil is not energized,
a spring pulls the armature to its normal state of open or closed. There are all types of
relays for all kinds of applications.

KGRCET ECEPage 31
Alcohol and Drivers drowsy condition detection in vehicles

Fig 3.12: Relay Operation and use of protection diodes

Transistors and ICs must be protected from the brief high voltage 'spike' produced
when the relay coil is switched off. The above diagram shows how a signal diode (eg
1N4148) is connected across the relay coil to provide this protection. The diode is
connected 'backwards' so that it will normally not conduct.

Conduction occurs only when the relay coil is switched off, at this moment the
current tries to flow continuously through the coil and it is safely diverted through the
diode. Without the diode no current could flow and the coil would produce a damaging
high voltage 'spike' in its attempt to keep the current flowing.

In choosing a relay, the following characteristics need to be considered:

1. The contacts can be normally open (NO) or normally closed (NC). In the NC type,
the contacts are closed when the coil is not energized. In the NO type, the contacts are
closed when the coil is energized.

2. There can be one or more contacts. i.e., different types like SPST (single pole single
throw), SPDT (single pole double throw) and DPDT (double pole double throw) relay.

3. The voltage and current required to energize the coil. The voltage can vary from a
few volts to 50 volts, while the current can be from a few milliamps to 20milliamps.

KGRCET ECEPage 32
Alcohol and Drivers drowsy condition detection in vehicles

The relay has a minimum voltage, below which the coil will not be energized. This
minimum voltage is called the “pull-in” voltage.

4. The minimum DC/AC voltage and current that can be handled by the contacts. This is
in the range of a few volts to hundreds of volts, while the current can be from a few
amps to 40A or more, depending on the relay.

3.6.1 Driving a relay

An SPDT relay consists of five pins, two for the magnetic coil, one as the common
terminal and the last pins as normally connected pin and normally closed pin. When the
current flows through this coil, the coil gets energized. Initially when the coil is not
energized, there will be a connection between the common terminal and normally
closed pin. But when the coil is energized, this connection breaks and a new connection
between the common terminal and normally open pin will be established. Thus when
there is an input from the microcontroller to the relay, the relay will be switched on.
Thus when the relay is on, it can drive the loads connected between the common
terminal and normally open pin. Therefore, the relay takes 5V from the microcontroller
and drives the loads which consume high currents. Thus the relay acts as an isolation
device.

Digital systems and microcontroller pins lack sufficient current to drive the relay.
While the relay’s coil needs around 10milli amps to be energized, the microcontroller’s
pin can provide a maximum of 1-2milli amps current. For this reason, a driver such as
ULN2003 or a power transistor is placed in between the microcontroller and the relay.
In order to operate more than one relay, ULN2003 can be connected between relay and
microcontroller

3.7 DC Motor

Electric motors are used to efficiently convert electrical energy into mechanical
energy. Magnetism is the basis of their principles of operation. They use permanent
magnets, electromagnets, and exploit the magnetic properties of materials in order to
create these amazing machines.

KGRCET ECEPage 33
Alcohol and Drivers drowsy condition detection in vehicles

There are several types of electric motors available today. The following outline
gives an overview of several popular ones. There are two main classes of motors: AC
and DC. AC motors require an alternating current or voltage source (like the power
coming out of the wall outlets in your house) to make them work. DC motors require a
direct current or voltage source (like the voltage coming out of batteries) to make them
work. Universal motors can work on either type of power. Not only is the construction
of the motors different, but the means used to control the speed and torque created by
each of these motors also varies, although the principles of power conversion are
common to both.

Motors are used just about everywhere. In our house, there is a motor in the furnace
for the blower, for the intake air, in the sump well, dehumidifier, in the kitchen in the
exhaust hood above the stove, microwave fan, refrigerator compressor and cooling fan,
can opener, garbage disposer, dish washer pump, clocks, computer fans, ceiling fans,
and many more items.

In industry, motors are used to move, lift, rotate, accelerate, brake, lower and spin
material in order to coat, paint, punch, plate, make or form steel, film, paper, tissue,
aluminum, plastic and other raw materials.

They range in power ratings from less than 1/100 hp to over 100,000 hp.  The rotate
as slowly as 0.001 rpm to over 100,000 rpm.  They range in physical size from as small
as the head of a pin to the size of a locomotive engine.

What happens when a wire carrying current is within a magnetic field?

This is the Left Hand Rule for motors. The first finger points in the direction of the
magnetic field (first - field), which goes from the North pole to the South pole. The
second finger points in the direction of the current in the wire (second - current). The
thumb then points in the direction the wire is thrust or pushed while in the magnetic
field (thumb - torque or thrust).

So, when a wire carrying current is perpendicular to a magnetic field, a force is


created on the wire causing it to move perpendicular to the field and direction of
current.

KGRCET ECEPage 34
Alcohol and Drivers drowsy condition detection in vehicles

The greater the current in the wire, or the greater the magnetic field, the faster the
wire moves because of the greater force created.  If the current in the wire is parallel to
the magnetic field, there will be no force on the wire.
DC Motors

Fig 3.13: DC Motor

DC motors are fairly simple to understand.  They are also simple to make and only
require a battery or dc supply to make them run. 

A simple motor has six parts, as shown in the diagram below:


 Armature or rotor
 Commutator
 Brushes
 Axle
 Field magnet
 DC power supply of some sort
An electric motor is all about magnets and magnetism: A motor uses magnets to
create motion. If you have ever played with magnets you know about the fundamental
law of all magnets: Opposites attract and likes repel. So if you have two bar magnets
with their ends marked "north" and "south," then the north end of one magnet will
attract the south end of the other. On the other hand, the north end of one magnet will
repel the north end of the other (and similarly, south will repel south). Inside an electric
motor, these attracting and repelling forces create rotational motion.

KGRCET ECEPage 35
Alcohol and Drivers drowsy condition detection in vehicles

Fig 3.14: Two bar magnets with their ends marked North and South

The armature (or rotor) is an electromagnet, while the field magnet is a permanent
magnet (the field magnet could be an electromagnet as well, but in most small motors it
is not in order to save power).
When you put all of these parts together, here is a complete electric motor:

Fig 3.15: Two bar magnets with their ends marked North and South
In the above figure, the armature winding has been left out so that it is easier to see
the commutator in action. The key thing to notice is that as the armature passes through
the horizontal position, the poles of the electromagnet flip. Because of the flip, the north

KGRCET ECEPage 36
Alcohol and Drivers drowsy condition detection in vehicles

pole of the electromagnet is always above the axle so it can repel the field magnet's
North Pole and attract the field magnet's south pole.

Even a small electric motor contains the same pieces described above: two small
permanent magnets, a commutator, two brushes, and an electromagnet made by winding
wire around a piece of metal. Almost always, however, the rotor will have three poles
rather than the two poles as shown in this article. There are two good reasons for a
motor to have three poles:
 It causes the motor to have better dynamics. In a two-pole motor, if the
electromagnet is at the balance point, perfectly horizontal between the two poles
of the field magnet when the motor starts, one can imagine the armature getting
"stuck" there. This never happens in a three-pole motor.
 Each time the commutator hits the point where it flips the field in a two-pole
motor, the commutator shorts out the battery (directly connects the positive and
negative terminals) for a moment. This shorting wastes energy and drains the
battery needlessly. A three-pole motor solves this problem as well.
It is possible to have any number of poles, depending on the size of the motor and
the specific application it is being used in.

Types of Motors
Split Phase
The split phase motor is mostly used for "medium starting" applications. It has start
and run windings, both are energized when the motor is started. When the motor reaches
about 75% of its rated full load speed, the starting winding is disconnected by an
automatic switch.
Uses
This motor is used where stops and starts are somewhat frequent. Common
applications of split phase motors include: fans, blowers, office machines and tools such
as small saws or drill presses where the load is applied after the motor has obtained its
operating speed.

Capacitor Start

KGRCET ECEPage 37
Alcohol and Drivers drowsy condition detection in vehicles

This motor has a capacitor in series with a starting winding and provides more than
double the starting torque with one third less starting current than the split phase motor.
Because of this improved starting ability, the capacitor start motor is used for loads
which are hard to start.
It has good efficiency and requires starting currents of approximately five times full
load current. The capacitor and starting windings are disconnected from the circuit by
an automatic switch when the motor reaches about 75% of its rated full load speed.
Uses
Common uses include: compressors, pumps, machine tools, air conditioners,
conveyors, blowers, fans and other hard to start applications.
Horsepower & RPM
Horsepower
Electric motors are rated by horsepower, the home shop will probably utilize motors
from 1/4 HP for small tools and up to 5 HP on air compressors. Not all motors are rated
the same, some are rated under load, others as peak horsepower and hence we have 5
HP compressors with huge motors and 5 Hp shoves with tiny little motors.
Unfortunately all 5 HP compressor motors are not equal in actual power either, to judge
the true horsepower the easiest way is to look at the amperage of the motor.
Electric motors are not efficient, most have a rating of about 50% due to factors such
as heat and friction and some may be as high as 70%.
This chart will give a basic idea of the true horse power rating compared to the
ampere rating. Motors with a higher efficiency rating will draw fewer amps, for
example a 5 HP motor with a 50% efficiency rating will draw about 32 amps at 230
VAC compared to about 23 amps for a motor with a 70% rating.

KGRCET ECEPage 38
Alcohol and Drivers drowsy condition detection in vehicles

Table 3.2: True horse power rating compared to the ampere rating

A quick general calculation when looking at a motor is 1 HP = 10 amps on 110 volts


and 1 HP = 5 amps on 220 volts.
RPM
The shaft on a typical shop motor will rotate at either 1725 or 3450 RPM
(revolutions per minute).
The speed of the driven machine will be determined by the size of pulleys used, for
example a 3450 RPM motor can be replaced by a 1750 RPM motor if the diameter of
the pulley on the motor is doubled. The opposite is true as well but if the pulley on the
1750 RPM motor is small it is not always possible to replace it with one half the size. It
may be possible to double the pulley size on the driven machine if it uses a standard
type of pulley, (not easily done on air compressors for example).
Electronic speed reducers such as the ones sold for routers will not work on induction
type motors.
Phase, Voltage & Rotation
Whether or not you can use a motor will likely depend on these factors.
Single Phase
Ordinary household wiring is single phase, alternating current. Each cycle peaks and
dips as shown. To run a three phase motor a phase converter must be used, usually this
is not practical, it is often less expensive to change the motor on a machine to a single
phase style.

KGRCET ECEPage 39
Alcohol and Drivers drowsy condition detection in vehicles

Three Phase
This is used in industrial shops, rather than peaks and valleys the current supply is
more even because of the other two cycles each offset by 120 degrees.

Voltage
Many motors are dual voltage i.e., by simply changing the wiring configuration, they
can be run on 110 volts or 220 volts. Motors usually run better on 220 volts, especially
if there is any line loss because of having to use a long wire to reach the power supply.
Motors are available for both AC and DC current, our typical home wiring will be AC.
There are DC converters available which are used in applications where the speed of the
motor is controlled.
Rotation
The direction the shaft rotates can be changed on most motors by switching the right
wires. The direction of rotation is usually determined by viewing the motor from the
shaft end and is designated as CW (clockwise) or CCW (counter-clockwise).
Inside the Wipers
The wipers combine two mechanical technologies to perform their task
1. A combination electric motor and worm gear reduction provides power to the
wipers.
2. A neat linkage converts the rotational output of the motor into the back-and-
forth motion of the wipers.
On any gear, the ratio is determined by the distances from the center of the gear
to the point of contact. For instance, in a device with two gears, if one gear is twice the
diameter of the other, the ratio would be 2:1. One of the most primitive types of gears
we could look at would be a wheel with wooden pegs sticking out of it.
The problem with this type of gear is that the distance from the center of each
gear to the point of contact changes as the gears rotate. This means that the gear ratio
changes as the gear turns, meaning that the output speed also changes. If you used a
gear like this in your car, it would be impossible to maintain a constant speed you would
be accelerating and decelerating constantly.

KGRCET ECEPage 40
Alcohol and Drivers drowsy condition detection in vehicles

Worm gears
These are used when large gear reductions are needed. It is common for worm gears
to have reductions of 20:1, and even up to 300:1 or greater.
Many worm gears have an interesting property that no other gear set has: the worm
can easily turn the gear, but the gear cannot turn the worm. This is because the angle on
the worm is so shallow that when the gear tries to spin it, the friction between the gear
and the worm holds the worm in place. The worm gear is shown in the below figure.

Fig 3.16: Worm gear


Motor and Gear Reduction
It takes a lot of force to accelerate the wiper blades back and forth across the
windshield so quickly. In order to generate this type of force, a worm gear is used on the
output of a small electric motor.
The worm gear reduction can multiply the torque of the motor by about 50 times,
while slowing the output speed of the electric motor by 50 times as well. The output of
the gear reduction operates a linkage that moves the wipers back and forth.
Inside the motor/gear assembly is an electronic circuit that senses when the wipers
are in their down position. The circuit maintains power to the wipers until they are
parked at the bottom of the windshield, and then cuts the power to the motor. This
circuit also parks the wipers between wipes when they are on their intermittent setting.

KGRCET ECEPage 41
Alcohol and Drivers drowsy condition detection in vehicles

Linkage
A short cam is attached to the output shaft of the gear reduction. This cam spins
around as the wiper motor turns. The cam is connected to a long rod; as the cam spins, it
moves the rod back and forth. The long rod is connected to a short rod that actuates the
wiper blade on the driver's side. Another long rod transmits the force from the driver-
side to the passenger-side wiper blade.
Operational Specifications of Motors are shown in below Table.

Table 3.3 True horse power rating compared to the ampere rating
Description of the wiper motors selected
The motor is two pole design having high energy permanent magnets, together with
a gear box housing, having two stages of gear reduction .power from the motor is a
transferred by a three start worm on a extension of the armature shaft through a two
stage gear system.
A ball bearing system is provided on the commutator end of the armature to
minimize the friction losses and thereby increase torque of the wiper motor. Power from
the final gear arm spindles .A special inbuilt limit switch ensures in applying
regenerative braking to the OFF position.
Thermal protector is connected in series with armature to avoid burning of armature
under locked position. Consistent parking of the wiper arms and blades in the correct
position is there by ensured. The side on which the arms come to rest is preset to
requirements.
Electrical connections are made to the motor via a non-reversible in line plug and
socket assembly .This type of connections ensures that the correct motor polarity is

KGRCET ECEPage 42
Alcohol and Drivers drowsy condition detection in vehicles

maintained when the motor is connected to the vehicle wiring. The wiper motor
incorporates radio interference capacitor.

3.8 Ultrasonic sensor


The sensor is primarily intended to be used in security systems for detection of
moving objects, but can be effectively involved in intelligent children’s toys, automatic
door opening devices, and sports training and contact-less-speed measurement
equipment.

Introduction
Modern security systems utilize various types of sensors to detect unauthorized
object access attempts. The sensor collection includes infrared, microwave and
ultrasound devices, which are intended to detect moving objects. Each type of sensor is
characterized by its own advantages and drawbacks. Microwave sensors are effective in
large apartments because microwaves pass through dielectric materials. But these
sensors consist of expensive super-high frequency components and their radiation is
unhealthy for living organisms.

Infrared sensors are characterized by high sensitivity, low cost and are widely used.
But, these sensors can generate false alarm signals if heating systems are active or
temperature change speed exceeds some threshold level. Moreover, infrared sensors
appreciably lose sensitivity if small insects penetrate the sensor lens. Ultrasound motion
detection sensors are characterized by small power consumption, suitable cost and high
sensitivity. That it why this kind of sensor is commonly used in home, office and car
security systems. Existing ultrasound sensors consist of multiple passive and active
components and are relatively complicated for production and testing. Sensors often
times require a laborious tuning process.

KGRCET ECEPage 43
Alcohol and Drivers drowsy condition detection in vehicles

Fig 3.17: Basic sensor


operation
Principle

The
ultrasound
transmitter TX is
emitting
ultrasound waves
into sensor ambient space continuously. These waves are reflecting from various objects
and are reaching ultrasound receiver RX. There is a constant interference figure if no
moving objects are in the placement.

Any moving object changes the level and phase of the reflected signal, which
modifies the summed received signal level. Most low cost sensors (car security systems,
for instance) perform reflected signal amplitude analysis to detect moving objects. In
spite of implementation simplicity, this detection method is characterized by a high
sensitivity to noise signals. For example, heterogeneous airflows, sensor vibrations,
room window and door deformations, and gusts can change the interference figure and
generate false alarm signals.

Better noise resistance may be obtained if the receive sensor is performing reflected
signal frequency analysis instead of amplitude examination. The reflected signal
spectrum emulates a Doppler Effect. Frequency components of the moving object speed
vector have a component in the direction of ultrasound radiation propagation. Because
ultrasound waves reflect from the windows, walls, furniture etc., the sensor can detect
object movements in any direction. To implement this principle, the sensor must
perform selection and processing of Doppler Effect frequency shift to detect moving
objects.

KGRCET ECEPage 44
Alcohol and Drivers drowsy condition detection in vehicles

The air condition systems, heat generators, and refrigerators typically include
movable parts, which can cause device vibrations that generate high-frequency Doppler
components in the reflected ultrasound signal.
The heterogeneous variable temperature airflows are characterized by different
ultrasound propagation speed that can raise low-frequency Doppler components in the
reflected signal. That is why the noise resistant motion detection sensor should limit the
Doppler signals’ frequency range from lower and upper bounds to satisfactory false-
alarm free operation.
The ultrasound motion detection sensor has been developed in compliance with
operation principles considered above.
3.9 GSM
Definition of GSM

GSM (Global System for Mobile communications) is an open, digital cellular


technology used for transmitting mobile voice and data services.

GSM (Global System for Mobile communication) is a digital mobile telephone


system that is widely used in Europe and other parts of the world. GSM uses a variation
of Time Division Multiple Access (TDMA) and is the most widely used of the three
digital wireless telephone technologies (TDMA, GSM, and CDMA). GSM digitizes and
compresses data, then sends it down a channel with two other streams of user data, each
in its own time slot. It operates at either the 900 MHz or 1,800 MHz frequency band. It
supports voice calls and data transfer speeds of up to 9.6 k bit/s, together with the
transmission of SMS (Short Message Service).

History

In 1982, the European Conference of Postal and Telecommunications


Administrations (CEPT) created the Group Special Mobile (GSM) to develop a standard
for a mobile telephone system that could be used across Europe. In 1987, a
memorandum of understanding was signed by 13 countries to develop a common
cellular telephone system across Europe. Finally the system created by SINTEF lead by
Torleiv Maseng was selected.

KGRCET ECEPage 45
Alcohol and Drivers drowsy condition detection in vehicles

In 1989, GSM responsibility was transferred to the European Telecommunications


Standards Institute (ETSI) and phase I of the GSM specifications were published in
1990. The first GSM network was launched in 1991 by Radiolinja in Finland with joint
technical infrastructure maintenance from Ericsson.

By the end of 1993, over a million subscribers were using GSM phone networks
being operated by 70 carriers across 48 countries. As of the end of 1997, GSM service
was available in more than 100 countries and has become the de facto standard in
Europe and Asia.

GSM Frequencies
GSM networks operate in a number of different frequency ranges (separated into
GSM frequency ranges for 2G and UMTS frequency bands for 3G). Most 2G GSM
networks operate in the 900 MHz or 1800 MHz bands. Some countries in the Americas
(including Canada and the United States) use the 850 MHz and 1900 MHz bands
because the 900 and 1800 MHz frequency bands were already allocated. Most 3G GSM
networks in Europe operate in the 2100 MHz frequency band. The rarer 400 and 450
MHz frequency bands are assigned in some countries where these frequencies were
previously used for first-generation systems.
GSM-900 uses 890–915 MHz to send information from the mobile station to the
base station (uplink) and 935–960 MHz for the other direction (downlink), providing
124 RF channels (channel numbers 1 to 124) spaced at 200 kHz. Duplex spacing of 45
MHz is used. In some countries the GSM-900 band has been extended to cover a larger
frequency range.
This 'extended GSM', E-GSM, uses 880–915 MHz (uplink) and 925–960 MHz
(downlink), adding 50 channels (channel numbers 975 to 1023 and 0) to the original
GSM-900 band.
Time division multiplexing is used to allow eight full-rate or sixteen half-rate
speech channels per radio frequency channel. There are eight radio timeslots (giving
eight burst periods) grouped into what is called a TDMA frame. Half rate channels use
alternate frames in the same timeslot. The channel data rate for all 8 channels is
270.833 Kbit/s, and the frame duration is 4.615 ms.

KGRCET ECEPage 46
Alcohol and Drivers drowsy condition detection in vehicles

The transmission power in the handset is limited to a maximum of 2 watts in


GSM850/900 and 1 watt in GSM1800/1900. GSM operates in the 900MHz and 1.8GHz
bands in Europe and the 1.9GHz and 850MHz bands in the US. The 850MHz band is
also used for GSM and 3G in Australia, Canada and many South American countries.
By having harmonized spectrum across most of the globe, GSM’s international roaming
capability allows users to access the same services when travelling abroad as at home.
This gives consumers seamless and same number connectivity in more than 218
countries.
Terrestrial GSM networks now cover more than 80% of the world’s population.
GSM satellite roaming has also extended service access to areas where terrestrial
coverage is not available.
Mobile Telephony Standards

Table 3.4: Mobile Telephony Standards

1G

The first generation of mobile telephony (written 1G) operated using analogue


communications and portable devices that were relatively large. It used primarily the
following standards:
 AMPS (Advanced Mobile Phone System), which appeared in 1976 in the
United States, was the first cellular network standard. It was used primarily in
the Americas, Russia and Asia. This first-generation analogue network had weak
security mechanisms which allowed hacking of telephones lines.

KGRCET ECEPage 47
Alcohol and Drivers drowsy condition detection in vehicles

 TACS (Total Access Communication System) is the European version of the


AMPS model. Using the 900 MHz frequency band, this system was largely used
in England and then in Asia (Hong-Kong and Japan).
 ETACS (Extended Total Access Communication System) is an improved
version of the TACS standard developed in the United Kingdom that uses a
larger number of communication channels.
The first-generation cellular networks were made obsolete by the appearance of an
entirely digital second generation.

Second Generation of Mobile Networks (2G)

The second generation of mobile networks marked a break with the first generation
of cellular telephones by switching from analogue to digital. The main 2G mobile
telephony standards are:

 GSM (Global System for Mobile communications) is the most commonly used


standard in Europe at the end of the 20 th century and supported in the United
States. This standard uses the 900 MHz and 1800 MHz frequency bands in
Europe. In the United States, however, the frequency band used is the 1900
MHz band. Portable telephones that are able to operate in Europe and the United
States are therefore called tri-band.
 CDMA (Code Division Multiple Access) uses a spread spectrum technique that
allows a radio signal to be broadcast over a large frequency range.
 TDMA (Time Division Multiple Access) uses a technique of time division of
communication channels to increase the volume of data transmitted
simultaneously. TDMA technology is primarily used on the American continent,
in New Zealand and in the Asia-Pacific region.
With the 2G networks, it is possible to transmit voice and low volume digital
data, for example text messages (SMS, for Short Message Service) or multimedia
messages (MMS, for Multimedia Message Service). The GSM standard allows a
maximum data rate of 9.6 kbps.

Extensions have been made to the GSM standard to improve throughput. One of
these is the GPRS (General Packet Radio System) service which allows theoretical data

KGRCET ECEPage 48
Alcohol and Drivers drowsy condition detection in vehicles

rates on the order of 114 Kbit/s but with throughput closer to 40 Kbit/s in practice. As
this technology does not fit within the "3G" category, it is often referred to as 2.5.

The EDGE (Enhanced Data Rates for Global Evolution) standard, billed


as 2.75G, quadruples the throughput improvements of GPRS with its theoretical data
rate of 384 Kbps, thereby allowing the access for multimedia applications. In reality, the
EDGE standard allows maximum theoretical data rates of 473 Kbit/s, but it has been
limited in order to comply with the IMT-2000 (International Mobile
Telecommunications-2000) specifications from the ITU (International
Telecommunications Union).

3G

The IMT-2000 (International Mobile Telecommunications for the year 2000)


specifications from the International Telecommunications Union (ITU) defined the
characteristics of 3G (third generation of mobile telephony). The most important of
these characteristics are:

1. High transmission data rate.


2. 144 Kbps with total coverage for mobile use.
3. 384 Kbps with medium coverage for pedestrian use.
4. 2 Mbps with reduced coverage area for stationary use.
5. World compatibility.
6. Compatibility of 3rd generation mobile services with second generation
networks.

3G offers data rates of more than 144 Kbit/s, thereby allowing the access to
multimedia uses such as video transmission, video-conferencing or high-speed internet
access. 3G networks use different frequency bands than the previous networks: 1885-
2025 MHz and 2110-2200 MHz

The main 3G standard used in Europe is called UMTS (Universal Mobile


Telecommunications System) and uses WCDMA (Wideband Code Division Multiple
Access) encoding. UMTS technology uses 5 MHz bands for transferring voice and data,

KGRCET ECEPage 49
Alcohol and Drivers drowsy condition detection in vehicles

with data rates that can range from 384 Kbps to 2 Mbps. HSDPA (High Speed
Downlink Packet Access) is a third generation mobile telephony protocol, (considered
as "3.5G"), which is able to reach data rates on the order of 8 to 10 Mbps. HSDPA
technology uses the 5 GHz frequency band and uses WCDMA encoding.

Introduction to the GSM Standard

The GSM (Global System for Mobile communications) network is at the start of the


21st century, the most commonly used mobile telephony standard in Europe. It is called
as Second Generation (2G) standard because communications occur in an entirely
digital mode, unlike the first generation of portable telephones. When it was first
standardized in 1982, it was called as Group Special Mobile and later, it became an
international standard called "Global System for Mobile communications" in 1991.

In Europe, the GSM standard uses the 900 MHz and 1800 MHz frequency bands. In
the United States, however, the frequency band used is the 1900 MHz band. For this
reason, portable telephones that are able to operate in both Europe and the United States
are called tri-band while those that operate only in Europe are called bi-band.

The GSM standard allows a maximum throughput of 9.6 kbps which allows
transmission of voice and low-volume digital data like text messages (SMS, for Short
Message Service) or multimedia messages (MMS, for Multimedia Message Service).

GSM Standards

GSM uses narrowband TDMA, which allows eight simultaneous calls on the same
radio frequency. There are three basic principles in multiple access, FDMA (Frequency
Division Multiple Access), TDMA (Time Division Multiple Access), and CDMA (Code
Division Multiple Access). All three principles allow multiple users to share the same
physical channel. But the two competing technologies differ in the way user sharing the
common resource.

TDMA allows the users to share the same frequency channel by dividing the signal
into different time slots. Each user takes turn in a round robin fashion for transmitting
and receiving over the channel. Here, users can only transmit in their respective time
slot.

KGRCET ECEPage 50
Alcohol and Drivers drowsy condition detection in vehicles

CDMA uses a spread spectrum technology that is it spreads the information


contained in a particular signal of interest over a much greater bandwidth than the
original signal. Unlike TDMA, in CDMA several users can transmit over the channel at
the same time.

TDMA in brief

In late1980’s, as a search to convert the existing analog network to digital as a means


to improve capacity, the cellular telecommunications industry association chose TDMA
over FDMA. Time Division Multiple Access is a type of multiplexing where two or
more channels of information are transmitted over the same link by allocating a
different time interval for the transmission of each channel. The most complex
implementation using TDMA principle is of GSM’s (Global System for Mobile
communication). To reduce the effect of co-channel interference, fading and multipath,
the GSM technology can use frequency hopping, where a call jumps from one channel
to another channel in a short interval.

Fig 3.18: Time Division Multiple Access

TDMA systems still rely on switch to determine when to perform a handoff. Handoff
occurs when a call is switched from one cell site to another while travelling. The TDMA
handset constantly monitors the signals coming from other sites and reports it to the

KGRCET ECEPage 51
Alcohol and Drivers drowsy condition detection in vehicles

switch without caller’s awareness. The switch then uses this information for making
better choices for handoff at appropriate times.

TDMA handset performs hard handoff, i.e., whenever the user moves from one site
to another, it breaks the connection and then provides a new connection with the new
site.

Advantages of TDMA:

There are lots of advantages of TDMA in cellular technologies.

1. It can easily adapt to transmission of data as well as voice communication.


2. It has an ability to carry 64 kbps to 120 Mbps of data rates. This allows the
operator to do services like fax, voice and data and SMS as well as bandwidth
intensive application such as multimedia and video conferencing.
3. Since TDMA technology separates users according to time, it ensures that there
will be no interference from simultaneous transmissions.
4. It provides users with an extended battery life, since it transmits only portion of
the time during conversations. Since the cell size grows smaller, it proves to
save base station equipment, space and maintenance.
TDMA is the most cost effective technology to convert an analog system to digital.

Disadvantages of TDMA

One major disadvantage using TDMA technology is that the users has a predefined
time slot. When moving from one cell site to other, if all the time slots in this cell are
full the user might be disconnected. Likewise, if all the time slots in the cell in which
the user is currently in are already occupied, the user will not receive a dial tone.

The second problem in TDMA is that it is subjected to multipath distortion. To


overcome this distortion, a time limit can be used on the system. Once the time limit is
expired, the signal is ignored.

KGRCET ECEPage 52
Alcohol and Drivers drowsy condition detection in vehicles

The concept of cellular network

Mobile telephone networks are based on the concept of cells, circular zones that
overlap to cover a geographical area.

Fig 3.19: The concept of cellular network

Cellular networks are based on the use of a central transmitter-receiver in each cell,
called a "base station" (or Base Transceiver Station, written BTS). The smaller the
radius of a cell, the higher is the available bandwidth. So, in highly populated urban
areas, there are cells with a radius of a few hundred meters, while huge cells of up to 30
kilometers provide coverage in rural areas.

In a cellular network, each cell is surrounded by 6 neighboring cells (thus a cell is


generally drawn as a hexagon). To avoid interference, adjacent cells cannot use the
same frequency. In practice, two cells using the same frequency range must be
separated by a distance of two to three times the diameter of the cell.

Architecture of the GSM Network

In a GSM network, the user terminal is called a mobile station. A mobile station is
made up of a SIM (Subscriber Identity Module) card allowing the user to be uniquely
identified and a mobile terminal. The terminals (devices) are identified by a unique 15-
digit identification number called IMEI (International Mobile Equipment Identity).
Each SIM card also has a unique (and secret) identification number called
IMSI (International Mobile Subscriber Identity). This code can be protected using a 4-
digit key called a PIN code.

KGRCET ECEPage 53
Alcohol and Drivers drowsy condition detection in vehicles

The SIM card therefore allows each user to be identified independently of the
terminal used during communication with a base station. Communications occur
through a radio link (air interface) between a mobile station and a base station.

Fig 3.20: Architecture of the GSM Network

All the base stations of a cellular network are connected to a base station
controller (BSC) which is responsible for managing distribution of the resources. The
system consisting of the base station controller and its connected base stations is called
the Base Station Subsystem (BSS).

Finally, the base station controllers are themselves physically connected to


the Mobile Switching Centre (MSC), managed by the telephone network operator,
which connects them to the public telephone network and the Internet. The MSC
belongs to a Network Station Subsystem (NSS), which is responsible for managing user
identities, their location and establishment of communications with other subscribers.

KGRCET ECEPage 54
Alcohol and Drivers drowsy condition detection in vehicles

The MSC is generally connected to databases that provide additional functions:

1. The Home Location Register (HLR) is a database containing information


(geographic position, administrative information etc.) of the subscribers
registered in the area of the switch (MSC).
2. The Visitor Location Register (VLR) is a database containing information of
users other than the local subscribers. The VLR retrieves the data of a new user
from the HLR of the user's subscriber zone. The data is maintained as long as
the user is in the zone and is deleted when the user leaves or after a long period
of inactivity (terminal off).
3. The Equipment Identify Register (EIR) is a database listing the mobile
terminals.
4. The Authentication Centre (AUC) is responsible for verifying user identities.
5. The cellular network formed in this way is designed to support mobility via
management of handovers (movements from one cell to another).
Finally, GSM networks support the concept of roaming i.e., movement from one
operator network to another.

Introduction to Modem

Fig 3.21: Modem

Modem stands for modulator-demodulator

A modem is a device or program that enables a computer to transmit data over


telephone or cable lines. Computer information is stored digitally, whereas information
transmitted over telephone lines is transmitted in the form of analog waves. A modem
converts between these two forms.

KGRCET ECEPage 55
Alcohol and Drivers drowsy condition detection in vehicles

Fortunately, there is one standard interface for connecting external modems to


computers called RS-232. Consequently, any external modem can be attached to any
computer that has an RS-232 port, which almost all personal computers have. There are
also modems that come as an expansion board that can be inserted into a vacant
expansion slot. These are sometimes called onboard or internal modems.

While the modem interfaces are standardized, a number of different protocols for
formatting data to be transmitted over telephone lines exist. Some, like CCITT V.34 are
official standards, while others have been developed by private companies. Most
modems have built-in support for the more common protocols at slow data transmission
speeds at least, most modems can communicate with each other. At high transmission
speeds, however, the protocols are less standardized.

Apart from the transmission protocols that they support, the following
characteristics distinguish one modem from another:
 Bps: How fast the modem can transmit and receive data. At slow rates, modems
are measured in terms of baud rates. The slowest rate is 300 baud (about 25 cps).
At higher speeds, modems are measured in terms of bits per second (bps). The
fastest modems run at 57,600 bps, although they can achieve even higher data
transfer rates by compressing the data. Obviously, the faster the transmission
rate, the faster the data can be sent and received. It should be noted that the data
cannot be received at a faster rate than it is being sent.
 Voice/data: Many modems support a switch to change between voice and data
modes. In data mode, the modem acts like a regular modem. In voice mode, the
modem acts like a regular telephone. Modems that support a voice/data switch
have a built-in loudspeaker and microphone for voice communication.
 Auto-answer: An auto-answer modem enables the computer to receive calls in
the absence of the operator.
 Data compression: Some modems perform data compression, which enables
them to send data at faster rates. However, the modem at the receiving end must
be able to decompress the data using the same compression technique.

KGRCET ECEPage 56
Alcohol and Drivers drowsy condition detection in vehicles

 Flash memory: Some modems come with flash memory rather than
conventional ROM which means that the communications protocols can be
easily updated if necessary.
 Fax capability: Most modern modems are fax modems, which mean that they
can send and receive faxes.
GSM Modem
A GSM modem is a wireless modem that works with a GSM wireless network. A
wireless modem behaves like a dial-up modem. The main difference between them is
that a dial-up modem sends and receives data through a fixed telephone line while a
wireless modem sends and receives data through radio waves.

Fig 3.22: GSM Modem

A GSM modem can be an external device or a PC Card / PCMCIA Card. Typically,


an external GSM modem is connected to a computer through a serial cable or a USB
cable. A GSM modem in the form of a PC Card / PCMCIA Card is designed for use
with a laptop computer. It should be inserted into one of the PC Card / PCMCIA Card
slots of a laptop computer. Like a GSM mobile phone, a GSM modem requires a SIM
card from a wireless carrier in order to operate.

KGRCET ECEPage 57
Alcohol and Drivers drowsy condition detection in vehicles

A SIM card contains the following information:


 Subscriber telephone number (MSISDN)
 International subscriber number (IMSI, International Mobile Subscriber
Identity)
 State of the SIM card
 Service code (operator)
 Authentication key
 PIN (Personal Identification Code)
 PUK (Personal Unlock Code)

Computers use AT commands to control modems. Both GSM modems and dial-
up modems support a common set of standard AT commands. In addition to the
standard AT commands, GSM modems support an extended set of AT commands.
These extended AT commands are defined in the GSM standards. With the extended
AT commands, the following operations can be performed:
 Reading, writing and deleting SMS messages.
 Sending SMS messages.
 Monitoring the signal strength.
 Monitoring the charging status and charge level of the battery.
 Reading, writing and searching phone book entries.

KGRCET ECEPage 58
Alcohol and Drivers drowsy condition detection in vehicles

Fig 3.23: Establishing connection between PC and GSM modem

The number of SMS messages that can be processed by a GSM modem per minute is
very low i.e., about 6 to 10 SMS messages per minute.

Introduction to AT Commands
AT commands are instructions used to control a modem. AT is the abbreviation of
Attention. Every command line starts with "AT" or "at". That's the reason, modem
commands are called AT commands. Many of the commands that are used to control
wired dial-up modems, such as ATD (Dial), ATA (Answer), ATH (Hook control) and
ATO (Return to online data state) are also supported by GSM modems and mobile
phones.
Besides this common AT command set, GSM modems and mobile phones support
an AT command set that is specific to the GSM technology, which includes SMS-
related commands like AT+CMGS (Send SMS message), AT+CMSS (Send SMS
message from storage), AT+CMGL (List SMS messages) and AT+CMGR (Read SMS
messages).
It should be noted that the starting "AT" is the prefix that informs the modem about
the start of a command line. It is not part of the AT command name.
For example, D is the actual AT command name in ATD and +CMGS is the actual
AT command name in AT+CMGS.
Some of the tasks that can be done using AT commands with a GSM modem or
mobile phone are listed below:
 Get basic information about the mobile phone or GSM modem. For example,
name of manufacturer (AT+CGMI), model number (AT+CGMM), IMEI
number (International Mobile Equipment Identity) (AT+CGSN) and software
version (AT+CGMR).
 Get basic information about the subscriber. For example, MSISDN
(AT+CNUM) and IMSI number (International Mobile Subscriber Identity)
(AT+CIMI).
 Get the current status of the mobile phone or GSM/GPRS modem. For example,
mobile phone activity status (AT+CPAS), mobile network registration status

KGRCET ECEPage 59
Alcohol and Drivers drowsy condition detection in vehicles

(AT+CREG), radio signal strength (AT+CSQ), battery charge level and battery
charging status (AT+CBC).
 Establish a data connection or voice connection to a remote modem (ATD,
ATA, etc).
 Send and receive fax (ATD, ATA, AT+F*).
 Send (AT+CMGS, AT+CMSS), read (AT+CMGR, AT+CMGL), write
(AT+CMGW) or delete (AT+CMGD) SMS messages and obtain notifications of
newly received SMS messages (AT+CNMI).
 Read (AT+CPBR), write (AT+CPBW) or search (AT+CPBF) phonebook
entries.
 Perform security-related tasks, such as opening or closing facility locks
(AT+CLCK), checking whether a facility is locked (AT+CLCK) and changing
passwords (AT+CPWD).
(Facility lock examples: SIM lock [a password must be given to the SIM card
every time the mobile phone is switched on] and PH-SIM lock [a certain SIM
card is associated with the mobile phone. To use other SIM cards with the
mobile phone, a password must be entered.])
 Control the presentation of result codes / error messages of AT commands. For
example, the user can control whether to enable certain error messages
(AT+CMEE) and whether error messages should be displayed in numeric format
or verbose format (AT+CMEE=1 or AT+CMEE=2).

 Get or change the configurations of the mobile phone or GSM/GPRS modem.


For example, change the GSM network (AT+COPS), bearer service type
(AT+CBST), radio link protocol parameters (AT+CRLP), SMS center address
(AT+CSCA) and storage of SMS messages (AT+CPMS).
 Save and restore configurations of the mobile phone or GSM/GPRS modem. For
example, save (AT+CSAS) and restore (AT+CRES) settings related to SMS
messaging such as the SMS center address.

It should be noted that the mobile phone manufacturers usually do not


implement all AT commands, command parameters and parameter values in their

KGRCET ECEPage 60
Alcohol and Drivers drowsy condition detection in vehicles

mobile phones. Also, the behavior of the implemented AT commands may be different
from that defined in the standard. In general, GSM modems, designed for wireless
applications, have better support of AT commands than ordinary mobile phones.
Basic concepts of SMS technology

1. Validity Period of an SMS Message


An SMS message is stored temporarily in the SMS center if the recipient mobile
phone is offline. It is possible to specify the period after which the SMS message will be
deleted from the SMS center so that the SMS message will not be forwarded to the
recipient mobile phone when it becomes online. This period is called the validity period.
A mobile phone should have a menu option that can be used to set the validity period.
After setting it, the mobile phone will include the validity period in the outbound SMS
messages automatically.
2. Message Status Reports
Sometimes the user may want to know whether an SMS message has reached the
recipient mobile phone successfully. To get this information, you need to set a flag in
the SMS message to notify the SMS center that a status report is required about the
delivery of this SMS message. The status report is sent to the user mobile in the form of
an SMS message.
A mobile phone should have a menu option that can be used to set whether the status
report feature is on or off. After setting it, the mobile phone will set the corresponding
flag in the outbound SMS messages for you automatically. The status report feature is
turned off by default on most mobile phones and GSM modems.
3. Message Submission Reports
After leaving the mobile phone, an SMS message goes to the SMS center. When it
reaches the SMS center, the SMS center will send back a message submission report to
the mobile phone to inform whether there are any errors or failures (e.g. incorrect SMS
message format, busy SMS center, etc). If there is no error or failure, the SMS center
sends back a positive submission report to the mobile phone. Otherwise it sends back a
negative submission report to the mobile phone. The mobile phone may then notify the
user that the message submission was failed and what caused the failure.
If the mobile phone does not receive the message submission report after a period of
time, it concludes that the message submission report has been lost. The mobile phone

KGRCET ECEPage 61
Alcohol and Drivers drowsy condition detection in vehicles

may then send the SMS message again to the SMS center. A flag will be set in the new
SMS message to inform the SMS center that this SMS message has been sent before. If
the previous message submission was successful, the SMS center will ignore the new
SMS message but send back a message submission report to the mobile phone. This
mechanism prevents the sending of the same SMS message to the recipient multiple
times.
Sometimes the message submission report mechanism is not used and the
acknowledgement of message submission is done in a lower layer.
4 .Message Delivery Reports
After receiving an SMS message, the recipient mobile phone will send back a
message delivery report to the SMS center to inform whether there are any errors or
failures (example causes: unsupported SMS message format, not enough storage space,
etc).
This process is transparent to the mobile user. If there is no error or failure, the
recipient mobile phone sends back a positive delivery report to the SMS center.
Otherwise it sends back a negative delivery report to the SMS center.
If the sender requested a status report earlier, the SMS center sends a status report to
the sender when it receives the message delivery report from the recipient. If the SMS
center does not receive the message delivery report after a period of time, it concludes
that the message delivery report has been lost. The SMS center then ends the SMS
message to the recipient for the second time.
Sometimes the message delivery report mechanism is not used and the
acknowledgement of message delivery is done in a lower layer.
5.10 LCD (Liquid Crystal Display)

General Description

The Liquid Crystal Display (LCD) is a low power device (microwatts). Now a days
in most applications LCDs are using rather using of LED displays because of its
specifications like low power consumption, ability to display numbers and special
characters which are difficult to display with other displaying circuits and easy to
program. An LCD requires an external or internal light source. Temperature range of
LCD is 0ºC to 60ºC and lifetime is an area of concern, because LCDs can chemically
degrade these are manufactured with liquid crystal material (normally organic for

KGRCET ECEPage 62
Alcohol and Drivers drowsy condition detection in vehicles

LCDs) that will flow like a liquid but whose molecular structure has some properties
normally associated with solids. .

LCDs are classified as:

1. Dynamic-scattering LCDs and


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 light-scattering 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.

RS (Command / Data)

This bit is to specify whether received byte is command or data. So that LCD can
recognize the operation to be performed based on the bit status.

RS = 0 => Command

RS = 1 => Data

RW (Read / Write)

RW bit is to specify whether controller wants READ from LCD or WRITE to LCD.
The READ operation here is just ACK bit to know whether LCD is free or not.

RW = 0 => Write

RW = 1 => Read

EN (Enable LCD)

EN bit is to ENABLE or DISABLE the LCD. Whenever controller wants to write


something into LCD or READ acknowledgment from LCD it needs to enable the LCD.

EN = 0 => High Impedance

EN = 1 => Low Impedance

KGRCET ECEPage 63
Alcohol and Drivers drowsy condition detection in vehicles

ACK (LCD Ready)

ACK bit is to acknowledge the MCU that LCD is free so that it can send new
command or data to be stored in its internal Ram locations

ACK = 1 => Not ACK

ACK = 0 => ACK

LCD diagram

16 x 2 Char LCD

D0 EN RW RS Vf GND
A K D7

ACK
Vcc
D0 – D7

R1

R2

Fig 3.24: LCD diagram

Block Diagram

LCD
D0-D7 RS RW EN

Data Lines
Embedded
Controller
P1.0

P1.1

P1.2

KGRCET ECEPage 64
Alcohol and Drivers drowsy condition detection in vehicles

Fig 3.25: Block Diagram of LCD

Hardware connections

CONTROLER PINS LCD PINS PIN NAME WITH FEATURE

(P1.0) 4 RS (Control Pin)

(P1.1) 5 RW (Control pin )

(P1.2) 6 EN (Control pin)

Port 0 7 to 14 Data Port

40 15 & 2 Vcc

20 16 & 1 Gnd

Table 3.5: Hardware connections

FLOWCHART

KGRCET ECEPage 65
Alcohol and Drivers drowsy condition detection in vehicles

START

Configure port pins for all hardware


connections

Wait
Yes
Is LCD Free
No

Clear RS Bit

Enable LCD

Send Command

Disable LCD

Is Command
Count Zero
No

Fig 5.26: Flowchart of LCD

KGRCET ECEPage 66
Alcohol and Drivers drowsy condition detection in vehicles

Wait
Yes
Is LCD Free
No

Set RS Bit

Enable LCD

Send Data

Disable LCD

Is Data
Count Zero
No

STOP

Fig 3.27: Flowchart of LCD

CHAPTER 4

KGRCET ECEPage 67
Alcohol and Drivers drowsy condition detection in vehicles

SOFTWARE DESIGN
4.1 Introduction to Arduino IDE
Arduino is a prototype platform (open-source) based on an easy-to-use hardware
and software. It consists of a circuit board, which can be programmed (referred to as a
microcontroller) and a ready-made software called Arduino IDE (Integrated
Development Environment), which is used to write and upload the computer code to the
physical board.

The key features are:

 Arduino boards are able to read analog or digital input signals from different
sensors and turn it into an output such as activating a motor, turning LED on/off,
connect to the cloud and many other actions.
 You can control your board functions by sending a set of instructions to the
microcontroller on the board via Arduino IDE (referred to as uploading
software).
 Unlike most previous programmable circuit boards, Arduino does not need an
extra piece of hardware (called a programmer) in order to load a new code onto
the board. You can simply use a USB cable.
 Additionally, the Arduino IDE uses a simplified version of C++, making it
easier to learn to program.
 Finally, Arduino provides a standard form factor that breaks the functions of the
micro-controller into a more accessible package.
After learning about the main parts of the Arduino UNO board, we are ready to learn
how to set up the Arduino IDE. Once we learn this, we will be ready to upload our
program on the Arduino board.

4.1.1 Arduino data types

Data types in C refer to an extensive system used for declaring variables or functions
of different types. The type of a variable determines how much space it occupies in the
storage and how the bit pattern stored is interpreted.

The following table provides all the data types that you will use during Arduino
programming.

KGRCET ECEPage 68
Alcohol and Drivers drowsy condition detection in vehicles

Void

The void keyword is used only in function declarations. It indicates that the function
is expected to return no information to the function from which it was called.

Example

Void Loop ( )

// rest of the code

Boolean

A Boolean holds one of two values, true or false. Each Boolean variable occupies
one byte of memory.

Example

Boolean state= false ; // declaration of variable with type boolean and initialize it
with false.

Boolean state = true ; // declaration of variable with type boolean and initialize it
with false.

Char: A data type that takes up one byte of memory that stores a character value.
Character literals are written in single quotes like this: 'A' and for multiple characters,
strings use double quotes: "ABC".

However, characters are stored as numbers. You can see the specific encoding in the
ASCII chart. This means that it is possible to do arithmetic operations on characters, in
which the ASCII value of the character is used. For example, 'A' + 1 has the value 66,
since the ASCII value of the capital letter A is 65.

Example

KGRCET ECEPage 69
Alcohol and Drivers drowsy condition detection in vehicles

Char chr_a = ‘a’; //declaration of variable with type char and initialize it with
character a.

Char chr_c = 97; //declaration of variable with type char and initialize it with
character 97

Unsigned char

Unsigned char is an unsigned data type that occupies one byte of memory. The
unsigned char data type encodes numbers from 0 to 255.

Example

Unsigned Char chr_y = 121; // declaration of variable with type Unsigned char and
initialize it with character y

Byte

A byte stores an 8-bit unsigned number, from 0 to 255.

Example

byte m = 25 ; //declaration of variable with type byte and initialize it with 25

int

Integers are the primary data-type for number storage. int stores a 16-bit (2-byte)
value. This yields a range of -32,768 to 32,767 (minimum value of -2^15 and a
maximum value of (2^15) - 1).

The int size varies from board to board. On the Arduino Due, for example, an int
stores a 32-bit (4-byte) value. This yields a range of -2,147,483,648 to 2,147,483,647
(minimum value of -2^31 and a maximum value of (2^31) - 1).

Example:

int counter = 32; // declaration of variable with type int and initialize it with 32.

Unsigned int

KGRCET ECEPage 70
Alcohol and Drivers drowsy condition detection in vehicles

Unsigned int (unsigned integers) are the same as int in the way that they store a 2
byte value. Instead of storing negative numbers, however, they only store positive
values, yielding a useful range of 0 to 65,535 (2^16) - 1). The Due stores a 4 byte (32-
bit) value, ranging from 0 to 4,294,967,295 (2^32 - 1).

Example

Unsigned int counter= 60; // declaration of variable with type unsigned int and
initialize it with 60.

Word

On the Uno and other ATMEGA based boards, a word stores a 16-bit unsigned
number. On the Due and Zero, it stores a 32-bit unsigned number.

Example

Word w = 1000;//declaration of variable with type word and initialize it with 1000.

Long

Long variables are extended size variables for number storage, and store 32 bits (4
bytes), from 2,147,483,648 to 2,147,483,647.

Example

Long velocity= 102346; //declaration of variable with type Long and initialize it with
102346

Unsigned long

Unsigned long variables are extended size variables for number storage and store 32
bits (4 bytes). Unlike standard longs, unsigned longs will not store negative numbers,
making their range from 0 to 4,294,967,295 (2^32 - 1).

Example

KGRCET ECEPage 71
Alcohol and Drivers drowsy condition detection in vehicles

Unsigned Long velocity = 101006; // declaration of variable with type Unsigned


Long and initialize it with 101006.

Short

A short is a 16-bit data-type. On all Arduino (ATMega and ARM based), a short
stores a 16-bit (2-byte) value. This yields a range of -32,768 to 32,767 (minimum value
of -2^15 and a maximum value of (2^15) - 1).

Example

short val= 13; //declaration of variable with type short and initialize it with 13

Float

Data type for floating-point number is a number that has a decimal point. Floating-
point numbers are often used to approximate the analog and continuous values because
they have greater resolution than integers.

Floating-point numbers can be as large as 3.4028235E+38 and as low as


3.4028235E+38. They are stored as 32 bits (4 bytes) of information.

Example

float num = 1.352;//declaration of variable with type float and initialize it with 1.352.

Double

On the Uno and other ATMEGA based boards, Double precision floating-point
number occupies four bytes. That is, the double implementation is exactly the same as
the float, with no gain in precision. On the Arduino Due, doubles have 8-byte (64 bit)
precision.

Example

double num = 45.352 ;// declaration of variable with type double and initialize it with
45.352.

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.

KGRCET ECEPage 72
Alcohol and Drivers drowsy condition detection in vehicles

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
Mega2560, or Diecimila, you will need a standard USB cable (A plug to B plug), the
kind you would connect to a USB printer as shown in the following image.

Step 2: Download Arduino IDE Software.

You can get different versions of Arduino IDE from the Download page on the
Arduino Official website. You must select your software, which is compatible with your
operating system (Windows, IOS, or Linux). After your file download is complete,
unzip the file.

Figure 4.1: Arduino IDE software

Step 3: Power up your board.

The Arduino Uno, Mega, Duemilanove and Arduino Nano automatically draw power
from either, the USB connection to the computer or an external power supply. If you are
using an Arduino Diecimila, you have to make sure that the board is configured to draw
power from the USB connection.

KGRCET ECEPage 73
Alcohol and Drivers drowsy condition detection in vehicles

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.

Figure 4.2: Arduino IDE

Step 5: Open your first project

Once the software starts, you have two options:

 Create a new project.


 Open an existing project example.

To create a new project, select File --> New To open

KGRCET ECEPage 74
Alcohol and Drivers drowsy condition detection in vehicles

Figure 4.3: To create a new project


To open an existing project, select File -> Example -> Basics -> Blink.

Figure 4.4: To open an existing project

KGRCET ECEPage 75
Alcohol and Drivers drowsy condition detection in vehicles

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

Figure 4.5: To select your board


Here, we have selected Arduino Uno board according to our tutorial, but you must
select the name matching the board that you are using

Step 7: Select your serial port

Select the serial device of the Arduino board. Go to Tools ->Serial Port menu. This
is likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware
serial ports).

KGRCET ECEPage 76
Alcohol and Drivers drowsy condition detection in vehicles

To find out, you can disconnect your Arduino board and re-open the menu, the entry
that disappears should be of the Arduino board. Reconnect the board and select that
serial port.

Figure 4.6: To select serial port

KGRCET ECEPage 77
Alcohol and Drivers drowsy condition detection in vehicles

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.

Figure 4.7: To upload the program to board

A- Used to check if there is any compilation error.

B- Used to upload a program to the Arduino board.

C- Shortcut used to create a new sketch.

D- Used to directly open one of the example sketch.

E- Used to save your sketch.

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.

Note: If you have an Arduino Mini, NG, or other board, you need to press the reset
button physically on the board, immediately before clicking the upload button on the
Arduino Software.

KGRCET ECEPage 78
Alcohol and Drivers drowsy condition detection in vehicles

Arduino programming structure

In this chapter, we will study in depth, the Arduino program structure and we will
learn more new terminologies used in the Arduino world. The Arduino software is
open-source. The source code for the Java environment is released under the GPL and
the C/C++ microcontroller libraries are under the LGPL.

Sketch: The first new terminology is the Arduino program called “sketch”.

Structure

Arduino programs can be divided in three main parts: Structure, Values (variables
and constants), and Functions. In this tutorial, we will learn about the Arduino software
program, step by step, and how we can write the program without any syntax or
compilation error.

Let us start with the Structure. Software structure consists of two main functions:

 Setup( ) function
 Loop( ) function

KGRCET ECEPage 79
Alcohol and Drivers drowsy condition detection in vehicles

Figure 4.8: Arduino programming structure

Void setup ( )

PURPOSE

The setup () function is called when a sketch starts. Use it to initialize the variables,
pin modes, start using libraries, etc. The setup function will only run once, after each
power up or reset of the Arduino board.

INPUT

OUTPUT

RETURN

KGRCET ECEPage 80
Alcohol and Drivers drowsy condition detection in vehicles

Void Loop ( )

PURPOSE

After creating a setup () function, which initializes and sets the initial values, the
loop () function does precisely what its name suggests, and loops secutively, allowing
your program to change and respond. Use it to actively control the Arduino board.

INPUT

OUTPUT

RETURN

KGRCET ECEPage 81
Alcohol and Drivers drowsy condition detection in vehicles

CHAPTER 5
SOFTWARE & HARDWARE REQUIREMENTS

Figure 5.1: UI interface when alcohol not detected

Figure 5.2: UI interface when alcohol detected

KGRCET ECEPage 82
Alcohol and Drivers drowsy condition detection in vehicles

CHAPTER 6

RESULTS & DISCUSSION

Figure 6.1: Prototype model of the project

When the driver enters the vehicle and switch on the ignition system, seat belt and
alcohol sensors get activated and check for the presence of alcohol and whether the
driver wear seat belt or not. If the driver does not wear seat belt or presence of alcohol is
detected in the vehicle, the engine of the vehicle will not start. While the vehicle is in
motion and if the driver feels sleepy, driver’s drowsy condition is detected using IR

KGRCET ECEPage 83
Alcohol and Drivers drowsy condition detection in vehicles

sensor and the vehicle slows down and stops automatically. The distance of the vehicle
from other vehicles is measured using ultrasonic sensor and the vehicles stops
immediately when the vehicle is about to hit the adjacent vehicles.

Figure 6.2: Seat belt alert

Figure 6.3: Alcohol alert

KGRCET ECEPage 84
Alcohol and Drivers drowsy condition detection in vehicles

Figure 6.4: Eye blink alert

Figure 6.5: Nearby vehicle alert

KGRCET ECEPage 85
Alcohol and Drivers drowsy condition detection in vehicles

If any of the sensors get activated and vehicle gets stopped, a message will be
sent to the registered mobile number to alert them.

Figure 6.6: UI of messages sent to registered mobile number

KGRCET ECEPage 86
Alcohol and Drivers drowsy condition detection in vehicles

CHAPTER 7

CONCLUSIONS

In this project we have built up a real time model that can automatically lock the
motor engine when a drunken driver tries to drive a car. Now days car collisions are
mostly observed. By fitting this alcohol sensor into the car, we can save the life of the
driver and furthermore the rest of the travelers. The life time of the task is high. It has
low or zero support cost and obviously low power utilization. This is a developed
system to check drunken driving. By executing this outline a safe car travel is possible
decreasing the mishap rate because of drinking. By executing this outline, drunken
drivers can be controlled so are the mishaps because of drunken driving.

In this project, we have developed an efficient system to tackle the menace of


drunken driving. Our main aim is to minimize the loss of lives and property which
happen due to drunken driving. This system once implemented on a large scale will
prove to be really helpful by shutting down the vehicle’s engine and alerting the nearby
people before any mishap takes place. The sensor used in the project is very accurate
and can be configured according to the requirements thereby increasing the efficiency.

KGRCET ECEPage 87
Alcohol and Drivers drowsy condition detection in vehicles

CHAPTER 8

FUTURE ENHANCEMENTS

As every year the number of cars increases to double so there is a great demand of
these transport system in future like in bus, school van, trains and in various means so to
avoid the accidents we have to try this technology so to have a good and safe life.
Basically Nissan had tried to implement this idea before but got failed due to various
reasons. so by keeping the emerge of transport system and rush on the roads in mind we
have to try this and previously when air bags got introduced who knows that one day
they will be mandatory in all the cars for safety.

Government must authorize laws to introduce such circuit in each car and must
manage all car organizations to preinstall such systems while manufacturing the car
itself. If it is achieved the death rate because of drunken drivers can be brought to least
level. In this kind of system, securely landing of car aside without disturbing other
vehicles can also be added as a future extension.

KGRCET ECEPage 88
Alcohol and Drivers drowsy condition detection in vehicles

CHAPTER 9

REFERENCES

[1] Mugila J., Muthulakshmi.M, Santhiya K, Prof.Dhivya. P [International Journal of


Innovative Research in Science Engineering and Technology (IJIRTSE) ISSN: 2395-
5619, Volume – 2, Issue – 7. July 2016] - “Smart helmet system using alcohol detection
for vehicle protection”

[2] Dhivya M and Kathiravan S, Dept. of ECE, Kalaignar Karunanidhi Institute of


Technology [Smart Computing Review, vol. 5, no. 1, February 2015] - “Driver
Authentication and Accident Avoidance System for Vehicles”

[3] Nimmy James, Aparna C, Tenna P John, International Journal of Research in


Computer and Communication Technology, Vol 3, Issue 1, January- 2014 – “Alcohol
Detection System”

[4] Prashanth K P1, Kishen Padiyar2, Naveen Kumar P H3, K Santhosh Kumar, Dept.
of Mechanical Engineering, East West Institute of Technology, Bangalore, India
[International Journal of Engineering Research & Technology (IJERT) ISSN: 2278-
0181, IJERTV3IS100754, Vol. 3 Issue 10, October- 2014] - “Road Accident Avoiding
System using Drunken Sensing Technique”

[5] Ms. Subia Sayeed, Department of Electronics and communication, VVIET, Mysore,
India [International Journal of Scientific & Engineering Research Volume 2, Issue 12,
December-2011 1, ISSN 2229-5518] - “Drunken drive protection system”

[6] From Nissan Model

CHAPTER 10

ANNEXURE

KGRCET ECEPage 89
Alcohol and Drivers drowsy condition detection in vehicles

KGRCET ECEPage 90

You might also like