BackgroundIn parallel to the introduction of mobile communication devices with high computational power and internet connectivity, high-quality and low-cost health sensors have also become available. However, although the technology does exist, no clinical mobile system has been developed to monitor the R peaks from electrocardiogram recordings in real time with low false positive and low false negative detection. Implementation of a robust electrocardiogram R peak detector for various arrhythmogenic events has been hampered by the lack of an efficient design that will conserve battery power without reducing algorithm complexity or ease of implementation.ObjectiveOur goals in this paper are (1) to evaluate the suitability of the MATLAB Mobile platform for mHealth apps and whether it can run on any phone system, and (2) to embed in the MATLAB Mobile platform a real-time electrocardiogram R peak detector with low false positive and low false negative detection in the presence of the most frequent arrhythmia, atrial fibrillation.MethodsWe implemented an innovative R peak detection algorithm that deals with motion artifacts, electrical drift, breathing oscillations, electrical spikes, and environmental noise by low-pass filtering. It also fixes the signal polarity and deals with premature beats by heuristic filtering. The algorithm was trained on the annotated non–atrial fibrillation MIT-BIH Arrhythmia Database and tested on the atrial fibrillation MIT-BIH Arrhythmia Database. Finally, the algorithm was implemented on mobile phones connected to a mobile electrocardiogram device using the MATLAB Mobile platform.ResultsOur algorithm precisely detected the R peaks with a sensitivity of 99.7% and positive prediction of 99.4%. These results are superior to some state-of-the-art algorithms. The algorithm performs similarly on atrial fibrillation and non–atrial fibrillation patient data. Using MATLAB Mobile, we ran our algorithm in less than an hour on both the iOS and Android system. Our app can accurately analyze 1 minute of real-time electrocardiogram signals in less than 1 second on a mobile phone.ConclusionsAccurate real-time identification of heart rate on a beat-to-beat basis in the presence of noise and atrial fibrillation events using a mobile phone is feasible.