Biomedical Research

Research Article - Biomedical Research (2017) Volume 28, Issue 22

Intelligent healthcare system using an Arduino microcontroller and an android-based smartphone

Sheng-Ta Hsieh1 and Chun-Ling Lin2*

1Department of Communication Engineering, Oriental Institute of Technology, New Taipei City, Taiwan

2Department of Electrical Engineering, Ming Chi University of Technology, New Taipei City, Taiwan

*Corresponding Author:
Chun-Ling Lin
Department of Electrical Engineering
Ming Chi University of Technology, Taiwan

Accepted on October 18, 2017

Visit for more related articles at Biomedical Research


In this study, we combined an Arduino microcontroller with an Android-based smartphone to develop an intelligent healthcare system and provide elderly patients with the comfort of medical services at home. We developed a JAVA-based application with a built-in automatic warning system that can provide real-time, dynamic detection of vital signs. Furthermore, we developed an improved electrocardiogram R-peak detection method by using the artificial bee colony (ABC) algorithm. The system can identify high blood pressure, low blood pressure, fever, and tachycardia bradycardia. The proposed system sends text messages to the elderly patient’s family and doctor in case of an unusual event. Because previous research suggests that blood pressure can be more accurately determined when measured twice a day, the system can set an alarm to remind the user to record their blood pressure. The results revealed that the ABC algorithm can rapidly determine the parameters for R-peak detection and is highly accurate. In addition, the results of clinical trials reveal that the proposed system can achieve a high level of accuracy in identifying and detecting unusual events. The proposed system not only saves medical resources but also enables elderly people to care for themselves, thereby promoting their health.


Healthcare, Arduino, Android, Electrocardiogram (ECG), Blood pressure monitoring, Temperature detection, Heart rate.


The implementation of universal health insurance has changed medical behavior in Taiwan. Because of advances in medical technology and an increase in national income, the life expectancy at birth in Taiwan is gradually rising. Therefore, aging has become a widespread social phenomenon. According to the Ministry of the Interior, the number of people aged 65 years and older reached 2,868,163 (12.22% of the population) in June 2015 [1]. Along with a swift decline in the fertility rate, population aging is a serious challenge for Taiwan. In the future, the healthcare system will become even more crucial, because most elderly people require a high level of care and the population of elderly people with disabilities is expected to grow rapidly.

Home-based long-term care is a key government policy, a major part of which is the development of “Tele-Home Care” (THC). THC provides family caregivers with the physiology and living information of elderly patients through their mobile phones and Internet devices, and can thereby reduce the cost of national health insurance and help people stay and live at home as independently as possible [2-5]. In the development of THC, several previous studies have proposed that remote health monitoring combine information technology with medical technology [5-8]. In 2010, Wang et al. [9] proposed a micromonitoring network comprising a monitoring center and ZigBee sensor nodes. A sensor node uses a central controller to monitor the patient and collect physiological data. The collected data is sent to the ZigBee wireless telecommunication module, which is connected to the sensor through an RS232 serial port. The wireless module then sends the data to an embedded monitoring terminal (or PC device). Professional medical staff can monitor the statistical analysis data and provide the necessary advisory services, remote medical monitoring, and treatment. However, the current monitoring systems in hospitals are based on cable connections, and are large and involve considerable power consumption. These systems are therefore unsuited to real-time, continuous, longterm monitoring of important parameters at home.

In this paper, we present an intelligent healthcare system that can measure blood pressure and detect temperature and Electrocardiogram (ECG) signal through an Arduino microcontroller. The measurement data can be delivered to a smartphone through Bluetooth. In the smartphone, a JAVAbased application with a built-in automatic warning expert system can provide real-time dynamic detection of vital signs. In addition, an improved ECG R-peak detection method using the artificial bee colony (ABC) algorithm was developed. After estimation is conducted by the expert system, the smartphone can immediately send a detailed notification to the family of the elderly person. This system can provide convenient, lowcost, real-time interpretation, and reduce the burden of medical staff.


Data acquisition unit

The proposed healthcare system uses Arduino UNO (Arduino SRL Company, Italy) and e-Health Sensor Shield V2.0 (Cooking Hacks). Arduino is an open-source platform for building electronic projects. It comprises both a physical programmable circuit board and a piece of software, or an integrated development environment that can execute on a computer and through which the user can write and upload computer code to the physical board. The Arduino UNO is a microcontroller board based on the ATmega328P and has 14 digital input/output pins, six analog inputs, a 16 MHz quartz crystal, and a USB connection.

The e-Health board can be connected with many sensors, including a sphygmomanometer, temperature sensor, and ECG machine, providing vital human parameters. The e-Health Sensor Shield collects information from the sensor and transmits it to the Arduino UNO, which transfers the data to mobile devices via Bluetooth. This study established a JAVAbased expert system; when the mobile devices receive data, the system analyses the data and determines whether the patient’s health condition is normal. Figure 1 shows the components of the proposed healthcare system.


Figure 1: Components of the healthcare system: (A) Arduino UNO, (B) e-Health sensor shield V2.0, (C) ECG sensors, (D) temperature sensor, (E) sphygmomanometer, (F) Bluetooth.

Improved ECG R-peak detection method using ABC algorithm

The previous R-peak detection method included the difference operation method [10], defined variant threshold [11], wavelet transforms [12,13], real-time algorithm [14], and adaptive thresholding [15]. In 2013, an optimized knowledge-based R detection algorithm was proposed by Elgendi [16]; this algorithm can achieve highly accurate R-peak detection. It comprises three stages: band-pass filter, blocks of interest, and threshold. A previous study used the knowledge-based theory to determine the parameters (F1, F2, W1, W2, and β) of these three stages. Although highly accurate R-peak detection was achieved in this study [16], the knowledge-based theory was time-consuming. Therefore, the present study adopted the ABC to replace the knowledge-based theory. The main goal of this study was to use the ABC algorithm to estimate the parameters in the proposed QRS peaks algorithm [16] and then detect R peaks. Figure 2 shows the structure of the proposed R-peak detection algorithm.


Figure 2: Flowchart of ABC algorithm for R-peak detection.

ABC algorithm: The ABC algorithm was proposed by Karaboga in 2005 [17]. ABC is a swarm intelligence algorithm inspired by the foraging behavior of bee colonies. The advantages of ABC include fewer control parameters and ease of realization. Three types of bees exist in an ABC: employed, onlooker, and scout bees. The employed bees exploit the food sources and provide quality information on them to the onlooker bees. The onlooker bees then choose a food source to exploit depending on the nectar quality. The more nectar the food source contains, the higher is the probability that the onlooker bees will choose it. When the food source is lowquality, the scout bees can search the whole environment randomly and obtain a new food source.

In the next phase, all parameters initialize:

equation (1)

where xi, j is the food source, i {1, 2,..., SN}, and j {1, 2,...,D}. SN is the number of food sources, D is the dimension of the problem, and xj max and xj min are the lower and upper bounds of the jth parameter. The food source vi,j is produced using Equation 1.


Where k is a randomly selected SN; j is a randomly selected D; and is a random number in the range of (-1, 1). In the employed bees’ phase, each employed bee uses Equation 2 to look for the nearby food source. The new food source v is determined by changing one dimension on x. If the new food source exceeds the boundaries, it will be set to remain within the boundaries. The fitness of the food source is then calculated. Greedy choices of original, new, and more favorable food sources can also be remembered.


In the onlooker bees’ phase, the onlookers receive information on the food sources from the employed bees. Each onlooker bee chooses a food source depending on the probability in Equation 3. When a food source has been chosen, each onlooker bee adopts Equation 2 to look for the nearby food source. Greedy choices of original, new, and more favorable food sources can also be remembered. In the scout bees’ phase, the food source can be removed when its fitness cannot be improved. Equation 1 then produces the new food source. The employed, onlooker, and scout bees’ phases repeat until the termination condition is met. The optimal food source presents the optimal solution of problems. This study used the ABC to determine the suitable parameters as follows.

Band-pass filter: The purpose of the band-pass filter is to remove the baseline wander and high frequencies that do not contribute to QRS complex detection. This study adopted ABC to produce F1 and F2. F1 is the starting frequency and ranges from 1 to 10. F2 is the stopping frequency and ranges from F1+10 to 25. Therefore, F1 determines the range of F2.

Squaring function: The signal is squared point by point. Equation 4 is adopted to enhance the large values and boost the high-frequency components:


Where x [n] is the original ECG signal. In all the equations, n is the number of data points.

Generating blocks of interest: Blocks of interest can be generated using two event-related moving averages. The first moving average is MAQRS that is used to extract the QRS features. The MAQRS is calculated by Equation 5; it smoothens multiple peaks with QRS complex intervals to emphasize and extract the QRS area.


where W1 is the approximate duration of the QRS area and W1 {20, 21,..., 40}. y[n] is the squared ECG signal.

The second moving average MAOneBeat extracts the QRS beat. The MAOneBeat is calculated by Equation 6. MAOneBeat is similar to MAQRS, but it is used as a threshold for the first moving average.


where W2 is the approximate duration of a heartbeat, W2 {200, 201,...,250}, and y [n] is the squared ECG signal.

Similarly, this study adopted ABC to produce W1 and W2. To increase the accuracy of detecting QRS complexes in noisy ECG signals, the dynamic threshold value THR1 was calculated by offsetting the MAOneBeat signal with α. The α was calculated using Equation 7.


where β {0, 0.01 ,..., 0.1} is produced by the ABC algorithm, and z̅ is the statistical mean of y (n). THR1 is calculated using Equation 8.


If MAQRS is higher than THR1, this area can be exported as the interest block, classified as containing ECG features and noise.

Threshold and detecting R peaks: If the width of an interest block is greater than or equal to W1, it is classified as a QRS complex. By contrast, the block is classified as a P wave, T wave, or noise. The final stage determines the maximum value within each block, which is classified as a QRS complex. The maximum value within the QRS complex is the R peak.

Expert system

There are two types of measurement in the healthcare system: active and passive monitoring. In active monitoring, the system can monitor the temperature and ECG without additional operations. Passive monitoring involves blood pressure measurement. In this study, we incorporated an alarm function into the system to remind the patient to use the sphygmomanometer. Research indicates that blood pressure measurement differs by age group [18]. Thus, the system asks for the patient’s age, and the mobile devices can determine whether the patient’s blood pressure is normal.

The designed expert system can be divided into three parts (Figure 3): (1) blood pressure, (2) temperature, and (3) ECG.


Figure 3: Flow chart for the expert system.

Blood pressure: According to the definition in [18], the system can determine the age and gender of the patient and adopt a suitable range for blood pressure data (Table 1). When the mobile devices receive the blood pressure data from Arduino UNO, the system determines whether the systolic and diastolic blood pressure is normal.

Age group Systolic blood pressure Diastolic blood pressure Systolic blood pressure Diastolic blood pressure
11-15 114 72 109 70
16-20 115 73 110 70
21-25 115 73 110 71
26-30 115 75 112 73
31-35 117 76 114 74
36-40 120 80 116 77
41-45 124 81 122 78
46-50 128 82 128 79
51-55 134 84 134 80
56-60 137 84 139 82
61-65 148 86 145 83

Table 1. Normal systolic and diastolic blood pressure by age group and gender.

Temperature: When the mobile devices receive the temperature data, the system determines whether the patient has a fever.

ECG: When the mobile devices receive the data from Arduino UNO, the system calculates the number of R peaks and HR. Then, the system determines whether the HR<60 or HR>120 per 10 s.


For elderly people with chronic diseases (such as high or low blood pressure, heart disease and cardiovascular diseases), long-term monitoring of physiological signals at home is crucial. Mobile health monitoring systems can thus improve the ability of families to monitor the health and quality of life of elderly relatives.

Wireless communication and the physiological parameters of various sensors provide healthcare professionals with a twoway interaction model that can facilitate self-management of chronic disease at home. The components of the hardware and the wear pattern are shown in Figure 4. To verify the accuracy of measurement data, in this study, we saved the recording data from three sensors as text files on the computer. Figures 5 and 6 and Table 2 show the raw data for temperature, ECG, and blood pressure from four patients.


Figure 4: Components of hardware and wear pattern.


Figure 5: Temperature data.


Figure 6: ECG data.

Blood pressure User 1 User 2 User 3 User 4
Systolic value (mmHg) 90 87 94 119
Diastolic value (nunHg) 61 63 60 72
Pulse value (bpm) 56 60 53 88

Table 2. Raw blood pressure data of four patients.

The proposed R-peak detection algorithm is an important part of the healthcare system because it calculates HR and determines whether the user has tachycardia bradycardia. Thus, the proposed R-peak detection algorithm was implemented in R2015a by using an Intel i7-4710MQ CPU 2.50 GHz to compare its performance with the knowledge-based R detection algorithm. This study adopted the MIT-BIH arrhythmia database ( database/mitdb/) to estimate the robustness of the proposed R detection algorithm. The database contains 48 ECG recordings, of which only 42 were used, because the remaining two exhibit considerable noise in their ECG signals. These are very difficult judgment QRS complexes, even for humans.

This study adopted Leave-One-Out Cross-Validation (LOOCV) for data validation. LOOCV uses one of the ECG recordings as testing data and the remaining recordings as training data. The training data and ABC algorithms can calculate the optimized parameters (F1, F2, W1, W2, and β) in the proposed QRS peaks algorithm [16], and the fitness function is estimated by the accuracy between the real and estimated R peaks. The testing data and optimized parameters determined by the ABC algorithm and training data can be used to calculate the agreement between the real and estimated R peaks. Thus, all ECG recordings are regarded as testing data.

The aforementioned steps can be performed 42 times and 42 different optimized parameters can be generated. Finally, the error rate and computation time in this study and the knowledge-based study were compared. The results are shown in Table 3 and Figure 7; the ABC algorithm is faster than the knowledge-based theory for determining the parameters in the QRS detection algorithm. Thus, the ABC algorithm can effectively reduce the computation time to determine the optimal parameters by using the R detection algorithm. Finally, the R detection algorithm was used to determine how the optimized parameters, labeled according to the ABC algorithm and 42 sets of training data, could be implemented to obtain HR in smartphones through JAVA.

Method Data Mean STD Time
Knowledge-based theory Training data 0.02362 0.00346 2.40236 (d)
Testing data 0.00303 0.01 7.50511 (s)
ABC Training data 0.02362 0.00346 9456.06077 (s)
Testing data 0.00303 0.01 7.50511 (s)

Table 3. Error rates and computation times between ABC and knowledge-based theory.


Figure 7: Results of testing data indices for R peaks. (a) No. 100 ECG data, (b) No. 121 ECG data, (c) No. 205 ECG data, (d) No. 234 ECG data.

The user first enters his/her name, age, gender, and contact person’s phone number, as shown in Figure 8. Then, the ECG and temperature can be continuously recorded by the Arduino UNO and transmitted to the smartphone via Bluetooth. HR is calculated per 10 s, and the expert system determines whether the user has fever or tachycardia bradycardia. When the user feels uncomfortable, he/she can use the sphygmomanometer to measure blood pressure. If the user has high blood pressure, low blood pressure, fever, or tachycardia bradycardia, the system sends a text message to the user’s family and doctor.


Figure 8: Initial screen of the proposed system.

Figures 8-10 show the practical operation of the JAVA-based application. Initially, the user provides personal information on the screen. Next, the system begins active monitoring and displays the user’s HR and temperature, as shown in Figure 9a. Because HR and temperature can be diagnosed by the expert system per 10 s, the first measurement is obtained after 10 s (Figure 9b). If ECG and temperature are outside of normal ranges (ECG<1.8 V) or the mobile phone does not connect to the Arduino UNO, the system determines that the sensor connection is lost (Figure 9c). Blood pressure can be more accurately recorded after waking up and at 7:00-9:00 pm. Therefore, the system sets an alarm for the user to measure blood pressure at 7-9 pm (Figure 9d).


Figure 9: Active measurement monitoring. (a) The system is at the first measurement. (b) HR and temperament can be obtained after 10 s. (c) The sensor connection is lost if ECG and temperature are outside normal ranges. (d) The notice reminds user to measure the blood pressure.

When the user measures their blood pressure, the system switches to passive measurement monitoring and shows the systolic blood pressure, diastolic blood pressure and pulse value, as shown in Figure 10. After measuring HR and temperature, the system can switch to active monitoring and repeat the measurements. When an unusual event occurs (e.g., high blood pressure, low blood pressure, fever, or tachycardia bradycardia), the proposed system sends a text message to the user’s family and doctor, as shown in Figure 11.


Figure 10: Passive measurement shows systolic and diastolic blood pressure and pulse value.


Figure 11: The system sends a text message to the user’s family when the user has (a) fever, (b) blood pressure, or (c) bradycardia.


This study focused on home healthcare management for elderly people, which can improve their quality of life and save a considerable amount of money on hospital care and aged care facilities. The proposed method is a simple and safe approach, wherein physiological parameters are analysed via a smartphone. The user can monitor their physical condition directly. This study adopted the ABC algorithm to replace the knowledge-based theory in the proposed R detection algorithm [16]. The MIT-BIH arrhythmia database was used for data validation. The results show that ABC can effectively reduce the computation time in the R detection algorithm. This can reduce the workload of medical staff, lower communication costs, and promote self-management of disease at home.

We intend to further investigate other parameters of the proposed method. Future work will also examine the standard of medical devices and the reliability and security of bluetooth when transmitting physiological data. As medical data increase, proprietary equipment is developed, and progress is made in the field of telehealth, different devices must be rendered compatible so they can interact and exchange data. In addition, the safety and reliability of bluetooth must be further studied.


This manuscript was edited by Wallace Academic Editing.