Smart Phone Application Development for
Monitoring Epilepsy Seizure Detection based on EEG
Zakareya Lasefr, Ramasani Rakesh Reddy, and Khaled Elleithy
Department of Computer Science and Engineering
University of Bridgeport
Bridgeport, CT, USA
firstname.lastname@example.org, email@example.com, firstname.lastname@example.org
Automated epilepsy seizure detection is the solution to
the limitation and time consuming of manual epilepsy monitoring
and detection using EEG signals. In this paper we developed a
technique for epilepsy seizure detection using EEG signals. The
signal will be pre-processed and filtered using multiple filters.
Then, the filtered signal will be decomposed into sub-bands.
Furthermore, feature extraction is applied; we developed a
combined feature consists of combining three features into one.
Finally, we used well-known classifiers such as Support Vector
Machine (SVM), Artificial Neural Network (ANN), and K-Nears
Neighbor (KNN) to differentiate between epileptic and non-
epileptic signals, and we achieved an accuracy of 97%.
Furthermore, we developed an Android-based smartphone
application for monitoring epilepsy detection based on the
classification results of the EEG signal. A notification will be sent
to the patient, doctors, and family members when an epilepsy
seizure occurs. Once the EEG signal is classified as epileptic, the
App will display a visual notification indicating that Epileptic
Seizure has been detected. Moreover, it will trigger an alarm and
send a message notification to all associated phone numbers, and
the EEG signal will display on the App. Although we are using an
EEG signal from a dataset, we have generated both normal and
epileptic EEG signals using a waveform generator, and we have
displayed those signals on the spectrum analyzer for future real
time detection using our Android App.
Keywords—Digital Ocean Server, NGINX Server, python Flask.
Epilepsy is a neurological disorder disease that affects the central
nervous system of the human brain that can disrupt the activity of the
nervous cells in the brain which will result in unusual behavior that can
lead to loss of consciousness called epileptic seizure. The seizure can
endanger the life of the patient when driving, swimming, or performing
any other activities .
Today the smartphone based applications are being used for
solving human real life problems. And these applications play a
vital role in the health sciences for improving the ways of
treatment by introducing most promising methods. Epilepsy is a
serious and disorder behavior that affects 5% of the world
population, therefore, there is a need for developing an efficient
smart phone application that can monitor the behavior of an
epileptic patient as well as sending an immediate update to the
care takers . The main idea behind developing this android
application is to notify time to time behavior of epilepsy patients
as soon as possible to all the care takers . An immediate
medical assistance is needed when there is a seizure. The main
idea behind our android application is to give immediate
notification of spectrum signal and epilepsy state, and an alarm
is triggered based on it.
Android framework contains rich application based interface
which helps to build innovative apps which are useful in various
fields especially in health sciences. Android operation system is
built by modifying a Linux kernel, and the open source
methodology allows developers across the world to participate
and develop innovative applications for solving the real-life
This study has developed an android based application
which can give immediate notifications once a seizure occurs to
an epileptic patient so that s/he can get the proper medical
attention. The app provides the features such as sending an
immediate notification on seizure detection, showing the EEG
Spectrum of the patient state, the Epilepsy detected signal and
trigger an alarm to all registered care takers.
There are not many related works using methods involving
smartphone applications, or similar devices for epilepsy seizure
detection. Moreover, most of the existing devices require the
patient to wear some uncomfortable electrodes, and other
recording, or monitoring devices that will limit the movement of
the patient as well as making him/her uncomfortable.
In 2016 Luca Cattani et al. developed an android app for
neonatal colonic seizures detection based on the movement of
some body parts obtained from video and image processing. In
this paper, they have used a laptop in the background of the
processing as well as testing their technique on a colonic seizure
simulator and not on a real patient .
A method proposed by DeVaul, Barkalow et al. in 2006
where they have developed an algorithm to carefully monitor the
sleep activity for epilepsy detection . For unusual activity
during sleep, a live video recording is done to store the
information to be analyzed. However, this method lacks
immediate notification. The video based app records the video
for an abnormal event then processed. Processing the stored
videos may result in a delay in detecting the abnormal activity.
978-1-5386-1104-3/17/$31.00 ©2017 IEEE 83
This delay may cause dangerous situations. There are few
studies which suggest the use of Fitbit devices to notify the
abnormal seizure detection based on SMS and GPS alerts. The
studies lack compatibility with all the mobile versions and
operating systems available. Moreover, the cost of these devices
Another smartphone App development was introduced by
Stefan Madansingh et al. in 2015 for fall detection which was
based on analyzing the movement of the body using the
embedded sensors already available in the smartphone .
However, this technique does not provide any type of
notification or location.
Shih-Hau Fang et al. have implemented an android
smartphone app for fall detection based on three components;
sensing the accelerometers data from the phone embedded
sensor, learning the relationship between the fall behavior and
the collected data, and alerting the pre-configured contacts via
messages. They have achieved a sensitivity of 72.22% and a
specificity of 73.78%. have developed an android smartphone
app for fall detection for elderly people . Their algorithm was
implemented based on accelerometers available on the
smartphone to evaluate the performance of the robust
algorithms, rather than thresholding. Furthermore, their
application also provides GPS locations using the available GPS
interface on the phone as well as sending an email and SMS
We can conclude from the related work that most of the
developed applications are related to the fall detection rather
than the epilepsy seizure detection. Even though there is only a
few app development involving epilepsy seizure detection, they
are based on the body movement rather than EEG signals that is
the main source of epilepsy information.
The current application development consists of three main
modules namely a Login/Register, EEG Signal, and Visual and
Alarm Notification. All modules communicate through socket
events between App and server. All spectrum analyzer signals
and Alarm notifications are notified through an http POST
request notification to a Digital Ocean server. The Digital Ocean
Server utilizes the Http POST Response interface to get
notifications from the client device and GET Request between
App and the server.
The Spectrum Analyzer will upload the EEG signal onto a
Digital Ocean Http Web bases NGINX Server interface, that will
send a socket event notification to the app of a new upload. Once
the app receives a new notification, it retrieves the uploaded
EEG signal through a PULL notification and displays the signal.
The Alarm module triggers an alarm to all registered users and
care takers when there is a new notification from POSTMAN if
there is an epilepsy seizure in the signal. The Alarm module uses
Android Email notification interface available in Android APIs
to trigger and notify the alarm. Once the EEG signal has been
processed to detect epilepsy, a visual notification is sent through
a http POST request to determine whether an epilepsy seizure
Figure 1. Architecture diagram
The Architecture shown in Fig 1 involves three main
components namely Epilepsy Spectrum Device (EEG signal
classifier), Cloud SERVER, and Android Application.The cloud
SERVER conists of NGINX Http based Webserver and
Gunicorn Python based WSGI Server interfaced with Mongo
The deviceside can be a spectrum anlyzer or an EEG signal
classifier. The EEG classifier signals are matlab proceesed
samples of EEG signals. The devic-eside continuously monitors
the patient and updates the server if there is an epilypsy detected.
The Server componant is implemented on a machine running
continously on cloud service provided by Digital Ocean. A
server is implemented on Ubuntu machine running with Nginx
based Http web server. The server module also contains a
Gunicorn WSGI based server to monitor and maintain the data
received via Mongo Database.
The NGINX is based Http webserver that is based on
python, an open-source and high-performance HTTP server is
an IMAP/POP3 proxy server. NGINX is known for its high
performance, stability, rich feature set, simple configuration, and
low resource consumption.
Unlike traditional servers, NGINX doesn’t rely on threads
to handle requests. Instead it uses a much more scalable event-
driven (asynchronous) architecture. This architecture uses small,
but more importantly, predictable amounts of memory under the
The storage engine is the primary component of Mongo DB
that is responsible for managing data. Mongo DB provides a
variety of storage engines, allowing the user to choose one most
suited to your application.
The Android application involves a CONNECT phase
followed by a Capture and monitor phase. The client is basically
a care taker or doctor who installs the app, before the registration
process goes through a CONNECT phase between server and
Figure 2. Connection between APP and server
The connect establishment as shown in figure 2 is totally
based on socket connection. The Android application
implemented based on Android API 23 is compatible to all the
Android Lower level devices. When a user opens the app for a
socket connection request to the server, the Gunicorn server
responds back with event Connect_ok to the App. Once The App
establishes the connection with the server, it sends a Socket
Data_Request to the Server. The server parses the currnt
available data in csv format. The data is received from the device
that is posted throught the Http POST request in the form of the
jason format. The received jason format data is parsed and
posted to the application.
Figure 3. APP, server, and device connection
The Epilepsy device keeps monitor of the patient, and when
there is an epilepsy signal detected, the device captures the
signal and sends an Http POST Request to the Server with csv
data of the graph in the format of Jason. The received data is
stored in the Mongo Storage and parses data. Once the data is
parsed, it sends a socket update event to the application. The app
which is waiting for Update Event, sends an Http GET Request
to the server to indicate that app is ready to receive the data and
display the graph. See figure 3.
The Alarm modules helps to send an immediate email based
notification to the registered care takers of the patient. The
Alarm module also sends an alarm to itself when a seizure
occurs. The Alarm module uses Android Email notification
interface available in Android APIs to trigger and notify the
alarm. Once the EEG signal has been processed to detect
Epilepsy, a Visual Notification is sent through an Http POST
request to determine whether an epilepsy seizure is occurred.
The app requires the user to signup first and then activate the
verification link. This helps to send immediate notification of
epilepsy seizure and alarm to all the registered clients through
the email id notification. Sign up/login screen can be seen in
Figure 4. Login/Sign up screen
The spread spectrum device basically monitors and saves the
EEG spectrum in csv format. Each client or the care taker who
installs the app receives the http response from the server in the
form of Jason data, parses the data to signal, and displays the
same. Android application utilizes the mkphil graph interface
available to convert the csv data to the graph. The converted
graph is as below in figure 5.
Figure 5. EEG Signal
During the registration process the app keeps track of the
users who needs to be notified with the alarm when there is a
new epilepsy seizure detected. The alarm is notified as shown in
Figure 6. Alarm upon seizure occurrence
The seizure position and the EEG signal status can be viewed
immediately through the app pic process as shown in figure7.
Once the EEG signal has been processed to detect Epilepsy, a
Visual Notification is sent through an http POST request to
determine whether an epilepsy seizure is occurred.
Figure 7. EEG signal
Although there are not many researches that involve
smartphone application in epilepsy seizure detection, we have
compared our proposed work to the most relevant methods that
we found after a comprehensive research. It is clear from table 1
that our proposed method has outperformed the existing
methods because it is based on EEG signals as well as of the
features that it provides.
APP Author Method Features
No real patient.
Fang et al.
Lasefr et al.
for real time
Table 1. Comparison table
Figure 7 shows the MindWave Mobile EEG Headset which
is available in the market for only $100. This device records the
EEG signal from the brain and sends it to any device via
Bluetooth. In our final App development we are using the EEG
signals collected from the MindWave Mobile EEG Headset and
process it on the modified APP in order to detect epilepsy
seizure. Such an improvement would result in faster, and more
reliable epilepsy seizure detection using only a very light
weight as well as low cost Bluetooth headset, and a smartphone.
We believe that our research would benefit all epileptic patients
as well the researchers in the field of epilepsy.
This device was used and tested in a research by Khald
Aboalayon et al for a development of a sleep stages
classification technique using EEG signal, and has proven to be
very accurate, and effective in their real time experiment
obtaining a high accuracy .
Figure 7. MindWave Mobile EEG Headset
We developed an APP that monitors the behavior of epileptic
patients based on EEG processing and classification. The APP
is connected to the classification procedure through the sever,
and updates the results instantly whenever a new signal is
processed. Upon classification completion, an alarm will be
triggered should an epilepsy seizure detected.
The future work involves replacing the spectrum device with
a Bluetooth device that is attached to the patient, and sends an
EEG signal resulting in more compatible, and generalized
solution for better and faster seizure detection. The
improvements in the APP involves location detection using
google maps, and triggering an alarm as well as sending the
location of the patient to the caretakers. The seizure detection
will be based solely on signals collected from the attached
Bluetooth device, and also on the process of the signal on the
APP itself without the need to any other device. As a result, the
APP would be an efficient time saving epileptic seizure
 J. F. Wernicke, K. C. Holdridge, L. Jin, T. Edison, S. Zhang, M.
E. Bangs, et al., "Seizure risk in patients with attentiondeficit
hyperactivity disorder treated with atomoxetine," Developmental
Medicine & Child Neurology, vol. 49, pp. 498-502, 2007.
 F. Bert, M. Giacometti, M. R. Gualano, and R. Siliquini,
"Smartphones and health promotion: a review of the evidence," J
Med Syst, vol. 38, p. 9995, Jan 2014.
 C. Thompson, J. White, B. Dougherty, A. Albright, and D. C.
Schmidt, "Using smartphones to detect car accidents and provide
situational awareness to emergency responders," in International
Conference on Mobile Wireless Middleware, Operating Systems,
and Applications, 2010, pp. 29-42.
 L. Cattani, H. P. Saini, G. Ferrari, F. Pisani, and R. Raheli,
"SmartCED: An Android application for neonatal seizures
detection," in 2016 IEEE International Symposium on Medical
Measurements and Applications (MeMeA), 2016, pp. 1-6.
 R. DeVaul, D. Barkalow, J. Carlton-Foss, and C. Elledge,
"Method and system for fall detection and motion analysis," ed:
Google Patents, 2006.
 S. Madansingh, T. A. Thrasher, C. S. Layne, and B. C. Lee,
"Smartphone based fall detection system," in 2015 15th
International Conference on Control, Automation and Systems
(ICCAS), 2015, pp. 370-374.
 S. H. Fang, Y. C. Liang, and K. M. Chiu, "Developing a mobile
phone-based fall detection system on Android platform," in 2012
Computing, Communications and Applications Conference,
2012, pp. 143-146.
 G. Yavuz, M. Kocak, G. Ergun, H. O. Alemdar, H. Yalcin, O. D.
Incel, et al., "A smartphone based fall detector with online
location support," in Proceedings of the International Workshop
on Sensing for App Phones, Zurich, Switzerland, 2010, pp. 31-35.
 K. A. I. Aboalayon, M. Faezipour, W. S. Almuhammadi, and S.
Moslehpour, "Sleep stage classification using EEG signal
analysis: a comprehensive survey and new investigation,"
Entropy, vol. 18, p. 272, 2016.