Car Accident Avoider Using Brain Wave Sensor
-
Upload
yogesh-selvasudhan-ramasamy -
Category
Documents
-
view
31 -
download
1
Transcript of Car Accident Avoider Using Brain Wave Sensor
1
CHAPTER-1
INTRODUCTION
The main aim of this project is to control the device based on electrical
signals of brain. The other is to provide a comprehensive review and comparison
of the most important Brain Computer Interface (BCI) systems developed to this
day. Brain-Computer Interface (BCI) is a communication system, which enables
the user to control special computer applications by using only his or her thoughts.
Different research groups have examined and used different methods to achieve
this. Almost all of them are based on electro encaphalo graphy (EEG) recorded
from the scalp. The EEG is measured and sampled while the user imagines
different things (for example, moving the left or the right hand). Depending on the
BCI, particular preprocessing and feature extraction methods are applied to the
EEG sample of certain length.
It is then possible to detect the task-specific EEG signals or patterns from the
EEG samples with a certain level of accuracy. First signs of BCI research can be
dated back to 1960’s, but it was in 1990’s when the BCI research really got started.
Faster computers and better EEG devices offered new possibilities. To date there
have been over 20 BCI research groups. They have taken different approaches to
the subject, some more successful than others. Less than half of the BCI researches
groups have build an online BCI, which can give feedback to the subject. None of
the BCIs have yet become commercial and only a couple has been tested outside
laboratory environments. Despite the technological developments numerous
problems still exists in building efficient BCIs. The biggest challenges are related
to accuracy, speed and usability. Other interfaces are still much more efficient.
2
1.1 OBJECTIVE
Drowsyness plays a major role in most of the car accidents. This type of
accidents can be avoided by sensing the brain wave signals using brainwave
sensor. Meditation level is used to find the drowsyness level of the driver and alert
them if it crosses the threshold level.
1.2 RHYTHMIC BRAIN ACTIVITY
Depending on the level of consciousness, normal people’s brain waves show
different rhythmic activity. For instance, the different sleep stages can be seen in
EEG. Different rhythmic waves also occur during the waking state. These rhythms
are affected by different actions and thoughts, for example the planning of a
movement can block or attenuate a particular rhythm. The fact that mere thoughts
affect the brain rhythms can be used as the basis for the BCI. The various brain
rhythms are.
1.2.1 DELTA RHYTHM
EEG waves below 3.5 Hz (usually 0.1-3.5 Hz) belong to the delta waves.
Infants (around the age of 2 months) show irregular delta activity of 2-3.5 Hz
(amplitudes 50-100 V) in the waking state. In adults delta waves (frequencies
below 3.5 Hz) are only seen in deep sleep and are therefore not useful in BCIs.
Delta rhythm is shown in Figure 1.1.
Figure 1.1 Delta rhythm
3
1.2.2 THETA RHYTHM
Theta waves are between 4 and 7.5 Hz. Theta rhythm plays an important role
in infancy and childhood. In normal adults theta waves are seen mostly in states of
drowsiness and sleep. During waking hours the EEG contains only a small amount
of theta activity and no organized theta rhythm. Niedermayer lists some studies in
which the theta activity of 6-7 Hz over frontal midline region had been correlated
with mental activity such as problem solving. However, he did not find it in his
own studies. Theta rhythm is shown in Figure 1.2.
Figure1.2 Theta rhythm
1.2.3 ALPHA RHYTHM
The International Federation of Societies for Electroencephalography and
Clinical Neurophysiology proposed the following definition of alpha rhythm:
Rhythm at 8-13 Hz occurring during wakefulness over the posterior regions of the
head, generally with higher voltage over the occipital areas. Amplitude is variable
but is mostly below 50 _V in adults. Best seen with eyes closed and under
conditions of physical relaxation and relative mental inactivity. Blocked or
attenuated by attention, especially visual, and mental effort’.
The posterior basic rhythm increases in frequency during the childhood and
reaches the frequency 8 Hz (the limit of the alpha rhythm) at the age of 3 years. At
the age of 10 years the frequency reaches a mean of about 10 Hz, which is typical
mean adult alpha frequency. The frequency tends to decline in elderly individuals
and in dementia. The alpha rhythm is temporarily blocked, i.e, its amplitude
decreased, by eye opening, other afferent stimuli or mental activities. The degree
4
of reactivity varies. Usually, eye opening is the most effective manipulation. Alpha
rhythm is shown in Figure 1.3.
Figure 1.3 Alpha rhythm
1.2.4 BETA RHYTHMS
Any rhythmical activity in the frequency band of 13-30 Hz may be regarded
as a beta rhythm. Beta rhythm amplitudes are seldom larger than 30 V. Beta
rhythms can mainly be found over the frontal and central region. A central beta
rhythm is related to the mu rhythm. It can be blocked by motor activity and tactile
stimulation. Beta rhythm is shown in Figure 1.4.
Figure 1.4 Beta rhythm
1.3 ADVANTAGES
Detects the drowsiness in drivers even if the eye is open.
More accurate.
Faster response.
5
CHAPTER-2
LITERATURE SURVEY
Chris Berka , Daniel Levendowski, J., Philip Westbrook , Gene Davis ,
Michelle Lumicao, N., Richard Olmstead, E., Miodrag Popovic , Vladimir
Zivkovic, T., Caitlin Ramsey, K., (2012) in Implementation of a Closed-Loop
Real-Time EEG-Based Drowsiness Detection System, [1] stated that With the
growing demands of the global economy for round-the-clock operations, fatigue
management is increasingly important, particularly in safety-sensitive
environments such as military operations and commercial transportation. Safety,
efficiency and productivity are all impacted by employee alertness. Fatigue-related
accidents and decreased productivity associated with drowsiness are estimated to
cost the U.S. over $77 billion each year and $377 billion worldwide. It is estimated
that more U.S. freeway fatalities are caused by fatigue than alcohol or drugs, with
10% to 50% of motor vehicle accidents attributed to sleepiness. In addition, over
30 million Americans are believed to suffer from sleep disorders, the majority
undiagnosed and untreated, resulting in dangerous levels of daytime drowsiness.
As more workers are forced into shift work to meet the demands of a 24-hour
society, sleep is often sacrificed for other activities. Although automation is
replacing manual labor, it can have a deleterious effect if it causes the operator to
be disengaged from the controls of machinery. Passive monitoring of automated
equipment can increase the difficulty of maintaining vigilance with performance
decrements increasing with time-on-task.
Several studies revealed that people are not good judges of their own level of
fatigue. The AAA Foundation for Traffic Safety interviewed 467 drivers involved
in police-reported crashes whose physical condition at the time of the crash was
6
identified as either “asleep” or “drowsy”. While most drivers agreed with the
police officer’s assessment of the role of drowsiness in their accident, close to 50%
reported feeling either “slightly” or “not at all” drowsy just prior to the crash.
Similarly, AAA Foundation research found that 50% of people tested during sleep
deprivation were unable to predict whether they would fall asleep within the next
two minutes. The study concluded that a “sleepiness indicator device” should be
developed to inform users prior to sleep onset.
The integration of physiological monitoring into the man-machine interface
offers the possibility of allocating tasks based on real-time assessment of operator
status. Real-time monitoring could drive intelligent feedback or facilitate active
intervention by the operator or through a third party (man or machine), increasing
safety and productivity. The achievement of such a system is particularly relevant
for the development of future military technology where the emphasis is
increasingly on unmanned vehicles and aircraft, maximizing capacity while
limiting the need for additional human resources. This study was designed to
investigate the utility of a method for real-time detection of drowsiness with alarms
delivered directly to the user.
Deepa.T.P, Vandana Reddy (2013) in EEG Based Drowsiness Detection
Using Mobile Device for Intelligent Vehicular System, [2] stated that tiny
electrical signals are produced by brain cells when they pass message to each
other. Electrodes which are placed on brain scalp of subject (person) will pick up
these signals and send them to machine called as Electroencephalograph (EEG).
EEG will record the signals as waves or wavy lines on to display or paper. This
pattern of electric activity produced on EEG can be used for various applications
like sleep detection, drowsiness detection, and sleep disorders like insomnia,
studying brain activities of coma patients and to diagnose many other conditions
7
which affect the brain. This paper discuss about how EEG can be used to
implement drowsiness detection in intelligent transportation system for example,
cars, airplanes, helicopters etc to monitor drowsiness status of the driver /pilot
(called as subject in this paper) and alert them being sleep.
Driver is the main part of vehicle system and driver condition is related to
traffic safety such as driver’s emotion state, fatigue state, drunken state etc. Study
says accuracy of these states will be reflected very efficiently in EEG. So, now a
days in intelligent transportation systems which mainly has network and
information, if driver’s EEG information can be gathered in Real-time and
transportation system is synchronized to this then driver can be alerted and
necessary measures can be taken against accidents due to sleep state of driver. In
this paper, combining the mobile device and EEG measuring instrument, the
experiments of drowsiness driving will be designed. EEG signals were measured
when they were in normal, drowsyness, sleep state.
Drowsiness detection is a challenging task on live signals. Many techniques
have been proposed on this. One of the method is using Mahalanobis Distance
which transforms a given multi normal distribution into the simple standard
(spherical) multi normal distribution. It also helps in studying the distributions and
conditions of independence of quadratic forms in multivariate normal variables.
Frequency bands are separated using DFT or FFT to an EEG Signal. After this, the
magnitude values are stored for each band. The lower cut of frequency and upper
cut of frequency is defined depends upon the frequency range of each band only
the signals between the upper band and lower band of EEG remain as it is and
others magnitudes are zero padded., for plotting graphical results for each band
like Delta, Alpha, Beta and Theta for calculation of percentage power in each
bands. The lower bands and upper bands are defined depend upon the frequency
8
range of each band. This detection system can be fully hardware controlled using
micro controller .
Krishnaveni Yendrapalli, Naga Pavan Kumar Tammana, S. S., (2014) in
The Brain Signal Detection for Controlling the Robot, [6] stated that Human
brain consists of millions of interconnected neurons. The patterns of interaction
between these neurons are represented as thoughts and emotional states. According
to the human thoughts, this pattern will be changing which in turn produce
different electrical waves. A muscle contraction will also generate a unique
electrical signal. All these electrical waves will be sensed by the brain wave sensor
and it will convert the data into packets and transmit through Bluetooth medium.
Level analyzer unit (LAU) will receive the brain wave raw data and it will
extract and process the signal using MATLAB platform. Then the control
commands will be transmitted to the robotic module which is the vehicle section.
With this entire system, we can move a robot according to the human thoughts and
it can be turned by blink thoughts and it can be turned by blink muscle contraction.
Electroencephalography (EEG) is the measurement of electrical activity in the
living brain. In this project we used a brainwave sensor MW001 to analyze the
EEG signals. This design discuss about processing and recording the raw EEG
signal from the Mind Wave sensor in the MATLAB environment and through
Zigbee transmission control commands will be passed to the Robot section. Mind
wave sensors are not used in clinical use, but are used in the Brain Control
Interface (BCI) and neuro feedback (one of biofeedback types). The BCI is a direct
communication pathway between the brain and an external device to provide direct
communication and control between the human brain and physical devices by
translating different patterns of brain activity into commands in real time.
9
Uma, K.J., Santha Kumar, C., (2014) in Non-Invasive EEG Based
Wireless Brain Computer Interface for Safety Applications Using Embedded
Systems, [11] stated that Drowsiness in drivers has been implicated as a causal
factor in many accidents because of the marked decline in drivers’ perception of
risk and recognition of danger, and diminished vehicle-handling abilities. The
National Sleep Foundation (NSF) reported that 51% of adult drivers had driven a
vehicle while feeling drowsy and 17% had actually fallen asleep. Therefore, real-
time drowsiness monitoring is important to avoid traffic accidents. Previous studies
have proposed a number of methods to detect drowsiness. They can be categorized
into two main approaches. The first approach focuses on physical changes during
fatigue, such as the inclination of the driver’s head, sagging posture, and decline in
gripping force on the steering wheel. The movement of the driver’s body is
detected by direct sensor contacts or video cameras. Since these techniques allow
noncontact detection of drowsiness, they do not give the driver any discomfort.
This will increase the driver’s acceptance of using these techniques to monitor
drowsiness. However, these parameters easily vary in different vehicle types and
driving conditions. The second approach focuses on measuring physiological
changes of drivers, such as eye activity measures, heart beat rate, skin electric
potential, and electro encephalographic (EEG) activities. It is reported that the eye
blink duration and blink rate typically are sensitive to fatigue effects. Further the
eye-activity-based methods are compared with EEG-based methods for alertness
estimates in a compensatory visual tracking task. In this a real-time wireless EEG-
based brain–computer interface (BCI) system for drowsiness detection is proposed.
The proposed BCI system consists of a wireless physiological signal-
acquisition module and an embedded signal processing module. Here, the wireless
physiological signal-acquisition module is used to collect EEG signals and transmit
10
them to the embedded signal-processing module wirelessly. It can be embedded
into a headband as a wearable EEG device for long-term EEG monitoring in daily
life. The embedded signal processing module, which provides powerful
computations and supports various peripheral interfaces, is used to real-time detect
drowsiness and trigger a warning tone to prevent traffic accidents when drowsy
state occurs.
Variability in EEG dynamics relating to drowsiness from alertness is large.
The same detection model may not be effective to accurately predict subjective
changes in the cognitive state. Therefore, subject-dependent models have also been
developed to account for individual variability. Although subject-dependent
models can alleviate the influence of individual variability in EEG spectra, they
still cannot account for the cross-session variability in EEG dynamics due to
various factors, such as electrode displacements, environmental noises, skin-
electrode impedance, and baseline EEG differences.
11
BRAIN COMPUTER INTERFACE SYSTEM
Brain wave signal
Human Brain
Raw brain wave signal transmission
BlueTooth Packets transmision
Raw data transmission
Brain wave sensor
Reference ground
connection
Dry electrode
unit
EEG Power Spectrum Process
CHAPTER-3
PROJECT DESCRIPTION
3.1 BLOCK DIAGRAM
Figure 3.1 Block diagram of the proposed model
DATA PROCESSING UNIT
Level Splitter
Section
Raw data extraction and Processing unit
BlueTooth Reception
serial data transmission transmission
VEHICLE SECTION
Motor
rrr 1 Motor
1
ARM
PWM
GPIO U A R T
Serial data
reception
Alert Display
12
The functional blocks of the block diagram shown in Figure 3.1 are explained as
follows,
3.2 BRAIN COMPUTER INTERFACE SYSTEM
3.2.1 HUMAN BRAIN
The average human brain weights around 1400 grams. The brain can be
divided into four structures: cerebral cortex, cerebellum, brain stem, hypothalamus
and thamalus. The most relevant of them concerning BCIs is the cerebral cortex.
The cerebral cortex can be divided into two hemispheres. The hemispheres are
connected with each other via corpus callosum. Each hemisphere can be divided
into four lobes. They are called frontal, parietal, occipital and temporal lobes.
Cerebral cortex is responsible for many “higher order” functions like problem
solving, language comprehension and processing of complex visual Information.
The cerebral cortex can be divided into several areas, which are responsible of
different functions. These areas can be seen in Figure 3.2. The functions are
described in Table 3.1. These kinds of knowledge have been used when with BCIs
based on the pattern recognition approach. The mental tasks are chosen in such a
way that they activate different parts of the cerebral cortex.
13
Figure 3.2 Functional areas of the brain
14
Table 3.1: Cortical areas of the brain and their function
Type Frequency Location Use
Delta <4 Hz everywhere occur during sleep, coma
Theta 4-7 Hz temporal and
parietal correlated with emotional stress (frustration & disappointment)
Alpha 8-12 Hz occipital and parietal reduce amplitude with sensory
stimulation or mental imagery
Beta 12-36 Hz parietal and frontal can increase amplitude during
intense mental activity
Mu 9-11 Hz frontal (motor
cortex) diminishes with movement or
intention of movement
Lambda sharp, jagged occipital correlated with visual attention
15
3.2.2 BRAIN WAVE SENSOR
Electro encephalography (EEG) is a method used in measuring the electrical
activity of the brain. The electrical activity of a single neuron cannot be measured
with scalp EEG.
Four prerequisites, which must be met for the activity of any network of neurons to
be visible in EEG signal, are
The neurons must generate most of their electrical signals along a specific
axis oriented perpendicular to the scalp.
The neuronal dendrites must be aligned in parallel so that their field
potentials summate to create a signal which is detectable at a distance.
The neurons should fire in near synchrony.
The electrical activity produced by each neuron needs to have the same
electrical sign.
The various components of brain wave sensor are
Electrode records the EEG, which are placed on the scalp. Electrodes are
small plates, which conduct electricity. They provide the electrical contact between
the skin and the EEG recording apparatus by transforming the ionic current on the
skin to the electrical current in the wires. The placement of electrode is shown in
the Figure 3.3.
16
Figure 3.3 Placement of electrode on the scalp
EEG power spectrum analyzer Converts analog signal into digital signal.
Certain features are extracted from the preprocessed and digitized EEG signal. In
the simplest form a certain frequency range is selected and the amplitude relative
to some reference level measured. Typically the features are certain frequency
bands of a power spectrum. The power spectrum (which describes the frequency
content of the EEG signal) can be calculated using, for example, Fast Fourier
Transform (FFT), the transfer function of an auto regressive (AR) model or
wavelet transform. No matter what features are used, the goal is to form distinct set
of features for each mental task.
17
3.3 DATA PROCESSING UNIT
This session involves detecting the meditation level of a person and to send
the control information to the vehicle unit if it exceeds the threshold value.
Drowsiness, eyes open and eyes closed are closely connected to alpha activity.
Once sleepiness forces the eyes to shut, alpha waves are strongest encephalogram
brain signals have reported that in sleepiness state alpha activity mainly seems in
os space and particularly magnitude of alpha2 wave like a better alpha band
(11~13Hz) increases. However, supposing traditional adults have their eyes open
notwithstanding they drowse, alpha changes of can’t be explain one thing logically.
The various sections of data processing unit are.
Level Splitter Section uses matlab with Think Gear library on receiving the
data packets from the brainwave sensor it checks the meditation level with the
given threshold value. If it exceeds the first threshold limit it sends the command
‘B’ to the vehicle unit through UART. After crossing the second threshold it
sends the command ‘A’ to the vehicle unit.
Bluetooth Section is used to receive the data packets transmitted by the brain
wave sensor. It uses the Bluetooth version 2.0 with a symbol rate of 3mbps.
Serial Data Transmitter (RS232) is used to transfer information between data
processing equipment and peripherals is in the form of digital data which is
transmitted in either a serial or parallel mode. Parallel communications are used
mainly for connections between test instruments or computers and printers, while
serial is often used between computers and other peripherals. Serial transmission
involves the sending of data one bit at a time, over a single communication line.
18
3.4 VEHICLE SECTION
This half consists of ARM core processor as a main unit, Brain wave device
system, Ignition unit, PC, alert section and a show unit. This modules with coming
up with and implementation technique is given below.
ARM processor is employed for dominant the system. Here we have a
tendency to square measure victimization the LPC2148 series, which has 2 UART.
Interrupt routine code is employed to visualize whether or not we have a tendency
to have gotten any serial interrupt. For this project we have a tendency to square
measure having some interrupt checking commands ‘B’ and ‘A’.
Once ARM processor receives a command ‘B’ through UART1, then the
processor can trigger the alarm circuit. Next, if the processor receives a command
‘A’, then the processor can move the motive force circuit. Attributable to this the
engine is going to be move instantly. So, this worth within the information base can
compare mechanically the motive force management unit can stop. This interrupt
routine code is going to be checked by the processor endlessly that will increase
the potency of the project.
During this project the engine unit are going to be controlled by a driver
circuit. The motive force circuit consists of a driver unit, electrical device and a
semiconductor unit. If the automobile is started, the engine are going to be turned
ON which implies ARM processor can offer the bias voltage to the semiconductor
unit to modify on the relay that successively activate the automobile engine.
Meantime the processor can check the interrupt routine.
19
CHAPTER-4
RESULTS
4.1 HARDWARE DESCRIPTION
The Figure 4.1 shows the brain wave sensor which detects brain wave
signals and converts them into digital packets and transmit them to level splitter
section using Bluetooth transmitter.
Figure 4.1 Brain Wave Sensor
20
The Figure 4.2 shows the continuous eye blink of the driver. For every blink
there is a dip in the waveform.
Figure 4.2 Eye Blink Signal
21
The Figure 4.3 shows the brainwave visualizer which indicates the varying
brainwave signals. In the Figure the meditation level of the driver is shown with
three ways of plotting. This visualizer is used to initialize the brain wave sensors.
Figure 4.3 Brain Wave Visualizer
22
The Figure 4.4 shows the blink detection of the driver by MATLAB. Three
blinks are required to activate the drowsyness detection in the program.
Figure 4.4 Blink Detection in MATLAB
23
The Figure 4.5 shows the plot of Meditation values and the blink values of
the driver. The black stared plot indicates the blink values of the driver and the
blue plot indicates the meditation level of the driver.
Figure 4.5 Plot of Blink and Meditation Level
24
The Figure 4.6 shows the buzzer activation. When the meditation crosses the
first threshold value control signal B is sent to the vehicle control unit through
serial data transmission.
Figure 4.6 Buzzer Activation
25
The Figure 4.7 shows the motor speed control. When the meditation level
crosses the second threshold level, control signal A is sent to the vehicle control
unit through serial data transmission.
Figure 4.7 Speed Control Activation
26
The Figure 4.8 shows the vehicle control unit of the proposed model. When
it receives the command B from the Level Splitter Section through UART1 Port, it
turns ON the buzzer. When it receives the command A from the Level Splitter
Section through UART1 port, it controls the speed of the motor.
Figure 4.8 Vehicle Control Unit
27
4.2 SOFTWARE DESCRIPTION
4.2.1 FLOW CHART
Figure 4.9 Flow Chart of Proposed Model
NO
YES
YES
INITALIZATION OF BRAINWAVE SENSOR
START
READ THE MEDITATION LEVEL
ACTIVATE BUZZER
CONTROL THE SPEED OF THE NOTOR
IF
MEDITATION
>90
READ THE MEDITATION LEVEL
STOP
NO
IF
MEDITATION
>80
28
4.2.2 ALGORITHM
Step 1
The brain wave sensor is first initialized by using brain wave visualizer
software.
Step2
After initialization connect the brain wave sensor with the MATLAB tool.
Then read the meditation level value that is transmitted by the brain wave sensor.
Step 3
The meditation level is then compared with two different threshold values.
Step 4
If the meditation level is greater than the first threshold value it triggers the
buzzer, if not continue to read the meditation level.
Step 5
If the meditation level is greater than the second threshold value it controls
the speed of the car, if not continue to read the meditation level.
29
CHAPTER -5
CONCLUSION AND FUTURE SCOPE
In this work six EEG-based brain computer interface systems were reviewed
and compared. Experiments lasting five days with three subjects were done with
the Brain Interface system. The comparison of the BCI systems, especially their
training duration and performance, proved to be difficult. This was because the
results were reported inadequately and differently in most of the papers. Reporting
the experiments and results should be standardized.
Accuracy is the most important and affects greatly on the performance of the
BCI. Many of the BCI systems are operated in a synchronous way, using trials
lasting many seconds each. This means that time required for making one selection
is long. This time should be kept short (below one second). Feedback methods
could be improved, maybe using games like in the EEG biofeedback. Some of the
mental tasks used in the ABI and the experiments in this work are not good.
The relax task is the easiest to classify, but it includes eye opening and
closing, which is not permitted in a BCI by the definition presented in the
beginning of the second chapter. It can be argued if people suffering from locked-
in-syndrome can use the relax task. In addition, it is not good in applications,
because eyes are closed. Subtraction, word association and cube rotation tasks are
not very natural and practical in applications. The left and the right hand
movement are the most natural of the current tasks.
30
In the future, an exhaustive research about the mental tasks should be done.
A study of the left and right hand movements using high-resolution EEG and MEG
is planned. Research topics would include the localization of the brain activity
during the mental tasks and how the EEG changes in process of time. Other
research areas would be feedback methods and online learning. There are many
challenges in the future of the BCI field. Currently none of the BCIs are capable of
proper cursor control, which could be used to control ordinary computer
applications. In the near future it is not possible and special applications must be
developed for BCIs. Today, special writing applications or Internet browser can
provide communication tools for severely disabled people. These applications
could be improved. In the future, BCIs could be used to control a hand prosthesis.
How well that can be achieved with EEG-based BCIs is not yet known. Non-
invasive BCIs recording activity directly from the motor cortex may be used for
this kind of purpose in the future.
31
APPENDIX
MICROCONTROLLER ARM LPC 2148
LPC 2148 BOARD
The LPC2141/2/4/6/8 microcontrollers are based on a 32/16 bit
ARM7TDMI-S CPU with real-time emulation and embedded trace support, that
combines the microcontroller with embedded high speed flash memory ranging
from 32 kB to 512 kB. A 128-bit wide memory interface and a unique accelerator
architecture enable 32-bit code execution at the maximum clock rate. For critical
code size applications, the alternative 16-bit Thumb mode reduces code by more
than 30 % with minimal performance penalty. Due to their tiny size and low power
consumption, LPC2141/2/4/6/8 are ideal for applications where miniaturization is
a key requirement, such as access control and point-of-sale. A blend of serial
communications interfaces ranging from a USB 2.0 Full Speed device, multiple
UARTs, SPI, SSP to I2Cs, and on-chip SRAM of 8 kB up to 40 kB, make these
devices very well suited for communication gateways and protocol converters, soft
modems, voice recognition and low end imaging, providing both large buffer size
and high processing power. Various 32-bit timers, single or dual 10-bit ADC(s),
10-bit DAC, PWM channels and 45 fast GPIO lines with up to nine edge or level
sensitive external interrupt pins make these microcontrollers particularly suitable
for industrial control and medical systems.
32
FEATURES
16/32-bit ARM7TDMI-S microcontroller in a tiny LQFP64 package.
8 to 40 kB of on-chip static RAM and 32 to 512 kB of on-chip flash
program memory. 128 bit wide interface/accelerator enables high speed 60 MHz
operation.
In-System/In-Application Programming (ISP/IAP) via on-chip boot-loader
software. Single flash sector or full chip erase in 400 ms and programming of 256
bytes in 1 ms.
EmbeddedICE RT and Embedded Trace interfaces offer real-time
debugging with the on-chip RealMonitor software and high speed tracing of
instruction execution.
33
USB 2.0 Full Speed compliant Device Controller with 2 kB of endpoint
RAM. In addition, the LPC2146/8 provide 8 kB of on-chip RAM accessible to
USB by DMA.
One or two (LPC2141/2 vs. LPC2144/6/8) 10-bit A/D converters provide a
total of 6/14 analog inputs, with conversion times as low as 2.44 μs per channel.
Single 10-bit D/A converter provides variable analog output.
Two 32-bit timers/external event counters (with four capture and four
compare channels each), PWM unit (six outputs) and watchdog.
Low power real-time clock with independent power and dedicated 32 kHz
clock input.
Multiple serial interfaces including two UARTs (16C550), two Fast I2C-bus
(400 kbit/s), SPI and SSP with buffering and variable data length capabilities.
Vectored interrupt controller with configurable priorities and vector
addresses.
Up to 45 of 5 V tolerant fast general purpose I/O pins in a tiny LQFP64
package.
Up to nine edge or level sensitive external interrupt pins available.
60 MHz maximum CPU clock available from programmable on-chip PLL
with settling time of 100 μs.
On-chip integrated oscillator operates with an external crystal in range from
1 MHz to 30 MHz and with an external oscillator up to 50 MHz.
Power saving modes include Idle and Power-down.
Individual enable/disable of peripheral functions as well as peripheral clock
scaling for additional power optimization.
Processor wake-up from Power-down mode via external interrupt, USB,
Brown-Out Detect (BOD) or Real-Time Clock (RTC).
34
Single power supply chip with Power-On Reset (POR) and BOD circuits: –
CPU operating voltage range of 3.0 V to 3.6 V (3.3 V ± 10 %) with 5 V tolerant
I/O pads.
APPLICATIONS
Industrial control.
Medical systems.
Access control.
Point-of-sale.
Communication gateway.
Embedded soft modem.
General purpose applications.
ARM7TDMI-S PROCESSOR
The ARM7TDMI-S is a general purpose 32-bit microprocessor, which offers
high performance and very low power consumption. The ARM architecture is
based on Reduced Instruction Set Computer (RISC) principles, and the instruction
set and related decode mechanism are much simpler than those of
microprogrammed Complex Instruction Set Computers. This simplicity results in a
high instruction throughput and impressive real-time interrupt response from a
small and cost-effective processor core. Pipeline techniques are employed so that
all parts of the processing and memory systems can operate continuously.
Typically, while one instruction is being executed, its successor is being
decoded, and a third instruction is being fetched from memory. The ARM7TDMI-
S processor also employs a unique architectural strategy known as THUMB, which
35
makes it ideally suited to high-volume applications with memory restrictions, or
applications where code density is an issue.
The key idea behind THUMB is that of a super-reduced instruction set.
Essentially, the ARM7TDMI-S processor has two instruction sets:
The standard 32-bit ARM instruction set.
A 16-bit THUMB instruction set.
The THUMB set’s 16-bit instruction length allows it to approach twice the
density of standard ARM code while retaining most of the ARM’s performance
advantage over a traditional 16-bit processor using 16-bit registers. This is possible
because THUMB code operates on the same 32-bit register set as ARM code.
THUMB code is able to provide up to 65% of the code size of ARM, and 160% of
the performance of an equivalent ARM processor connected to a 16-bit memory
system. The ARM7TDMI-S processor is described in detail in the ARM7TDMI-S
Datasheet that can be found on official ARM website.
ON-CHIP FLASH MEMORY SYSTEM
The LPC2141/2/4/6/8 incorporate a 32 kB, 64 kB, 128 kB, 256 kB, and 512
kB Flash memory system, respectively. This memory may be used for both code
and data storage. Programming of the Flash memory may be accomplished in
several ways: over the serial built-in JTAG interface, using In System
Programming (ISP) and UART0, or by means of In Application Programming
(IAP) capabilities. The application program, using the IAP functions, may also
erase and/or program the Flash while the application is running, allowing a great
degree of flexibility for data storage field firmware upgrades, etc. When the
LPC2141/2/4/6/8 on-chip bootloader is used, 32 kB, 64 kB, 128 kB, 256 kB, add
36
500 kB of Flash memory is available for user code. The LPC2141/2/4/6/8 Flash
memory provides minimum of 100,000 erase/write cycles and 20 years of data-
retention.
ON-CHIP STATIC RAM (SRAM)
On-chip Static RAM (SRAM) may be used for code and/or data storage. The
on-chip SRAM may be accessed as 8-bits, 16-bits, and 32-bits. The
LPC2141/2/4/6/8 provide 8/16/32 kB of static RAM, respectively.
The LPC2141/2/4/6/8 SRAM is designed to be accessed as a byte-addressed
memory. Word and halfword accesses to the memory ignore the alignment of the
address and access the naturally-aligned value that is addressed (so a memory
access ignores address bits 0 and 1 for word accesses, and ignores bit 0 for
halfword accesses). Therefore valid reads and writes require data accessed as
halfwords to originate from addresses with address line 0 being 0 (addresses
ending with 0, 2, 4, 6, 8, A, C, and E in hexadecimal notation) and data accessed as
words to originate from addresses with address lines 0 and 1 being 0 (addresses
ending with 0, 4, 8, and C in hexadecimal notation). This rule applies to both off
and on-chip memory usage. The SRAM controller incorporates a write-back buffer
in order to prevent CPU stalls during back-to-back writes. The write-back buffer
always holds the last data sent by software to the SRAM. This data is only written
to the SRAM when another write is requested by software (the data is only written
to the SRAM when software does another write).
If a chip reset occurs, actual SRAM contents will not reflect the most recent
write request. Any software that checks SRAM contents after reset must take this
into account. Two identical writes to a location guarantee that the data will be
present after a Reset. Alternatively, a dummy write operation before entering idle
37
or power-down mode will similarly guarantee that the last data written will be
present in SRAM after a subsequent reset.
PIN CONFIGURATION
38
DESCRIPTION
The pin connect block allows selected pins of the microcontroller to have
more than one function. Configuration registers control the multiplexers to allow
connection between the pin and the on chip peripherals. Peripherals should be
connected to the appropriate pins prior to being activated, and prior to any related
interrupt(s) being enabled. Selection of a single function on a port pin completely
excludes all other functions otherwise available on the same pin. The only partial
exception from the above rule of exclusion is the case of inputs to the A/D
converter. Regardless of the function that is selected for the port pin that also hosts
the A/D input, this A/D input can be read at any time and variations of the voltage
level on this pin will be reflected in the A/D readings. However, valid analog
reading(s) can be obtained if and only if the function of an analog input is selected.
Only in this case proper interface circuit is active in between the physical pin and
the A/D module.
39
REFERENCES
1. Chris Berka , Daniel Levendowski, J., Philip Westbrook , Gene Davis ,
Michelle Lumicao, N., Richard Olmstead, E., Miodrag Popovic , Vladimir
Zivkovic, T., Caitlin Ramsey, K., (2012) ‘Implementation of a Closed-Loop Real-
Time EEG-Based Drowsiness Detection System’, International Journal of Human-
Computer Interaction, pp.151-170.
2. Deepa.T.P., Vandana Reddy, (2013) in ‘EEG Based Drowsiness Detection
Using Mobile Device for Intelligent Vehicular System’, International Journal of
Engineering Trends and Technology (IJETT) – Vol. 6.
3. Eskandarian, A., and Mortazavi, A., (2007) ‘Evaluation of a smart algorithm
for commercial vehicle driver drowsiness detection’, in Proc. IEEE Intelligent
Vehicles Symp., pp.553-559.
4. Hong, T., and Qin, H., (2009) ‘Drowsiness detection in embedded system’,
in Proc. IEEE Int. Conf. Vehicular Electronics and Safety.
5. Jothiranjhani, B., (2012) ‘wireless brain computer interface system for
drowsiness detection’ International Journal of Communications and Engineering,
Vol. 05, pp. 86.
40
6. Krishnaveni Yendrapalli , Naga Pavan Kumar Tammana, S.S., (2014) ‘The
Brain Signal Detection for Controlling the Robot’, International Journal of
Scientific Engineering and Technology Volume No.3 Issue No.10, pp : 1280-1283.
7. Pranjali Deshmukh, Somani, S.B., Shivangi Mishra, Daman Soni, (2012)
‘EEG based drowsiness estimation using mahalanobis distance’, pp. 2277 – 9043
International Journal of Advanced Research in Computer Science and Electronics
Engineering Vol. 1.
8. Qiang, J., Zhiwei, Z., and Lan, P., (2004) ‘Real-time nonintrusive
monitoring and prediction of driver fatigue’, IEEE Trans. Vehic. Technol., vol. 53,
no. 4, pp. 1052– 1068.
9. Rupinder Kaur , Karamjeet Singh, (2013) ‘Drowsiness Detection based on
EEG Signal analysis using EMD and trained Neural Network’, International
Journal of Science and Research (IJSR), Vol. 2.
10. Shah Aqueel Ahmed, Syed Abdul Sattar, Elizabath Rani, D., (2013)
‘Separation Of , , & Activities In EEG To Measure The Depth Of Sleep And
Mental Status’, International Journal of Engineering Trends and Technology
(IJETT) Vol. 4, pp. 4618.
11. Uma, K.J., Santha Kumar, C., (2014) in Non-Invasive EEG Based Wireless
Brain Computer Interface for Safety Applications Using Embedded Systems,
International Journal of Innovative Research in Computer and Communication
EngineeringVol.2.