PRO42

Download as pdf or txt
Download as pdf or txt
You are on page 1of 63

Brain Computer Interfacing And Controllong External

Devices
A Project stage-Ⅱ
stage report submitted in
n partialfulfilment of the

requirements for the award of the degree of

BACHELOR OF TECHNOLOGY
IN
ELECTRONICS AND COMMUNICATION ENGINEERING
AWARDED BY
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY
KAKINADA
By

JANA JAI SWETHA 20H41A0428


ADABALA DHATHRI PRASUNA LAKSHMI 20H41A0401
ELI MEGHANA 20H41A0420
NUKALA PRAVALLIKA 20H41A0448

Under the esteemed guidance of

MS. M.S MALLIKA,M.Tech.


Associate Professor, Department of ECE

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING


(Accredited by NBA, NEWDELHI)
BONAM VENKATA CHALAMAYYA INSTITUTE OF TECHNOLOGY &
SCIENCE BATLAPALEM, AMALAPURAM
AMALAPURAM-533201
533201
(Approved by AICTE NewDelhi, Permanently Affiliated to JNTUK, Kakinada
Kakinada,, Accredited by NAAC,
Bangalore)
BVC INSTITUTE OF TECHNOLOGY & SCIENCE
BATLAPALEM, AMALAPURAM-533201
(Approved by AICTE NewDelhi, Permanently Affiliated JNTUK, Kakinada, Accredited
by NAAC, Bangalore)

DEPARTMENT OF ELECTRONICS
AND COMMUNICATION
ENGINEERING
(Accredited by NBA, NEWDELHI)

CERTIFICATE

This is to certify that the Project work entitled “BRAIN COMPUTER INTERFACING
AND CONTROLLING EXTENAL DEVICES” submitted by JANA JAI
SWETHA(20H41A0428), ADABALA DHATHRI PRASUNA LAKSHMI (20H41A0401), ELI
MEGHANA(20H41A0420), NUKALA PRAVALLIKA (20H41A0448) is
Examined and adjudged as sufficient as apartial requirement for the award of the degree of
BACHELOR OF TECHNOLOGY IN ELECTRONICS AND COMMUNICATION
ENGINEERING at Jawaharlal Nehru technological university, Kakinada is abonafide record of
the Project work done by group of students under my guidance and supervision.

Project Supervisor Head of the Department

MS. M.S MALLIKA Dr. G V RAMANA


M.Tech., M.Tech,Ph.D.,FIE,MIEEE,FIETE.,

ASSOCIATE PROFESSOR, PROFESSOR,

DEPARTMENT OF ECE DEPARTMENTOFECE


BVCINSTITUTEOFTECHNOLOGY&SCIENCE
BATLAPALEM,AMALAPURAM-533201
(ApprovedbyAICTE NewDelhi,PermanentlyAffiliatedJNTUK, Kakinada,Accredited by
NAAC, Bangalore)

DEPARTMENTOFELECTRONICSAND
COMMUNICATION ENGINEERING
(AccreditedbyNBA,NEWDELHI)

CERTIFICATE

This is to certify that the Project work entitled “BRAIN COMPUTER INTERFACING
AND CONTROLLING EXTERNAL DEVICES ” submitted by JANA JAI
SWETHA(20H41A0428), ADABALA DHATHRI PRASUNA LAKSHMI (20H41A0401), ELI
MEGHANA(20H41A0420), NUKALA PRAVALLIKA (20H41A0448) is
Examined and adjudged as sufficient as apartial requirement for the award of the degree of
BACHELOR OF TECHNOLOGY IN ELECTRONICS AND COMMUNICATION
ENGINEERING at Jawaharlal Nehru technological university, Kakinada is abonafide record of
the Project work done by group of students under my guidance and supervision.

Project External Examiner______________________________

Project Internal Examiner__ _____________ _____________

Head of the Department


BONAM VENKATA CHALAMAYYA INSTITUTE OF TECHNOLOGY &

SCIENCE DEPARTMENT OF ELECTRONICS & COMMUNICATION

ENGINEERING

DEPARTMENT VISION
To become a recognized centre for quality electronics and communication engineering
education and develop ethicallysound, globally competent and socially responsible engineers

DEPARTMENT MISSION
DM1 To provide learner-centricElectronicsandCommunicationEngineeringeducation to overcome
the professional challenges

DM 2To pursueresearchand new technologies inElectronics &CommunicationEngineering


andrelateddisciplinestoservethesociety,industry,governmentandscientificcommunityneeds.

DM3Topromoteactivitiesforoveralldevelopmentofstakeholderwithethicalandprofessional
responsibility

PROGRAMEDUCATIONALOBJECTIVES(PEOs)
PEO 1Graduates will excel in their professional career and/or higher education by applying
knowledge of Mathematical, Scientific and Electronics and Communication engineering.

PEO2Graduateswillanalyze and solve reallife problems, adopt the modernengineering tools to


design systems that are economically feasible and socially acceptable

PEO 3Graduates will exhibit professionalism, social, ethical responsibility and inter-personal
skills to relate engineering issues in broader social context.

PEO 4Graduates willhave the zealand motivationto get involved in lifelong learning process to
become Innovators, Entrepreneurs and Leaders.
PROGRAMSPECIFICOBJECTIVES(PSOs)
PSO1ProfessionalSkills:Anabilitytodesign,analyzeandimplementAnalogandDigital
Electronics systems, Communication, Signal processing, VLSI, Embedded and IoT systems
using hardware and software.

PSO 2 Soft-Skills & Ethics: Abilityto communicate effectively and practice professional
ethics for societal benefit.
BONAMVENKATACHALAMAYYAINSTITUTEOFTECHNOLOGY&
SCIENCE DEPARTMENT OF ELECTRONICS & COMMUNICATION
ENGINEERING

PROGRAMOUTCOMES

PO1 ENGINEERING KNOWLEDGE: Apply the knowledge of mathematics, science,


engineering fundamentals, and an engineering specialization to the solution of complex
engineering problems.

PO2PROBLEMANALYSIS:Identify,formulate,researchliterature,andanalyzecomplex
engineering problems reaching substantiated conclusions using first principles of mathematics,
natural sciences, and engineering sciences.

PO3 DESIGN/DEVELOPMENT OF SOLUTIONS: Design solutions for complex


engineering problems and design system components or processes that meet the specified needs
with appropriate consideration for the public health and safety, and the cultural, societal, and
environmentalconsiderations.

PO4CONDUCTINVESTIGATIONSOFCOMPLEXPROBLEMS:Use
research-based knowledge and research methods including design of experiments, analysis and
interpretation ofdata, and synthesis ofthe information to provide valid conclusions.

PO5 MODERN TOOL USAGE: Create, select, and apply appropriate techniques,
resources, and modern engineering and IT tools including prediction and modelling to complex
engineering activities with an understanding of the limitations.

PO6 THE ENGINEER AND SOCIETY: Apply reasoning informed by the contextual
knowledge to assess societal, health, safety, legal and cultural issues and the consequent
responsibilities relevant to the professional engineering practice.

PO7 ENVIRONMENT AND SUSTAINABILITY: Understand the impact of the


professional engineering solutions in societal and environmental contexts, and demonstrate the
knowledge of, and need for sustainable development.

PO8 ETHICS: Applyethicalprinciplesand commit to professional ethicsand responsibilities


and norms of the engineering practice.
PO9 INDIVIDUAL AND TEAM WORK: Functioneffectivelyasan individual, and as a
member or leader in diverse teams, and in multidisciplinary settings.

PO10 COMMUNICATION: Communicate effectively on complex engineering activities


withtheengineering communityand withsocietyat large, suchas, being ableto comprehend and
write effective reports and design documentation, make effective presentations, give and receive
clear instructions.

PO11 PROJECT MANAGEMENT AND FINANCE: Demonstrate knowledge and


understanding ofthe engineering and management principlesand applythese toone’sownwork, as
a member and leader ina team, to manage projects and in multidisciplinaryenvironments.

PO12 LIFE-LONG LEARNING: Recognize the need for, and have the preparation and
ability to engage in independent and life-long learning in the broadest context of technological
change.
BONAM VENKATA CHALAMAYYAINSTITUTEOFTECHNOLOGY&
SCIENCE DEPARTMENT OF ELECTRONICS & COMMUNICATION
ENGINEERING

COURSEOUTCOMES(CO’s)FORPROJECTWORK

PROJECTWORK(C426)
C418.1.Outlinedetailedstudyoftopicassigned(Understanding).C418.2.
Organize a literature survey using latest journals in the preferredfield of
study(Applying).
C418.3. Develop a detailed plan for conducting project including
teamwork (Applying).
C418.4.Build detailed analysis/modeling/simulation/design/problem
solving as needed (Applying).
C418.5. Develop a final product/process and organizes testing (Applying).
C418.6.Identifyconclusionsandsuggest futurescope.Showthesistoreview panel
and explain the work (Understanding).
ACKNOWLEDEMENT
The satisfaction that accompanies the successful completion of every task during our
project work would be incomplete without the mention of the people who made it possible. We
consideritourprivilegetoexpressourgratitudeandrespecttoallwhoguided, inspiredandhelped in
completion of our project work.
We extended our heartfelt gratitude to the Almighty for giving us strength in proceeding
with this project work titled entitled “ARDUINO BASED DRIVER DROWSINESS
DETECTION, ALERTING AND SPEED CONTROLLING”.
Weexpressa great pleasureto acknowledge myprofoundsense ofgratitudetoourproject
Supervisor Mr. R SATISH KUMAR, M.Tech., Associate Professor ofECE departmentforhis
valuableandinspiringguidance,comments,suggestionsandencouragementthroughoutthecourse of
this project.

We are extremely thankful to our Project Review Committee member Dr. G M V PRASAD,
M.Tech,Ph.D.,FIE, MIEEE, FIETEProfessor & HODofECEdepartment, TIKKIREDDIADITYA
KUMAR, M.Tech,[Ph.D] Assistant Professor and Project Co-ordinator, ECE departmentand
Prof.BVRAMANA,B.E.,M.Tech,MBA,M.Sc.,(Ph.D.)MISTE,MIAENG,MIETE,professor and
seniorfacultyofECEdepartmentfortheircooperationandsupport throughoutthisprojectwork.

Our sincere thanks and deep sense ofgratitude to Dr. J V G RAMA RAO, M.Tech,
Ph.D., Professor, EEE department & Principal for his timely suggestions which helped us to
complete this project successfully.

Wearethankfultobothteaching andtechnicalstaffmembersofECEdepartmentfortheir kind


cooperation and allsortsofhelp in bringing out this project successfully.

PAVANKUMARSHARMASISTA 19H41A0452
KESAPRAGADANPSG PRAVALLIKA 19H41A0427
KUCHIMANCHIVRANUPAMA 206M5A0414
JYOTHSNAPRIYABANDARU 19H41A0409
GANAPATHIKARATAM 206M5A0413
LIST OF CONTENTS

CHAPTER NO NAME OF THE CHAPTER PAGENO


Listof Figures i
ListofTables ii
Abstract iii

1 INTRODUCTION 2
2 LITERATURE SURVEY 8
3 EXIXSTING SYSTEM 15
DRAWBACKS 16

4 PROPOSED TECHNIQUE AND


IMPLEMENTATION 29
5.1 PROPOSEDTECHNIQUE 30
5.2 EYEBLINKSENSOR 30
5.3 TRANSCEIVERMODULE 35
5.4 RELAY 38
5.5 SWITCH 40
5.6 DC MOTOR 40
5.7 PIEZO BUZZER 43
5.8 LCD 46
5.9 DROWSINESSDETECTORTESTING 50
6 SOFTWAREREQUIREMENTS 51
6.1 NEEDFORAWORKING SYSTEM 52
6.2 PROGRAMEXECUTION 53
6.3 TROUBLESHOOTING 54
7 APPLICATIONS&ADVANTAGES58
APPLICATIONS 59
ADVANTAGES 60

8 RESULT 61
9 CONCLUSION & FUTURESCOPE 63

REFERENCES 67
APPENDIX–A
Sourcecode
LIST OF FIGURES

FIGURE TITLE OF FIGURE PAGENO


NO

Fig3.1: Structureofanembeddedsystem 20

Fig4.1: Arduinounoboard 22
Fig4.2: Arduinoschematicdiagram 26
Fig4.3: Arduinopindescription 27

Fig4.4: Frequency chart 27

Fig5.1: IRsensor 31

Fig5.2: IRtransmittingled 32

Fig5.3: IRreceiverled 33
Fig5.4: WorkingofIRsensor 33
Fig5.5: Eyeblinksensor 35

Fig5.6: Transmitterside 37

Fig5.7: Receiverside 37

Fig5.8: Relay 38

Fig5.9: RelayinterfacingwithArduino 39

i
Fig5.10: Switch 40

Fig5.11: DCmotorrotationvspolarity 41

Fig5.12: Motorspeedcurve 42

Fig5.13: Buzzer 43

Fig5.14: BuzzerinterfacingwithArduino 45

Fig5.15: LCDDisplay 46

Fig5.16: InterfacingLCDwithArduino 49

Fig8.1: Arduinobaseddriverdrowsiness
detection,alertingandspeed
controlling 62
LISTOFTABLES

TABLENO TITLEOFTABLE PAGENO

Table5.16: LCDpindescription 48

Table5.17 : LCDcommandsregisterdescription 48

ii
ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

ABSTRACT

In recent years, Brain-Computer Interface (BCI) technology has emerged as a promising field for
enabling direct communication between the human brain and external devices. This paper presents an
overview of the current state of BCI technology and its applications in controlling external devices.

BCIs are designed to translate brain signals into commands that can be used to control external devices,
such as computers, prosthetic limbs, and robotic systems. These systems typically involve the use of
electroencephalography (EEG) or other neuroimaging techniques to record brain activity, which is then
processed using machine learning algorithms to extract meaningful commands.

One of the key challenges in BCI technology is to develop robust and reliable algorithms for decoding
brain signals in real-time. Recent advances in machine learning and signal processing have led to
significant improvements in the performance of BCI systems, making them more practical and
accessible for awide range of applications.

In this paper, we review the current state-of-the-art in BCI technology, including the different types of
BCIs, the underlying principles of brain signal decoding, and the challenges and future directions of the
field. We also discuss the potential applications of BCI technology in various fields, such as healthcare,
gaming, and assistive technology.

Overall, BCI technology has the potential to revolutionize the way we interact with external devices,
enabling new forms of communication and control for individuals with disabilities and enhancing the
capabilities of healthy individuals. Continued research and development in this field are crucial for
realizing the full potential of BCI technology in the future.

DEPARTMENTOFECE BVCITS,AMALAPURAM Page1


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

BRAIN COMPUTER INTERFACING AND


CONTROLLING EXTERNAL DEVICES.

DEPARTMENTOFECE BVCITS,AMALAPURAM Page2


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

CHAPTER-1
INTRODUCTION

DEPARTMENTOFECE BVCITS,AMALAPURAM Page3


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

INTRODUCTION:

The concept of Brain-Computer Interface (BCI) has garnered significant interest in recent years due to
its potential to revolutionize human-machine interaction. A BCI is a system that enables direct
communication between the brain and external devices, bypassing traditional pathways such as
muscles or nerves. This technology holds promise for a wide range of applications, from assisting
individuals with disabilities to enhancing human performance in various fields.

BCIs work by detecting and interpreting brain signals, which are then translated into commands that
can control external devices. These signals are typically acquired using electroencephalography
(EEG), functional magnetic resonance imaging (fMRI), or other neuroimaging techniques. Machine
learning algorithms are then used to analyze these signals and extract meaningful information, such as
the user's intent to move a cursor on a screenor control a robotic arm.

One of the primary motivations behind developing BCIs is to provide individuals with severe motor
disabilities, such as spinal cord injuries or amyotrophic lateral sclerosis (ALS), with a means to
communicate and interact with the world. BCIs can also be used to control prosthetic limbs, allowing
amputees to regain lost motor functions. Additionally, BCIs hold promise for enhancing human
performance in various fields, such as gaming, virtualreality, and neurofeedback training.

Despite the progress made in BCI technology, several challenges remain. These include improving
the speed and accuracy of signal decoding, enhancing the user-friendliness of BCI systems, and
addressing ethical and privacy concerns related to the use of brain data. Nevertheless, ongoing
research and development in this field continue to push the boundaries of what is possible, opening
up new possibilities for human-machine interaction.

Moreover, BCIs hold immense potential in fields such as gaming and virtual reality, where they can
provide immersive and intuitive control interfaces. Additionally, BCIs are being explored for their
ability to enhance human performance in areas such as neurofeedback training, cognitive
enhancement,and rehabilitation.

Despite these promising developments, several challenges remain in the field of BCIs. These include
improving the accuracy and reliability of signal detection, ensuring user comfort and safety, and
addressing ethical concerns related to privacy and data security.

In BCIs represent a groundbreaking technology that has the power to redefinethe way we interact with
machines and the world around us. Continued research and development in this field are essential to
unlock the full potential of BCIs and bring about a new era of human-machine symbios

DEPARTMENTOFECE BVCITS,AMALAPURAM Page4


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

CHAPTER 2

LITERATURESURVEY

DEPARTMENTOFECE BVCITS,AMALAPURAM Page5


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

CHAPTER2

LITERATURESURVEY

INTRODUCTION:

DEPARTMENTOFECE BVCITS,AMALAPURAM Page6


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

CHAPTER 3
EXISTING SYSTEMS

DEPARTMENTOFECE BVCITS,AMALAPURAM Page7


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

CHAPTER 3

INTRODUCTION TO EXISTING SYSTEMS

SYSTEM ANALYSIS AND DESCRIPTION :


Several existing systems demonstrate the practical applications of BCIs for controlling external devices.
These systems vary in complexity and functionality, but all aim to improve the quality of life for individuals
with disabilities and enhance human-machine interaction. BCIs have applications in healthcare for
monitoring and treating neurological disorders. For example, BCIs can be used to monitor brain activity in
patients with epilepsy or to deliver targeted stimulation for treating conditions such as Parkinson's disease.The
Brain Gate system, developed by Cyberkinetics Neurotechnology Systems, allows users to control a computer
cursor or a robotic arm using their brain signals. Companies like Emotiv and NeuroSky offer consumer-grade
BCIs that allow users to control games and other applications using their brain waves, providing a unique and
immersive gaming experience.

DRABACKS:

Limited Accuracy and Reliability: One of the primary drawbacks of existing BCIs is their limited accuracy
and reliability, particularly in real-world environments. Factors such as signal noise, electrode placement,
and user variability can affect the performance of BCIs, leading to errors in command recognition.
Complex Calibration and Training: Most BCIs require extensive calibration and training sessions to achieve
optimal performance. This can be time- consuming and challenging for users, particularly those with limited
motor function or cognitive abilities.
Limited Compatibility: Existing BCIs may not be compatible with all types of external devices, limiting their
usability in certain applications. For example, some BCIs may only work with specific software or hardware
configurations,making them less versatile for users.
Invasive Nature: Some BCIs require invasive procedures, such as implanting electrodes into the brain, which
can pose risks such as infection or tissue damage. This limits the accessibility of BCIs and may deter some
users from adopting them.
Limited Communication Bandwidth: BCIs often have limited communication bandwidth, which can restrict
the speed and complexity of commands that canbe sent to external devices. This can be a significant limitation
for applicationsthat require rapid and precise control.
Cost and Accessibility: BCIs can be costly to develop and implement, making them less accessible to
individuals with limited financial resources. Additionally, the availability of BCIs may be limited in certain
regions or healthcare settings, further restricting access for some users.
Ethical and Privacy Concerns: The use of BCIs raises ethical and privacy concerns related to the collection
and use of sensitive brain data. Issues such as data security, consent, and potential misuse of BCI technology
need to be carefully addressed.
User Fatigue and Discomfort: Prolonged use of BCIs can lead to user fatigue and discomfort, particularly in
systems that require sustained concentration or mental effort. This can affect the usability and acceptance of
BCIs in everydayapplications.

DEPARTMENTOFECE BVCITS,AMALAPURAM Page8


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

CHAPTER 4
PROPOSED
TECHNIQUE

DEPARTMENTOFECE BVCITS,AMALAPURAM Page9


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

CHAPTER4

PROPOSED TECHNIQUE

INTRODUCTION TO PROPOSED TECHNIQUE:

Our proposed BCI system aims to address some of the key limitations of existing systems while
improving user experience and performance. The system leverages advancements in signal processing,
machine learning, and user interface design to create a more intuitive and reliable interface for
controlling external devices using brain signals. We utilize machine learning algorithms, such as deep
learning, to enhance the decoding of brain signals andimprove the robustness of the system to individual
variations and environmental factors. These algorithms are trained on large datasets to learn patterns in
brain activity associated with specific commands, enabling more accurate and reliable control of
external devices. Our system undergoes rigorous clinical validation to ensure its safety, efficacy, and
usability for individuals with disabilities. This includes testing with a diverse range of usersin real-world
settings to assess the system's performance and user satisfaction.

ADVANTAGES :

Improved Accuracy and Reliability: The advanced signal processing and machine learning
algorithms used in our system enhance the accuracy and reliability of brain signal detection, leading to
more precise control of externaldevices.
Enhanced User Experience: The adaptive user interface and real-time feedback mechanisms improve the
overall user experience, making it more intuitive andenjoyable to use the BCI system.
Greater Usability and Accessibility: The system is designed to be accessible and user-friendly, with
customizable settings and compatibility with a wide range of external devices, making it suitable for
users with varying levels of ability.
Personalized Settings: The system allows users to personalize their settings for signal detection and
feedback, optimizing the system for their individual cognitive state and preferences.
Ethical and Privacy Considerations: The system prioritizes ethical and privacy concerns, implementing
robust security measures to protect user data and ensuring transparent and informed consent processes.
Clinical Validation: The system undergoes rigorous clinical validation to ensure its safety, efficacy, and
usability for individuals with disabilities,providing confidence in its performance and reliability.
Potential for Future Enhancements: The system is designed to be flexible and adaptable, allowing for
future enhancements and updates to further improve itsperformance and capabilities.

DEPARTMENTOFECE BVCITS,AMALAPURAM Page10


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

MODULES
Signal Acquisition
Feature Extraction
Machine Learning User
Interface Device
Control Adaptive
Learning
Data Logging and Analysis
Security and Privacy
Calibration and Training

Signal Acquisition:
This module is responsible for acquiring brain signals using techniques such as electroencephalography
(EEG), functional magnetic resonance imaging (fMRI), or invasive neural recording. The quality of
signal acquisition directlyaffects the performance of the BCI system.

Signal Preprocessing:
The acquired brain signals are preprocessed to remove noise, filter out unwanted artifacts, and enhance
the signal-to-noise ratio. Common preprocessing techniques include filtering, artifact removal, and
baseline correction.

Feature Extraction:
This module extracts relevant features from the preprocessed brain signals thatare indicative of the user's
intent. These features are used as input to the machine learning algorithms for decoding.

Machine Learning:

Machine learning algorithms, such as support vector machines (SVMs), deep learning, or linear
discriminant analysis (LDA), are used to decode the extracted features and classify them into specific
commands or actions for controlling external devices.

DEPARTMENTOFECE BVCITS,AMALAPURAM Page11


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

User Interface:
The user interface module provides a means for users to interact with the BCI system. This may include
visual feedback, auditory cues, or haptic feedback to indicate the system's response to the user's brain
signals.

Device Control:
This module is responsible for translating the decoded commands into actions that control external
devices, such as prosthetic limbs, wheelchairs, or computer interfaces. The accuracy and reliability of
device control are criticalfor the effectiveness of the BCI system.

Adaptive Learning:
Some BCI systems incorporate adaptive learning algorithms that can adapt tochanges in the user's brain
signals over time. This helps improve the system's performance and user experience.

Data Logging and Analysis:


This module logs and analyses the data collected during BCI operation, providing insights into the
system's performance and user interaction patterns. This information can be used to improve the system's
design and functionality.

Security and Privacy:


BCI systems may include modules for ensuring the security and privacy of user data, such as encryption,
authentication, and access control mechanisms.

Calibration and Training:


BCI systems often require calibration and training sessions to optimize their performance for individual
users. Modules for calibration and training help users learn how to generate effective brain signals for
controlling external devices.

DEPARTMENTOFECE BVCITS,AMALAPURAM Page12


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

FEASIBILITY STUDY

Technical Feasibility:

Signal Processing: Advanced signal processing techniques are available toenhance the accuracy and
reliability of brain signal detection.
Machine Learning: Machine learning algorithms, such as deep learning, canbe applied to decode brain
signals and improve the robustness of the system.
Device Compatibility: BCIs can be designed to be compatible with a widerange of external devices,
allowing for versatile applications.
User Interface: User interfaces can be designed to be intuitive and adaptive,improving user experience
and usability.

Economic Feasibility:

Cost of Development: The cost of developing a BCI system can vary depending on the complexity of
the system and the technologies used.
Cost of Implementation: The cost of implementing a BCI system can include hardware costs, software
development costs, and training costs.
Cost-Benefit Analysis: The potential benefits of a BCI system, such as improved quality of life for
individuals with disabilities and enhanced human-machine interaction, can outweigh the costs.

Operational Feasibility:

User Acceptance: User acceptance of a BCI system can depend on factorssuch as ease of use,
effectiveness, and reliability.
Training and Support: Adequate training and support should be provided tousers to ensure they can
effectively use the BCI system.
Integration with Existing Systems: BCIs should be designed to integrateseamlessly with existing
systems and workflows.

DEPARTMENTOFECE BVCITS,AMALAPURAM Page13


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

Legal and Ethical Feasibility:

Privacy and Security: BCIs should comply with legal and ethical standards regarding the collection
and use of sensitive brain data.
Informed Consent: Users should be provided with clear and comprehensiveinformation about the BCI
system and give their informed consent to use it.

Environmental Feasibility:

Energy Efficiency: BCIs should be designed to be energy-efficient,


minimizing their impact on the environment.
Sustainability: BCIs should be designed to be durable and reliable, reducingthe need for frequent
replacements and minimizing waste.

DEPARTMENTOFECE BVCITS,AMALAPURAM Page14


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

CHAPTER 5
SOFTWARE REQUIREMENTS

DEPARTMENTOFECE BVCITS,AMALAPURAM Page15


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

CHAPTER 6
SOFTWARE REQUIREMENTS

REQUIREMENT ANALYSIS
For developing the application the following are the Software
Requirements:

1. Python

2. Django

Operating Systems supported

1. Windows 10 64 bit OS

Debugger and Emulator


 Any Browser (Particularly Chrome)

Functional Requirements
 Graphical User interface with the User.

SOFTWARE DESIGN:

DATA FLOW DIAGRAM

Creating a Data Flow Diagram (DFD) for a Brain-Computer Interface (BCI) system for controlling
external devices involves identifying the flow of data between various components of the system.
External Devices: This represents the external devices that the user intends to control using the BCI
system, such as a prosthetic limb or a computer cursor.
BCI System: This is the main component of the system that processes the user's brain signals and
translates them into commands for the external devices.
Brain Signal Acquisition: This component acquires brain signals from the user using techniques such as
EEG or fMRI.
Signal Processing: The acquired brain signals are processed to remove noise and extract relevant
features.

DEPARTMENTOFECE BVCITS,AMALAPURAM Page16


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

Feature Extraction: This component extracts features from the processed brain signals that are used for
classification.
Machine Learning: Machine learning algorithms are used to classify the extracted features and generate
commands for the external devices.
Device Control: The commands generated by the machine learning algorithms are sent to the external
devices to control their actions.

External Devices

BCI System

Brain Signal
Aquisition

Signal
Processing

Feature Extraction

Machine Learning

Device Control

DEPARTMENTOFECE BVCITS,AMALAPURAM Page17


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

This diagram provides a visual representation of the data flow in a BCI system for controlling external
devices, illustrating how brain signals are processed and classified to enable control over external
devices.

USER CASE DIAGRAM

A use case diagram for a Brain-Computer Interface (BCI) system for controlling external devices
can help visualize the interactions between users and the system.
User: The user interacts with the BCI system.
Start BCI: Initiates the BCI system for signal processing.

Stop BCI: Terminates the BCI system.


Acquire Brain Signals: Captures brain signals from the user.
Adjust Settings: Allows the user to modify system settings.
View System Status: Provides the user with information about the system's
status.
Process Brain Signals: Processes the acquired brain signals.
Control External Devices: Translates processed signals into commands to
control external devices.

DEPARTMENTOFECE BVCITS,AMALAPURAM Page18


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

user

Start BCI Stop BCI

Acquire View system


Signals status
Brain
Adjust settings

Process Control External


Brain Signals Devices

In this diagram, the user is the actor interacting with the BCI system through three main use
cases: Acquire Brain Signals, Process Brain Signals, and Control External Devices. These use
cases represent the primary functionalities of the BCI system from the user's perspective.

DEPARTMENTOFECE BVCITS,AMALAPURAM Page19


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

IMPLEMENTATION
What is Python

These are some facts about Python. Python is present most widely used multi- purpose and high-
level programming language. It allows programming in Object-Oriented and Procedural
paradigms. Python programs commonly are smaller than other programming languages like Java.
Programmers have to write relatively less and indentation requirement of the language, makes them
readable all the time. Python language is being used by the almost all tech-giant companies like –
Google, Amazon, Facebook, Instagram, Dropbox, Uber… etc. The biggest strength of Python
language is huge collection of standard library itcan be used for the following –Machine Learning

• GUI applications (such as Kivy, Tkinter, PyQt, etc.)


• Web frameworks such as Django (used by YouTube, Instagram, Dropbox)
• Image processing (such as Opencv and Pillow)
• Web scraping (such as Scrapy, BeautifulSoup and Selenium)
• Test Framework
• Multimedia

Advantages of Python

Python offers several advantages for developing Brain-Computer Interface (BCI) systems for
controlling external devices:
Ease of Use: Python is known for its simple and readable syntax, making it easier for developers to
prototype and implement BCI applications. This can lead to faster development cycles and easier
maintenance of the code base.

Large Ecosystem: Python has a vast ecosystem of libraries and frameworks that can be leveraged
for BCI development. Libraries such as NumPy, SciPy, and scikit-learn are commonly used for
signal processing and machine learning tasksin BCI applications.

Machine Learning Capabilities: Python's strong support for machine learning through libraries like
TensorFlow, PyTorch, and scikit-learn is beneficial for developing advanced BCI systems. These
libraries can be used for training classifiers and algorithms to interpret brain signals and control
external devices.

Community Support: Python has a large and active community of developers, researchers, and
enthusiasts working in the field of BCI. This community provides resources, forums, and libraries
that can aid in the development of BCIapplications.

DEPARTMENTOFECE BVCITS,AMALAPURAM Page20


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

Cross-Platform Compatibility: Python is a cross-platform language, meaning that BCI applications


developed in Python can run on different operating systems without major modifications. This
enhances the portability and accessibility of BCI systems.

Integration with Hardware: Python has libraries, such as PySerial and PyUSB, that facilitate
communication with external hardware devices, which is essential for interfacing BCI systems with
external devices.

Rapid Prototyping: Python's interactive nature and support for scripting allow developers to
quickly prototype and test BCI applications. This agility can be crucial in the iterative
development process of BCI systems.

Scalability: Python's scalability allows BCI systems to be developed for various purposes, from
simple applications to complex, real-time systems. This flexibility makes Python suitable for a
wide range of BCI projects.

Overall, Python's simplicity, versatility, and extensive ecosystem make it a compelling choice for
developing Brain-Computer Interface systems for controlling external devices.

Disadvantages of Python

Performance: Python is an interpreted language, which can lead to lowerperformance compared to


compiled languages like C or C++. This may be a concern for real-time BCI applications that
require high computational efficiency and low latency.
GIL Limitations: Python's Global Interpreter Lock (GIL) can limit the ability to fully utilize multi-
core processors, which may impact the performance ofparallel processing tasks in BCI systems.
Memory Consumption: Python's memory consumption can be higher compared to other languages,
which may be a concern for resource-constrained environments or applications that require
efficient memory management.
Limited Control Over Hardware: While Python provides libraries for interfacingwith hardware, such
as PySerial and PyUSB, it may not offer the same level oflow-level control as languages like C or
assembly language. This can be a limitation for BCI applications that require precise control over
hardware.
Dependency on Third-Party Libraries: Python's reliance on third-party libraries for many tasks can
introduce dependencies and compatibility issues, which may complicate the development and
deployment of BCI systems.

DEPARTMENTOFECE BVCITS,AMALAPURAM Page21


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

Learning Curve: While Python is known for its simplicity and readability, it still has a learning
curve, especially for developers who are new to the language or the concepts of BCI. This may
impact the speed of development for some projects.
Security Concerns: As with any programming language, Python applications are vulnerable to
security risks such as code injection, data breaches, and other cyber threats. Developers must
follow best practices to ensure the security of BCI applications.
Real-Time Constraints: Python's garbage collection and dynamic typing can introduce
unpredictable delays, which may be problematic for BCI applications that require strict real-time
performance

Install Python on Windows and Mac Step by Step:


Step 1: Go to the official site and use Google Chrome or any other web browserto download and
install Python. Or click on the following link:
https://www.python.org

Step 2: Click on the Download Tab.


Step 3: You can select the yellow Download Python for Windows 3.7.4 button,

DEPARTMENTOFECE BVCITS,AMALAPURAM Page22


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

or you can scroll down and click the download of the corresponding version.Here, we are
downloading the latest version of Python for Window.

Step 4: Scroll down the page until you find the "File" option.
Step 5: Here you will see different versions of Python and operating systems.

To download Windows 32bit Python, you can select the built-in Windows X86 Zip file, Windows
X86 executable installer or Windows X86 installer on the Web.
To download Windows 64bit Python, you can select any option of the three options. Zip File
Windows X866, Windows X8664 executable installer or Windows X8664 installer based on the
web. Here you will install the installer based on the Windows X8664 website. Here, the first part of
the Python version was completed. Now we will go in advance the second part when installing
Python I. Note: You can click on the option of the release of the version to know the changes or
updates made in the versio

DEPARTMENTOFECE BVCITS,AMALAPURAM Page23


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

Installation of Python
Step 1: Go to Download and Open the downloaded python version to carry outthe installation process
Step 2: Before you click on Install Now, Make sure to put a tick on Add Python3.7

Step 3: Click on Install NOW After the installation is successful. Click on Close.

DEPARTMENTOFECE BVCITS,AMALAPURAM Page24


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

With these above three steps on python installation, you have successfully andcorrectly installed
Python. Now is the time to verify the installation.
Note: The installation process might take a couple of minutes.

Verify the Python InstallationStep 1:


Click on Start
Step 2: In the Windows Run Command, type “cmd”.

Step 3: Open the Command prompt option.

DEPARTMENTOFECE BVCITS,AMALAPURAM Page25


ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

Step 4: Let us test whether the python is correctly installed. Type python – Vand press Enter.

Step 5: You will get the answer as 3.7.4


Note: If you have any of the earlier versions of Python already installed. Youmust first uninstall the
earlier version and then install the new one.
Check how the Python IDLE works Step 1: Click on Start Step 2: In the
Windows Run command, type “python idle”.

Step 3: Click on IDLE (Python 3.7 64-bit) and launch the program

Step 4: To go ahead with working in IDLE you must first save the file. Clickon File Click on Save

26
ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

Step 5: Name the file and save as type should be Python files. Click on SAVE.Here I have named the files
as Hey World.

27
ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

TESTING

Testing for Brain-Computer Interface (BCI) systems involves several key aspects to ensure
their effectiveness and safety in controlling external devices. Here are some testing
considerations:

1. Signal Acquisition and Processing: Test the system's ability to accurately


acquire and process brain signals. This includes assessing the quality of
EEG signals and the effectiveness of signal processing algorithms.

2. Control Accuracy: Evaluate the accuracy of the BCI in translating brain


signals into control commands for external devices. This can be done
through various tasks, such as controlling a cursor on a screen or navigating
a virtual environment.

3. Response Time: Measure the system's response time from the detection
of a brain signal to the execution of a command. Low response times are
crucial for real-time applications.

4. Robustness: Test the system's robustness against noise, artifacts, and


signal variations. This is important for ensuring reliable performance in
different environments and conditions.

5. User Experience: Assess the user's experience with the BCI system,
including comfort, ease of use, and overall satisfaction. User feedback can
help improve the design and usability of the system.

6. Safety: Ensure that the BCI system is safe for the user, particularly in
applications where it controls critical devices or systems. This includes
evaluating the risk of unintended actions and implementing safety measures.

28
ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

7. Safety: Ensure that the BCI system is safe for the user, particularly in
applications where it controls critical devices or systems. This includes
evaluating the risk of unintended actions and implementing safety measures.

8. Integration: Test the integration of the BCI system with external devices,
such as prosthetics, computers, or other electronic devices. Ensure
compatibility and seamless operation.

9. Long-Term Use: Assess the performance of the BCI system over an


extended period to determine its reliability and durability in real-world
scenarios.

By addressing these testing considerations, developers can ensure that BCI systems are
reliable, accurate, and safe for controlling external devices.
Test the BCI with a diverse group of users to account for individual differences in brain
signals and user abilities. This can help ensure that the BCI is effective for a wide range of
users.
Evaluate the BCI's ability to adapt to changes in user behavior or signal characteristics over
time. This may involve testing the BCI's performance after extended periods of use or in
different environments.
Test the BCI's ability to handle errors and unexpected inputs. This includes scenarios such as
signal artifacts, user fatigue, or misclassifications, and ensuring that the BCI can recover
gracefully from such situations.
Assess the BCI's susceptibility to interference from external sources, such as electrical noise
or other devices. Test the BCI in different environments to identify and mitigate potential
sources of interference.
Validate the BCI's performance against established metrics and benchmarks. Compare the
BCI's performance to existing systems or standards to ensure that it meets or exceeds
expected performance levels.

29
ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

Test the BCI's scalability to handle increasing numbers of users or devices. This may involve
testing the BCI's performance under high-load conditions or in distributed computing
environments.

Ensure that the BCI complies with relevant regulations and standards for safety, data privacy,
and accessibility. This may involve conducting regulatory compliance testing and obtaining
necessary certifications.
Document the testing process, results, and any issues encountered during testing. This
documentation can be used to improve the BCI's design, implementation, and testing
processes in future iterations.
By addressing these additional testing considerations, developers can ensure that BCI systems
are robust, reliable, and effective for controlling external devices in a variety of real-world
applications.

NEED OF TESTING
Testing is crucial for Brain-Computer Interface (BCI) systems designed to control external
devices.

1. Accuracy and Reliability: Testing ensures that the BCI accurately


interprets brain signals and reliably translates them into commands for
external devices. This is critical for ensuring that users can control devices
effectively and safely.

2. Safety: Testing helps identify and mitigate safety risks associated with
BCI use. For example, testing can ensure that the BCI does not inadvertently
activate devices or cause harm to users due to misinterpretation of signals.

3. Usability: Testing allows developers to evaluate the usability of the BCI,


including factors such as ease of use, comfort, and user satisfaction. This
feedback is essential for improving the user experience and increasing the
adoption of BCI technology.

30
ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

4. Performance Optimization: Testing helps developers optimize the


performance of the BCI, such as improving signal processing algorithms,
reducing latency, and increasing classification accuracy. This leads to a
more efficient and effective BCI system.

5. Adaptability: Testing can help assess how well the BCI adapts to changes
in user behaviour, signal quality, and environmental conditions. This is
important for ensuring that the BCI remains effective over time and in
different contexts.

6. Regulatory Compliance: Testing is often required to ensure that BCI


systems comply with regulatory standards and guidelines related to safety,
data privacy, and medical device certification. This is essential for the
commercialization and deployment of BCI technology.

7. User Training: Testing can be used to evaluate the effectiveness of user


training protocols for using the BCI. This can help developers design more
efficient and user-friendly training programs.

Overall, testing is essential for ensuring the effectiveness, safety, and usability of Brain-
Computer Interface systems for controlling external devices. It helps identify and address
issues early in the development process, leading to more reliable and user-friendly BCI
systems.

31
ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

CHAPTER 6
APPLICATIONS & ADVANTAGES

32
ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

CHAPTER 7
APPLICATIONS & ADVANTAGES

APPLICATIONS:

33
ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

CHAPTER 7
RESULT

34
ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

CHAPTER8
RESULT

RESULT:

35
ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

36
ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

37
ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

38
ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

CHAPTER 9
CONCLUSION & FUTURESCOPE

39
ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

CHAPTER 9
CONCLUSION & FUTURESCOPE
CONCLUSION:

In conclusion, Brain-Computer Interface (BCI) technology has the potential to revolutionize the way we interact
with external devices, offering new possibilities for communication, control, and assistive technology.
However, the development and deployment of BCI systems for controlling external devices require careful
consideration of various factors, including signal acquisition and processing, user training, safety, and
regulatorycompliance.

Testing is essential for ensuring that BCI systems are accurate, reliable, andsafe for users. It helps identify and
mitigate potential issues related to signalprocessing, control accuracy, user variability, and usability. By
addressing these challenges through rigorous testing and validation, developers can create BCI systems that are
effective, efficient, and user-friendly.

While there are challenges and limitations associated with BCI technology,continued research, development, and
testing hold the promise of unlockingnew capabilities and improving the quality of life for individuals with
disabilities and other users.

The field of BCI is rapidly evolving, with advancements in signal processing, machine learning, and
neurotechnology. Future BCI systems may offer even greater control and functionality, opening up new
possibilities for applications in healthcare, gaming, and beyond.

40
ARDUINO BASEDDRIVERDROWSINESSDETECTION,ALERTINGANDSPEED CONTROLLING

FUTURESCOPE:

Future enhancements in Brain-Computer Interface (BCI) technology for controlling external devices are likely
to focus on several key areas Advancements in signal processing techniques, such as machine learning
algorithms and neural networks, can enhance the accuracy and speed of BCI systems. This can lead to more
reliable and responsive control of external devices.

Developments in sensor technology, including higher-resolution EEG and fNIRS sensors, can improve the
quality and reliability of brain signals captured by BCIs. This can result in more precise control commands and
reduced signal noise.

Future BCIs may incorporate closed-loop systems, where feedback from external devices is used to modulate
brain activity. This bidirectional communication can improve user engagement and control performance.
BCIs may evolve to include adaptive interfaces that learn and adapt to user preferences and brain patterns over
time. This can enhance user experienceand reduce the need for extensive calibration.

Combining multiple modalities, such as EEG, fNIRS, and eye-tracking, can provide richer information for BCI
systems. This can improve the robustness and versatility of BCIs for controlling a wide range of external
devices.

41
REFERENCES

1. Wolpaw, J.R., Birbaumer, N., McFarland, D.J., Pfurtscheller, G., & Vaughan,
T.M. (2002). Brain-computer interfaces for communication and control.
Clinical Neurophysiology, 113(6), 767-791.

2. Lebedev, M.A., & Nicolelis, M.A.L. (2006). Brain–machine interfaces: past,


present and future. Trends in Neurosciences, 29(9), 536-546.

3. Millán, J.D.R., Rupp, R., Müller-Putz, G.R., Murray-Smith, R., Giugliemma,


C., Tangermann, M., ... & Mattia, D. (2010). Combining brain-computer
interfaces and assistive technologies: state-of-the-art and challenges. Frontiers
in Neuroscience, 4, 161.

4. Hochberg, L.R., Bacher, D., Jarosiewicz, B., Masse, N.Y., Simeral, J.D.,
Vogel, J., ... & Henderson, J.M. (2012). Reach and grasp by people with
tetraplegia using a neurally controlled robotic arm. Nature, 485(7398), 372-
375.

5. Krol, L.R., & Kosmyna, N. (2018). A comprehensive review on passive and


active brain-computer interface for speechless, sightless and paralyzed users.
Journal of Neural Engineering, 15(6), 061001.

6. Hong, K.S., Khan, M.J., & Hong, M.J. (2018). Feature extraction and
classification methods for hybrid fNIRS-EEG brain-computer interfaces.
Frontiers in Human Neuroscience, 12, 246.

7. Nijboer, F., Birbaumer, N., & Kübler, A. (2010). The influence of


psychological state and motivation on brain–computer interface performance
in patients with amyotrophic lateral sclerosis–a longitudinal study. Frontiers in
Neuroscience, 4, 55.

8. Chaudhary, U., Xia, B., & Silvoni, S. (2017). Brain–computer interface–based


communication in the completely locked-in state. PLoS Biology, 15(1),
e1002593.
9. Citi, L., Poli, R., Cinel, C., Sepulveda, F., & Riso, R. (2011). A multimodal
approach for online adaptive brain-machine interfacing. IEEE Transactions on
Neural Systems and Rehabilitation Engineering, 19(6), 605-615.

10. Vidaurre, C., Sannelli, C., Müller, K.R., & Blankertz, B. (2011).
Machine-learning-based coadaptive calibration for brain–computer interfaces.
Neural computation, 23(3), 791-8.
SOURCE CODE:

function varargout = MAIN(varargin)


% MAIN MATLAB code for MAIN.fig
% MAIN, by itself, creates a new MAIN or raises the existing
% singleton*.
%
% H = MAIN returns the handle to a new MAIN or the handle to
% the existing singleton*.
%
% MAIN('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in MAIN.M with the given input arguments.
%
% MAIN('Property','Value',...) creates a new MAIN or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before MAIN_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to MAIN_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help MAIN

% Last Modified by GUIDE v2.5 29-Dec-2014 00:03:54

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @MAIN_OpeningFcn, ...
'gui_OutputFcn', @MAIN_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before MAIN is made visible.


function MAIN_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to MAIN (see VARARGIN)

% Choose default command line output for MAIN


handles.output = hObject;

% Update handles structure


guidata(hObject, handles);

% UIWAIT makes MAIN wait for user response (see UIRESUME)


% uiwait(handles.figure1);
global A1;
global A2;
A1=0
A2=0

% --- Outputs from this function are returned to the command line.
function varargout = MAIN_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure


varargout{1} = handles.output;

function edit1_Callback(hObject, eventdata, handles)


% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit1 as text


% str2double(get(hObject,'String')) returns contents of edit1 as a double

% --- Executes during object creation, after setting all properties.


function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in pushbutton1.


function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global f;

global m

global m1

global m2

[f,p] = uigetfile({'*.mat'});
C=strcat(p,f);
set(handles.edit1,'string',C);
eeg=load(f);
x=eeg;
x=x';
x=x(1,:);
x=x';
y1=load(f);
y1=y1';
y1=y1(1,:);
y1=y1';
z1=isequal(x,y1);

l1=length(z1);
t1=-((l1-1)/2):1:((l1-1)/2);
t1=t1';

% plot(handles.axes1,t1,z1);
plot(handles.axes1,eeg.val)

data=load(f);
x=data;
x=x';
x=x(1,:);
x=x';

y1=load('1.mat');
y1=y1';
y1=y1(1,:);
y1=y1';
z1=isequal(x,y1);
m1=max(z1)
l1=length(z1);
t1=-((l1-1)/2):1:((l1-1)/2);
t1=t1';
y2=load('2.mat');
y2=y2';
y2=y2(1,:);
y2=y2';
z2=isequal(x,y2);
m2=max(z2);
l2=length(z2);
t2=-((l2-1)/2):1:((l2-1)/2);
t2=t2';

a=[m1 m2]
m=max(a)
% h=wavread('allow.wav');

% --- Executes on button press in pushbutton2.


function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global m

global m1

global m2

if m<=m1
%soundsc(wavread('1.wav'),50000)
set(handles.text2,'string','A')

mk
% soundsc(h,50000)
elseif m<=m2
%soundsc(wavread('2.wav'),50000)
set(handles.text2,'string','B')
%soundsc(h,50000)

EP
elseif m<=m3
%soundsc(wavread('3.wav'),50000)
set(handles.text2,'string','C')
% soundsc(h,50000)
elseif m<=m4
%soundsc(wavread('4.wav'),50000)
set(handles.text2,'string','D')
soundsc(h,50000)
elseif m<=m5
%soundsc(wavread('5.wav'),50000)
set(handles.text2,'string','E')
soundsc(h,50000)
elseif m<=m6
%soundsc(wavread('6.wav'),50000)
set(handles.text2,'string','F')
soundsc(h,50000)
elseif m<=m7
%soundsc(wavread('7.wav'),50000)
set(handles.text2,'string','G')
soundsc(h,50000)

elseif m<=m8
%soundsc(wavread('8.wav'),50000)
set(handles.text2,'string','H')
soundsc(h,50000)
elseif m<=m9
%soundsc(wavread('S1.wav'),50000)
set(handles.text2,'string','S1')
soundsc(h,50000)

else soundsc(wavread('S1.wav'),50000)
%set(handles.text2,'string','S1')
%soundsc(h,50000)
end

You might also like