1st Annual IEEE Healthcare Innovation Conference of the IEEE EMBS Houston, Texas USA, 7 - 9 November, 2012

Implementing a Real-Time Seizure Detection Application on a Smartphone as part of a Multi-Modal Platform Sai R. Gouravajhala, David Wang, Lunal Khuon, Member, IEEE, Forrest S. Bao, Member, IEEE, Sarvesh Kulkarni, Member, IEEE

Abstract²We present a smartphone implementation of a novel Android application as part of a real-time multi-modal seizure detection platform. We first provide an overview of the detection platform, and then describe the features of the Android application, including its usage. We then outline the DSSOLFDWLRQ¶V LPSOHPHQWDWLRQ Rn an Android smartphone and SUHVHQW UHVXOWV RI WKH SODWIRUP¶V RYHUDOO SHUIRUPDQFH LQFOXGLQJ examples of output from the sensors, sensor board, and the application. Keywords: Android application, epilepsy, smartphones, seizure algorithm, multi-modal, Arduino.

application, or EpSMART app. We are not aware, to our best knowledge, of any existing implementation of a mobile app-based EEG or multi-modal sensor system for real-time seizure detection. The rest of the paper is organized as follows: in section II, we give an overview of the current platform implementation; in section III, we discuss the EpSMART app; then, in section IV, we outline our testing methodology, and finally in VHFWLRQ 9 ZH SURYLGH UHVXOWV RI WKH DSS V\VWHP¶V performance running on a smartphone.




HE automatic detection of an array of medical conditions, such as epileptic seizures, based on continuous monitoring of physiological signals is an integral goal of modern healthcare. Systems that can classify such conditions based on real-time data can be invaluable tools to improve the quality of life for users. Indeed, epilepsy affects DOPRVW RI WKH ZRUOG¶V SRSXODWLRQ > @ ZKLFK PHDQV millions of people are in need of novel treatments and detection systems. Most current methods of detecting epileptic seizures use only electroencephalography (EEG) [2]. However, it has been shown by [3] that monitoring other physiological manifestations of a seizure is more advantageous for detecting seizures than just using a singlemodality method. Moreover, these detection systems need to be as inconspicuous as possible, to remove stigma from their usage, yet must be powerful enough so that accuracy is maintained. In this paper, we present the smartphone implementation of the Epileptic Seizure Monitoring with Alerts in Real Time

Manuscript received September 05, 2012. S. R. Gouravajhala is with the Villanova Biomedical Electronics Laboratory (ViBE) at Villanova University, Villanova, PA, 19085 USA (e-mail: [email protected]). D. Wang is with the Electrical and Computer Engineering Department, Villanova University, Villanova, PA, 19085 USA (email: [email protected]). L. Khuon is the Director of ViBE and a professor in the Electrical and Computer Engineering Department, Villanova University, Villanova, PA, 19085 USA (email: [email protected]). F. S. Bao is with both the Department of Psychiatry and Behavioral Sciences at Stony Brook University, Stony Brook, NY USA 11795, and with the Department of Computer Science at Texas Tech University, Lubbock, Texas, 79409 USA (email: [email protected]). S. Kulkarni is a professor in the Electrical and Computer Engineering Department, Villanova University, Villanova, PA, 19085 USA (email: [email protected]).

A diagram representing our current platform implementation can be seen in Figure 1. There are three major components to the platform: sensors to acquire the physiological signals, a microcontroller-based sensor board to perform feature extraction and data communication to the smartphone, and a smartphone that runs seizure detection and automatic caregiver notification. A. Physiological Sensors In addition to gathering EEG data, it is advantageous to monitor other physiological changes that are brought about by the clinical manifestation of a seizure. Indeed, it has been shown that changes in heart rate, electrodermal activity, and certain patterns of motion are indicators of seizure activity [4]. Hence, in addition to EEG, we have sensors for electrocardiography (ECG), galvanic skin response (GSR), accelerometer, and gyroscope. A commercially available ArduIMU module (SparkFun Electronics) provides 3-axis accelerometer and 3-axis gyroscope data for motion and orientation, respectively, for

Fig. 1. An overview of the multi-modal seizure detection platform. The sensor board gathers data from the physiological sensors (in both digital and analog form), performs feature extraction, and sends those features to the smartphone via Bluetooth wireless communication.


all three axes. The module provides digital outputs for both sensors and samples the raw data at a rate of 70 Hz. In order to compensate for drift with the accelerometer and gyroscope, a magnetometer, also embedded on the ArduIMU, is used for drift correction. Figure 2, left, shows raw data from the 3-axis accelerometer that indicates a free fall with a spike in the z-direction. The ECG sensor is implemented using a 3-lead system: electrodes are placed on the left and right inside elbows, using the chin as a reference. An instrument amplifier and discrete filter amplifies the differential ECG signal and removes noise and power-line interference, respectively, before outputting the signal to the sensor board for analogto-digital conversion. An example of the processed ECG sensor acquisition data is shown in Figure 2, middle. The GSR sensor consists of a voltage divider and captures voltage differences between two electrodes placed on the fingertips. Its continuous voltage level outputs also feed into an analog-to-digital converter on the sensor board. We gather EEG data from Neurosky Inc.¶V MindSet, a lowcost commercially available brain-computer interface headset. The MindSet measures EEG potentials from a single-channel dry electrode placed on the forehead, using the ear as reference, and outputs raw waveforms in digital form. An example of a captured and filtered EEG signal can be seen in Figure 2, right. B. Sensor Board The sensor board consists of an Arduino Mega 2560, whose ATmega2560 microcontroller performs data acquisition and feature extraction for the sensors. Once the features from each sensor are calculated, they are then transmitted over a Bluetooth wireless channel to the smartphone. The transfer process is done via serial UART, using the BlueSMiRF Silver Mate module (SparkFun Electronics). Features of interest for each sensor are then extracted from the digitized data: heart rate from ECG (by using the R-R interval), sudden changes from baseline in GSR (using a five-point moving average), motion detection from accelerometry, and orientation changes from gyroscope. C. Smartphone Our implementation uses an Android operating system (OS) smartphone, the Droid X, which operates on a

consumer network with 3G connectivity, Wi-Fi, Bluetooth, and GPS capability. The EpSMART app realizes a multimodal seizure detection platform as described in [4]. However, this hardware system is intentionally modular in design and may be used for physiological monitoring, symptom detection, and emergency notification in any number of critical medical applications, such as continuous EEG monitoring of acute ischemic stroke [5] or arrhythmic syncope [6]. In such cases, only the particulars, such as the features extracted from the relevant sensors (such as EEG or ECG) and the classification algorithm need be changed. III. EPSMART APPLICATION The EpSMART app implements a seizure detection algorithm on an Android OS. In this section, we provide the basis for this algorithm and a justification for our selection of WKH $QGURLG 26 :H WKHQ GHVFULEH WKH DSS¶V IHDWXUH DQG usage and the functionality of its alert system as demonstrated on the networked smartphone. A. Seizure Detection Algorithm As described in [7], our detection algorithm utilizes a support vector machine (SVM) to classify seizure events using EEG data. We develop Java code, following the example of [8] which had implemented the approach in C code using the LibSVM libraries [9]. Although the current classifier uses only features from the EEG, we plan on incorporating the available features from ECG, GSR, accelerometer, and gyroscope. This way, we can further improve upon the accuracy and specificity of the algorithm. With regards to the EEG-based detection algorithm, publicly available seizure and non-seizure data from the University of Bonn, Germany, were used to distinguish between the two events [10]. The Bonn data, which consists of 500 total files, were equally divided into two sets: ³WUDLQLQJ´ DQG ³WHVWLQJ ´ 7KH FODVVLILHU LV WUDLQHG RQ WKH GDWD contained in tKH ³WUDLQLQJ´ VHW ZKLFK WKHQ SURGXFHV D ³WUDLQVHW PRGHO ´ 7KLV RIIOLQH WUDLQLQJ ZDV GRQH XVLQJ Matlab. Then, eDFK GDWD ILOH IURP WKH ³WHVWLQJ´ JURXS ZDV then classified by the Android app as either having a ³VHL]XUH´ RU ³QRQ-seizure´ based on the trainset model. The EEG feature vectors that were used for training are standard deviation over mean, variance, and mean of the power spectral density (PSD) [7].

Fig. 2. Left: Absolute values of accelerometer data in all three axes. The module was held upright and then let go, so the large spike around t=3.5s shows the G force due to deceleration. Middle: Processed ECG data. Note that, because we are only interested in the R-R interval for heart rate, we processed the positive waveform. Right: EEG values from the MindSet after being processed with a low-pass 40 Hz digital filter within the Android app.


B. Android OS Though there are a lot of mobile phone environments (Apple iOS, Google Android, RIM Blackberry, and Microsoft Windows Phone), we decided to go with developing an app for the Android OS. We appreciated the open-source nature of the OS, along with the ease of use for application development, as Google provides a plethora of free resources. The app itself was written using the Java programming language for smartphones running Android version 2.3, codenamed ³Gingerbread´ GB), which can be found on almost 60% of the current Android devices [11]. C. Features and Usage 7KH DSS¶V XVHU LQWHUIDFH 8, FRQsists of a series of clickable buttons that perform actions and labels that show various status messages (see Figure 3, left). When the app is ILUVW VWDUWHG WKH XVHU LV SUHVHQWHG ZLWK ILYH EXWWRQV ³6WDUW %RWK 'HYLFHV ´ ZKLFK FRQQHFWV WR WKH 0LQG6HW DQG Whe $UGXLQR VHQVRU ERDUG ³%HJLQ 'DWD 3URFHVVLQJ ´ ZKLFK VWDUWV WKH GDWD SURFHVVLQJ V\VWHP ³:ULWH 'DWD WR )LOH ´ ZKLFK writes filtered EEG data, along with calculated features, to a ILOH RQ WKH 6HFXUH 'LJLWDO 6' FDUG ³5HDG IURP )LOH ´ which reads the aforementioned file; and finally, ³'LVFRQQHFW $OO ´ ZKLFK WHUPLQDWHV DOO FRQQHFWLRQV The Bluetooth data transmission uses the radio frequency communication (RFCOMM) protocol to communicate with both the Arduino and the MindSet. This communication, along with the EEG features calculation, takes place in background threads, so that the main UI continues to run smoothly. $IWHU WKH ³%HJLQ 3URFHVVLQJ´ EXWWRQ LV SUHVVHG WKH DSS begins to perform several tasks: collects HLJKW VHFRQGV¶ ZRUWK of raw EEG values, extracts features, and performs a classification. The app also simultaneously acquires features from the Arduino and displays that information on the screen. For instance, based on the heart rate, the heart rate VWDWXV PHVVDJH VKRZV ³$ERYH QRUPDO ´ ³1RUPDO ´ RU ³%HORZ QRUPDO ´ ,Q D VLPLODU YHLQ PRWLRQ DQG *36 VWDWXVHV DUH DOVR

displayed. See Figure 3, middle. For the latter, we use assisted GPS (AGPS) capability, where the location information is obtained from the cellular network instead of from the standalone GPS chipset. Using AGPS is optimal: time to first fix for the location is extremely short (because nearby cell towers have already identified relevant overhead satellites), power consumption is drastically reduced (which then saves battery life), and locations can be acquired even while indoors. Every ten minutes, the application requests a location update from the cellular network. Using reverse geocoding, the updated GPS coordinates are then resolved to a street address. Both the coordinates and the street address are then displayed to the user. D. Alert System As soon as a seizure is detected, the app immediately deploys a comprehensive alert system that begins several tasks: displays a dialog notifying the user that a seizure had been detected (and also gives an option to cancel the alert system, in case of a false alarm), along with flashing the background red for a visual indicator; gets the most up-todate GPS location and sends those coordinates, along with the reverse geocoded address, via SMS messages to the caregivers/providers. Using the Android framework, the app not only tracks whether the SMS messages are successfully sent, but also whether they are delivered to the recipient. If either of the two cases is unsuccessful, the app resends the SMS messages; writes calculated EEG features for 60 seconds, along with writing the incoming features from the sensor board, to a file on the SD card. Once the file is created, the app then sends an email to the caregivers/providers with the file attached, so that the healthcare team will have access to the important data before they see the user. The email code is based on [12] and leverages the functionality of JavaMail API: the email sent uses the Secure Socket Layer (SSL) protocol and is authorized by GooJOH¶V *PDLO VHUYHUV PDNLQJ WKH VHQGLQJ process secure. Emails can be sent to multiple recipients at

Fig. 3. Screenshots of the application when running on the smartphone. Left: The user interface as soon as the app is first started. Middle: Once the app is running, the user can see various status messages on screen. Right: An example of what happens when a seizure is detected. The alert system is cancellable in case of a false alarm.


the same time, which coupled with the SMS, makes for immediate notifications to the caregivers. All of the above takes place automatically, with no user intervention required. To get immediate help, the app plays a loud alarm when a seizure is detected, so that any nearby persons can come to the aid of the user. We chose an audio file that starts off quietly and gradually increases in volume, as this allows for the user to cancel the audio alarm in case of a false alarm. Indeed, in case of a false alarm, the user can simply press a button to cancel the entire alert system, as well as send a follow up text to the caregivers, telling them to disregard the previous emergency SMS. For example, see Figure 3, right. IV. TESTING METHODOLOGY Each component of the platform was individually tested to verify proper performance before whole scale testing was conducted. Sensor data were compared with the features outputted from the sensor board, to make sure that feature extraction was accurate. For example, the calculated heart rate was compared with the raw ECG signal to make sure it matched with a raw count of pulses. The accelerometer and gyroscope features were tested in a similar fashion. After the offline training, the SVM trainset model file (outputted by the Matlab training) was uploaded onto the SKRQH¶V 6' FDUG, after which detection can take place. Data from the Bonn file set were used as the input EEG for testing the classification functionality of the app. This allows for easy comparison, as the file set is pre-labeled as either ³VHL]XUH´ RU ³QRQ-VHL]XUH ´ 7KH RYHUDOO SHUIRUPDQFH RI WKH SVM algorithm on the smartphone was then compared with the performance of the original Matlab algorithm. In a similar manner, the other features of the app were tested, including the real-time status updates. To test the functionality of the app when a seizure is detected, we used a file from the Bonn daWD¶V VHL]XUH VHW DV WKLV ZRXld activate the alert system, namely the SMS and email functionality. V. RESULTS Initial testing on the networked Droid X smartphone shows that the EpSMART app works well and shows promising results, both in terms of the detection algorithm and the extensive alarm system. Raw data from the sensors are read into the sensor board. After analog-to-digital conversion of the relevant sensors, features are extracted from the data. These features are then transferred to the smartphone via wireless Bluetooth. Once the app is started, it performs classification based on real-time EEG data. The user interface is also updated in real-time, allowing the user to see all the status information on one screen. The GPS, SMS, and email functionality all work as expected: as soon as a seizure is detected, the SMS and emails (with file attachment) are sent, with little lag in time. When data from the Bonn set were used in real-time, instead of the MindSet values, the decision outputs from the Android Java implementation were consistent with those found using the Matlab implementation.

VI. CONCLUSION AND FUTURE WORK In this paper, we report on a work in progress of the development and testing of an Android application-based multi-modality seizure detection system running on a smartphone, with encouraging results. The entire system is modular in design, so the addition of sensors and features to be calculated can be easily accomplished in the future. Future work will be three-pronged: improving sensor design, including developing our own EEG sensor to remedy specific limitations inherent to the off-the-shelf EEG sensor we had used; bolstering seizure classification by taking into account the additional sensor modality features; finally, adding more capability to the Android app, such as including automatically saving calculated features to an online database for easy retrieval by the clinicians, adding a fall detection algorithm, logging raw sensor data to an SD card on the sensor board in the event of a seizure detection, and adding an epilepsy diary functionality. ACKNOWLEDGMENT We would like to thank Dr. Pritpal Singh, ECE Dept. Chair at Villanova University, for helping to fund some of our work. We would also like to thank Dr. Vijay Gehlot for providing us with the Droid X and network access. REFERENCES [1]

J. Engel Jr. et al., Epilepsy: Global Issues for the Practicing Neurologist, New York: Demos Medical Publ., 2005, ch. 1, pp. 6-8. [2] R. Flink et al. ³*XLGHOLQHV IRU WKH XVH RI ((* PHWKRGRORJ\ LQ WKH GLDJQRVLV RI HSLOHSV\ ´ Acta Neurologica Scandinavica, vol. 106, pp. 1±7, 2002. [3] I. Conradsen et al. ³6HL]XUH RQVHW GHWHFWLRQ EDVHG RQ D XQL- or multiPRGDO LQWHOOLJHQW VHL]XUH DFTXLVLWLRQ 8,6$ 0,6$ V\VWHP ´ LQ 32nd IEEE EMBS Conf., Buenos Aires, Argentina, 2010, pp. 3269-3272. [4] S. R. GourDYDMKDOD DQG / .KXRQ ³$ PXOWL-modality sensor platform DSSURDFK WR GHWHFW HSLOHSWLF VHL]XUH DFWLYLW\ ´ Annu. Northeast Bioeng. Conf., Philadelphia, USA, 2012, pp. 232-233. [5] K. * -RUGDQ ³(PHUJHQF\ ((* DQG &RQWLQXRXV ((* 0RQLWRULQJ LQ Acute Ischemic StrokH ´ Journal of Clinical Neurophysiology, vol. 21, no. 5, pp. 341-352, Oct. 2004. [6] M. Brignole and D. * %HQGLWW ³3URORQJHG $PEXODWRU\ (&* 'LDJQRVWLF 0RQLWRULQJ « &XUUHQW DQG (YROYLQJ ,QGLFDWLRQV ´ LQ Syncope, London, England: Springer, 2011, ch. 8, pp. 107-125. [7] & + 6HQJ 5 'HPLUOL / .KXRQ DQG ' %ROJHU ³6HL]XUH GHWHFWLRQ LQ ((* VLJQDOV XVLQJ VXSSRUW YHFWRU PDFKLQHV ´ LQ Annu. Northeast Bioeng. Conf., Philadelphia, USA, 2012, pp. 231-232. [8] 7 &DPLVH ³$GDSWDWLRQ RI 690-based seizure detection for a realWLPH & HPEHGGHG V\VWHP ´ ,QGHSHQGHQW 6WXG\ 'HSW (OHF DQG Comput. Eng., Villanova Univ., Villanova, PA. [9] C.-C. Chang and C.-J. Lin, ³/,%690: a library for support vector PDFKLQHV ´ ACM Transactions on Intelligent Systems and Technology, vol. 2, issue 3, 2011. [10] R. G. Andrzejak et al. ³Indications of nonlinear deterministic and finite dimensional structures in time series of brain electrical activity,´ Phys. Rev. E, 64, 061907, Dec. 2001. [11] Android Developers. ³3ODWIRUP Versions´ >2QOLQH@, Aug. 2012. Available: http://developer.android.com/about/dashboards/index.html [12] - 6LPRQ ³6HQGLQJ HPDLOV ZLWKRXW XVHU LQWHUYHQWLRQ QR ,QWHQWV LQ $QGURLG´ >2QOLQH@ 0D\ $YDLODEOH DW http://www.jondev.net/articles/Sending_Emails_without_User_Interve ntion_(no_Intents)_in_Android


Implementing a Real-Time Seizure Detection ...

conditions based on real-time data can be invaluable tools to improve the quality of life for users. Indeed, epilepsy affects almost 1% of the world's population [1], which .... Though there are a lot of mobile phone environments. (Apple iOS, Google Android, RIM Blackberry, and. Microsoft Windows Phone), we decided to go ...

462KB Sizes 1 Downloads 210 Views

Recommend Documents

Seizure Detection and Advanced Monitoring Techniques
analysis (e.g., power analysis, linear orthogonal transforms, and parametric linear ... Information on the start time and the sampling rate of the data collection can.

Seizure Detection and Advanced Monitoring Techniques
analysis (e.g., power analysis, linear orthogonal transforms, and parametric linear ... Information on the start time and the sampling rate of the data collection can.

Seizure Detection Using Dynamic Warping for Patients ...
similar results when we add the amplitude range, ra, into the classifier. Therefore ... role of the individual EEG 'signature' during seizures. This property ... [13] G. L. Krauss, The Johns Hopkins Atlas of Digital EEG: An Interactive. Training Guid

Non-parametric early seizure detection in an animal model of temporal ...
Feb 27, 2008 - or the degree of 'roughness' in the signal. .... a frequency of 50 Hz and with a pulse duration of 1 ms and ..... Abbreviations used in the text.

Seizure Action Plan.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps. ... of the apps below to open or edit this item. Seizure Action Plan.pdf.

Seizure Parent-Questionnaire.pdf
Protect head. Keep airway open/watch breathing. Turn child on side. B. A. S. I. C. S ... Medication Dosage Administration Instructions (timing* & method**) What to do after administration: * After 2nd or 3rd seizure, for cluster of seizure, ... Seizu

Non-parametric early seizure detection in an animal model of temporal ...
Feb 27, 2008 - Online at stacks.iop.org/JNE/5/85. Abstract. The performance ..... Seizures were identified by review of technician logs and visual inspection of ...

Medical 12. Seizure Action Plan.pdf
Page 2 of 2. 6/14. Student's Name: Birthdate: Medical Treatment prescribed if a seizure occurs. o Vagus Nerve stimulator: Swipe magnet over device (device is ...

Seizure Training for School Personnel.pdf
Page 2 of 30. 2. Objectives. z Recognize common seizure types and. their possible impact on students. z Know appropriate first aid. z Recognize when a seizure ...

Oxygen and seizure dynamics: I. Experiments
Mar 5, 2014 - novel ratiometric nanoquantum dot fluorescence resonance energy ..... measurements may be an alternative to multiple microscopic single cell ...

Convex Cut: A Realtime Pseudo-Structure Extraction ...
Convex Cut: A Realtime Pseudo-Structure Extraction Algorithm for 3D Point Cloud Data. ChangHyun Jun1, Jihwan Youn1, Jongmoo Choi2, Gérard Medioni2, ...

Realtime HTML5 Multiplayer Games with Node.js - GitHub
○When writing your game no mental model shift ... Switching between different mental models be it java or python or a C++ .... Senior Applications Developer.

Face Detection Methods: A Survey
IJRIT International Journal of Research in Information Technology, Volume 1, Issue 11, November, 2013, Pg. 282-289 ... 1Student, Vishwakarma Institute of Technology, Pune University. Pune .... At the highest level, all possible face candidates are fo

Learn to Write the Realtime Web - GitHub
multiplayer game demo to show offto the company again in another tech talk. ... the native web server I showed, but comes with a lot of powerful features .... bar(10); bar has access to x local argument variable, tmp locally declared variable ..... T

September-November 2017 TheTenthKnot.net. SEPTEMBER. OCTOBER. Page 1 of 1. ADOW-realtime-reading-2017.pdf. ADOW-realtime-reading-2017.pdf.

computers and portable devices to be played in their homes or on the go. .... lated cost matrix and the path through this matrix does not scale efficiently for large ...

Computer search and seizure issues in Internet crimes against ...
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the ... Computer search and seizure issues in Internet crimes against children cases.pdf. Computer search and seizure issues in Internet ...

Seizure prediction using FFT, eigen values of correlation ... - GitHub
Email: {francisco.zamora, malmaraz, pbotella, juaparal}@uch.ceu.es ... This is the most important kind of proposed features, obtaining the best standalone result.

Implementing a community engagement model
identified healthcare professional in the PCT and every GP practice who is responsible. – and provides leadership – for the local childhood immunisation programme'.1. We have an identified lead GP for our area and we are developing an active clin

Prevention Prevention and Detection Detection ...
IJRIT International Journal of Research in Information Technology, Volume 2, Issue 4, April 2014, Pg: 365- 373 ..... Packet passport uses a light weight message authentication code (MAC) such as hash-based message ... IP Spoofing”, International Jo

Implementing a community engagement model
services are in place to support childhood immunisation ... children, not only to support early immunisation ... the actions to be taken is to 'consider home visits to ...

Implementing a Hardware Accelerated Libretro Core - GitHub
May 10, 2013 - The frontend takes this rendered data and stretches to screen as ... at least as big as declared in max width and max height. If desired, the FBO ...