Smart Monitoring System for Chronic Kidney Disease Patients based on Fuzzy Logic and IoT

A Chronic Kidney Disease (CKD) monitoring system was proposed for early detection of cardiovascular disease (CVD) and anemia using Fuzzy Logic. To determine the heart rate and blood oxygen saturation, the proposed model was simulated using MATLAB and Simulink to handle ECG and PPG inputs. The Pan-Tompkins method was used to determine the heart rate, while the Takuo Aoyagi algorithm was used to assess blood oxygen saturation levels. The findings show that the ECG recorded using the CKD model has all of the characteristics of a typical ECG wave cycle, but with reduced signal degradation in the 0.8–1.3mV region. The heart rate signal processing yielded findings between 78 and 83 beats per minute is within the range of the supplied heart rate. Takuo Aoyagi's pulse oximeter simulation generated the same findings. For real-time verification, the proposed model was implemented in hardware using ESP8266 32-bit microcontroller with IoT integration via Wireless Fidelity for data storage and monitoring. In comparison with the Fuzzy Logic simulation done on MATLAB and Simulink, the CKD monitoring device has 100% accuracy in patient status detection. The CKD monitoring system has an overall accuracy of 99% in comparison with a commercial fingertip pulse oximeter. Keywords—Anemia; cardiovascular disease (CVD); fuzzy logic; healthcare; internet of things


I. INTRODUCTION
Healthcare monitoring systems or e-Health systems are devices that use a wireless sensor network (WSN) to observe severe or chronic diseases in humans [1] In this era, there are many smart watches out in the market that claim to track the condition of the body accurately. However, these smartwatches could not be used to diagnose a medical condition. It can only give alerts on an abnormal vital sign [2]. In this case, we have to use a proper medical device to monitor the vital signs. Some examples of medical devices are heart rate monitors (HRM), pulse oximeters, electrocardiogram (ECG), blood pressure monitors, thermometer, etc. Monitoring vital signs play an important role in healthcare monitoring systems. The vital signs of patients in intensive care unit (ICU) are also observed using healthcare monitoring systems [3]. Chronic disease patients require constant monitoring. In 2005, chronic disease fatality rates increased, with a total death count of more than 58 million people worldwide [4]. According to a recent study from Malaysia's National Renal Registry, for ten year's there has been an increase in new dialysis patients from 4,606 to 8,431 from 2008 to 2018 [5].
As a result, healthcare monitoring systems serve an important role in monitoring patients' vital signs and early detection of prevailing diseases. However, the high cost of equipment has been one of the drawbacks of a healthcare monitoring system. Treatment and monitoring chronic diseases cost a lot of money in both low-income and high-income nations urging the need for low-cost healthcare solutions [6]. Diseases that are caused by chronic diseases may be avoided if patients' vitals are monitored. Chronic Kidney Disease (CKD) is reported to outnumber other chronic illnesses including cardiovascular disease (CVD) and anemia in this scenario [7]. Due to insufficient erythropoietin hormones in CKD patients, previous studies reveal that the prevalence of CVD [8] and anemia [9] are very significant. Monitoring the electrocardiogram (ECG), heart rate, and blood oxygen saturation level can help in early prevention. Contaminants in ECG signals are commonly divided into the following groups. Power line interference, electrode pop or contact noise, patient-electrode motion artefacts, electromyographic (EMG) noise, and baseline wandering are all examples of these problems [10]. These pollutants cause ECG readings to be inaccurate, making it harder to diagnose the heart's activity.
The integration of an Artificial Intelligence in a healthcare monitoring device will improve the decision-making process. Fuzzy Logic is known to be a form of artificial intelligence where the approach to computing is based on "degrees of truth" rather than the usual "true or false". This allows human-like reasoning to take place to identify pathologies in a person.
The design of a sensor interface controller for early detection of anemia and CVD in CKD patients with the aid of artificial intelligence is the focus of this article. The implementation of Internet of Things (IoT) will further enhance the device with transmitting and storing data via Cloud Computing. ECG signal generation, heart rate detection, and patient condition are all done with MATLAB and Simulink. For early diagnosis of CVD and anemias, a Fuzzy Logic Interface (FIS) is implemented. The Fuzzy Logic Toolbox graphical user interface (GUI) from MATLAB is used to simulate the FIS. The suggested method is implemented in hardware using ESP8266 microcontroller for real-time verification. *Corresponding Author. www.ijacsa.thesai.org II. PPG SIGNAL AND ECG SIGNAL FOR AND HEART RATE DETECTION Pulse oximeter sensors generate photoplethysmogram (PPG) signals, which have both an AC and DC component, as seen in Fig. 1. The AC component refers to the Pulsatile Arterial Blood Absorption, which describes how light is absorbed by blood circulating through arteries [11].
The is determined using an equation pioneered in the 1970s by Takuo Aoyagi [12]. Aoyagi tweaked Wood's plot of red and infrared light haemoglobin density to design a sensor that can detect the necessity for artificial ventilation [13]. The is determined by sensing light attenuation through a haemoglobin absorptive medium. The Beer-Law, Lambert's which connects the concentration of a solute in a solvent to the absorption of light passing through the solution [14], is used to do this. Equation (1) represents the relationship between the concentration of the solute and the absorption of light. (1) Where is the intensity of transmitted light, is the intensity of incident light, is the wavelength of light, is the extinction coefficient of solute, is the concentration of solute and finally is the length of path that the incident light travels through.
The is estimated using red (visible) light and the infrared light (IR) where both lights contain AC and DC component using equations (2) and (3).
Where, R is the AC to DC ratio of the red light divided by the AC to DC ratio of the infrared (IR).
is the pulsating AC component of the red light.
is the pulsating AC component of the infrared light.
is the DC component of the red light and is the DC component of the infrared light. The normal range of levels is 96% -100%. Fig. 2 shows the relationship between the amplitude of red light (R) and infrared light (IR) to the and red light to infrared light ratio (R/IR) [15]. When the amplitude of both the red and infrared light is the same it gives an R/IR ratio of 1.0 which produces an of 85%. Where else, -3.4 R/IR ratio produces an of 0% and 0.43 R/IR produces an of 100%. These amplitude ratio of red light to infrared light are used to model the simulation blocks.
The purpose of an ECG machine is to collect electrical signals from the heart's activity. The information about the heart's activity will be presented in a waveform pattern by the ECG machine. Cardiologists use 12 lead ECG as the gold standard instrument to monitor the heart functions to detect the changes from normal heart rhythm. Findings such as abnormalities from visual inspections of the ECG waveforms will be the basis for necessary further heart examinations such as angiograms. The regular cycle of the ECG waveform representing the heart's activity is shown in Fig. 3. The P wave indicates atrial contractions to transfer blood into the ventricle, the QRS complex indicates ventricular contraction, and the T wave represents ventricular repolarization [16].
Instead of utilizing the PPG data from the pulse oximeter sensor, the ECG signals from the ECG sensor were used to determine the heart rate. The R peak is the point on the ECG signal with the highest amplitude that could be clearly identified. The QRS complex has been filtered off in earlier research to make it easier to detect R peaks [17]. Because the R-R interval is clearly distinguishable in the ECG signal, the R peaks may be utilized to window it. The R-R interval, as illustrated in Fig. 3, can be used to determine a person's heart rate. The heart rate (HR) in beats per minute (BPM) is calculated using the number of R peaks recorded in one minute [18]. Equation (4) can be used to calculate heart rate.
The R-R peaks is measured using millisecond, hence millisecond is applied. As a result, one minute will be divided between R-R peaks. If the R-R intervals are 800ms, for example, (60,000ms/min)(800)ms = 75 BPM.   In order to measure and monitor the vital signs of CKD patients, the design, development, and simulation of the CKD monitoring system are done using MATLAB and Simulink. Fig. 4 shows the proposed CKD monitoring system integrated with IoT. The system consists of seven components which are patient, smart sensors, device, connectivity, cloud platform, application, and user. The first component is the patient who will be monitored. Smart sensors consist of a pulse oximeter sensor and an ECG sensor. The third component is device also known as "thing". The brain to the system is the microcontroller which will process signals from the smart sensors. The outputs are sent to the fuzzy logic interface for decision-making on the patient"s conditions. The results will then be displayed locally on an OLED screen. The fourth component is connectivity via Wireless Fidelity (Wi-Fi). The Wi-Fi will be used to link the device to the fifth component of the system which is the cloud platform. The cloud platform consists of the cloud computing and cloud storage. Data from the device will be stored in the cloud as well as sent to the sixth component, application. The application consists of smartphones and the web. This system will allow users to view the results using smartphones and web browsing. The last component of the framework is the user. The user consists of caretakers as well as healthcare professionals. This system allows healthcare professionals to personally monitor the patient all the time. The patient"s data will be stored on the cloud for easier access to the patient"s history.
Simulations have been done on MATLAB and Simulink for signal processing of PPG signals and ECG signals. The PPG signals were processed to obtain the blood oxygen level readings while the ECG signals were processed to obtain the filtered ECG and heart rate reading.
The monitoring system consists of algorithms and techniques to determine the heart rate and levels. Fig. 5 shows the proposed CKD monitoring system to monitor the condition of CKD patients. The model consists of signals generated as inputs imitating the pulse oximeter sensor and the ECG sensor. The model also has a subsystem block as a microprocessor that contains the algorithms for measuring heart rate and . Finally, scopes and displays are set as outputs to display the results.
The ECG signal block contains 5 presets of ECG signals which generate different heart rates when selected. The presets are named very low, low, normal, high, and very high that generate 45 bpm, 60bpm, 78 -83bpm, 160bpm, and 220 bpm respectively. Before being shown on the ECG signal scope, the produced signals will go via a sample rate converter to match the output sample rate [19]. The sample rate converter has a tolerance of 0.01 and a sample output rate of 200Hz. The Pan-Tompkins method, which includes a Band pass Filter, Differentiator Filter, Moving Average Window, and QRS Peak Detection [20], will be used to estimate heart rate from ECG data. The sample rate converter block is used to match the source sampling rate to the output sampling rate [21]- [23]. A 198Hz two-sided bandwidth of interest was used to transform the sample rate. A Band pass Filter, Differentiator Filter, Moving Average Window, QRS Peak Detection, and Unbuffer make up the ECG signal processing [24]. The ECG signal processor's role is to filter the ECG signal so that the patient's heart rate may be determined. The band pass filter [25]- [28] is a mixture of a high-pass and a low-pass filter. The band pass filter eliminates noise from muscle movements, breathing fluctuation, and baseline wander. The band pass filter in this model is set to correct any attenuation of the QRS complex and eliminate artifacts from the heart's motion. Equation (5) shows the transfer function of a second-order low-pass filter with a high cutoff frequency of around 11Hz.
The transfer function of a high-pass filter with a low cutoff frequency of nearly 5Hz is shown in Equation (6). (6) A full-band differentiator filter is used by the differentiator filter to isolate all of the frequency components in the input signal [24]- [26]. An equiripple Finite Impulse Response (FIR) filter architecture is used to construct this block. This block's filter order is set to 51, and the maximal passband ripple is left at preset. The Pan-Tompkins algorithm's differentiator filter is based on equation (7), with a 2 sample output signal delay.
A 'Discrete FIR Filter' is used to construct the moving average window block. This block has been used to transfer the data that has been obtained one by one. This block primarily determines the window size. Equation (8) represents the result of the Pan-Tompkins algorithm, where N is the window width, which varies depending on the size of samples.   To identify R peaks and estimate the patient's heart rate, the QRS peak detection block is used. The R peaks and the ECG signal threshold can be used to estimate the patient's heart rate. The threshold and R peaks' parameters threshold are first declared. The R peak amplitudes are programmed to detect a range of 0.055-0.075mV with a width of more than 10.01ms. Any signal that does not fall within the specified range will be ignored and deemed noise. The threshold is calculated using the average noise peak and the mean estimations of average R peaks with 8 samples. The R-R peaks will be analyzed to measure the heart rate using the identified R peaks. The following equation (9) and (10) was used in the Pan-Tompkins algorithm to detect R peaks.
Where is the total peak. is the signal peak threshold.
is the signal peak running estimate. is the noise peak threshold.
The was measured using Equation (2). The PPG signals from a pulse oximeter consist of an AC and DC component from Infrared LED and a Red LED [29]. In total there are four sources of signals produced. The generated signals are represented by the source generator AC RLED, AC IRLED, DC IRLED, and DC RLED. The AC signals are built using a Repeating Signal Generator. A repeating series of integers provided in a table of time-value pairs is produced as the output. Time values should be growing consistently. The amplitudes of the AC IRLED and AC RLED were set at different points to result in a difference in the R value generated [30]. The R value determines the estimation of the levels of the patient. The DC IRLED and DC RLED were generated using a pulse generator which will generate DC signals at different amplitudes. The inputs were connected to a MATLAB function block which is coded using Equation (1) and Equation (2) [31], [32]. The results of the R value and on a display block. The simulation was done with different inputs applied to the source generator. The outputs were then recorded to verify the function of the simulation model.
The Fuzzy Logic Interface System (FIS) is used to predict the deterioration of vital signs for early detection of abnormalities in the patient"s body by using heart rate and as the parameters. The Fuzzy Logic Toolbox™ graphical user interface (GUI) from MATLAB is used to run the simulation. The toolbox includes the Fuzzy Logic Designer, Membership Function Editor, Fuzzy Rules, Rule Viewer and the Surface Viewer.

IV. SIMULATION RESULTS
The Simulation provides results of the ECG, heart rate, and the . In comparison with a typical ECG theoretical cycle wave, the ECG generated demonstrates the patient's normal sinus with a resting heart rate range of 78 and 83 BPM. The heart rate at the input was set between 78 and 83 beats per minute, and as shown in Fig. 6, the heart rate is 82 beats per minute. Confirming that the Pan-Tompkins algorithm used to estimate the HR in this simulation is acceptable. Fig. 7 displays the pre-recorded ECG signals that were used to synthesize the ECG signals. In comparison with a regular ECG theoretical cycle wave, the ECG signal clearly demonstrates the patient's normal sinus with a resting heart rate of 78-83 BPM. The amplitude of the signals is indicated on the y-axis in mV, and the time is indicated on the y-axis in seconds. The P, R, and T waves have peak amplitudes of 0.79 -0.88mV, 1.01 -1.28mV, and 0.95 -1.05mV, sequentially. The T wave has a larger peak amplitude than the P wave, as predicted.   The ECG waveforms are shown in Fig. 8 at different phases of digital signal processing for R peak identification. In comparison to the Pan-Tompkins algorithm theoretical findings, the results are similar at every stage. The amplitude in mV is indicated on the y-axis, while the time in seconds is indicated on the x-axis. The output of the ECG signals after being filtered using a band pass filter is shown in Fig. 8(a). Fig.  7 shows that the peak amplitudes of the P, T, and U waves are relatively low than those of the signals in Fig. 8. (a). Using a low-pass and high-pass filter method, the band pass filter has filtered out the high and low signals, leading the P, T, and U waves to have a reduced amplitude. Fig. 8(b) displays the result of the next phase, which involves filtering ECG signals using a differentiator filter. The QRS complex has a larger amplitude than the P, T, and U waves, which have a smaller amplitude. The amplitude of the R peak has declined from 0.3mV to 0.12mV. On the other hand, the amplitudes of the P, T, and U peaks are in the range of 0.01-0.04mV. In Fig. 8(a), it's clearly seen that this filter has also eliminated the negative numbers. The output of the moving average filter can be seen in Fig. 8(c). The moving average window generates a signal that contains information about the QRS complex's slope and breadth. The last stage in signal processing for R peak detection is shown in Fig. 8(d). After applying the adaptive thresholds, the processed data display a stream of pulses indicating the positions of the QRS complexes. At the same time, the P, T, and U are totally filtered out by the moving average window. The amplitude of these pulses is between 0.05 and 0.07 millivolts. Fig. 6 illustrates the Simulink model in action when the ECG source is set to 78-83 BPM. As a result, the heart rate shown on the "Display" Simulink block is 82 BPM, demonstrating the validity of the Pan-Tompkins algorithm used in this simulation. Fig. 8(d) shows the R peaks that were used to compute the heart rate. A second is equal to 60Hz, hence if more than one R peak is observed in a second, the signals have a frequency greater than 60Hz. Fig. 8(d) shows that within a minute more than one R peak is recorded. This indicates that the heart rate of this ECG signal is more than 60 beats per minute. As a result, the Simulink block appears to be capable of processing the ECG data in order to retrieve the R peaks and heart rate. Or else, the Simulink model is obliged to have an inaccuracy if a heart rate range of 78 -83 BPM was not presented.
The inputs of the AC RLED and AC IRLED are manipulated to obtain different readings. Table I shows the relationship between the inputs, R value, and the reading. The relationship between the R value and the . The R to IR ratio was manipulated by changing the values of the AC RLED and the AC IRLED inputs. When the AC RLED has a higher value than the AC IRLED the R to IR ratio is high causing the value to be low, vice versa when the AC IRLED has a higher value than the AC RLED. These results are similar to the pulse oximeter design study by Jubran (1996) and prove the validity of the simulation model in different levels in the patient"s body.  A Mamdani fuzzy logic-based detection system is designed as shown in Fig. 9. The system receives two inputs that are heart rate and readings and provides one output which is the patient"s condition. MATLAB software is used to build the fuzzy logic system. Next, the Membership Function Editor is used to determine the shape for each membership function that is associated with the declared variables. The "trapmf" Membership Function that provides the trapezoidal-shaped relationship between a crisp variable and its corresponding fuzzy values was used. Fig. 10 and 11 show the declared membership function for the inputs. The heart rate has 5 membership functions while the has 3 membership functions. Fig. 12 shows the patient condition membership functions which determine the condition of the patients to be normal, abnormal, or critical. The centroid defuzzification method is done by using a closed-form of membership functions. This method returns the crisp value that corresponds to the fuzzy set's center of area. Following the declaration of membership functions for the inputs and output, the fuzzy rulebase is used to establish a specific set of output functions depending on certain specified inputs, as determined by medical specialists using ground truth base in Table II [33]- [35]. Fig. 13 shows the rules set up in the Rule Editor. In total, 15 rules are resulting in 3 possible outcomes depending on the parameter of inputs. The outcome of the patient"s condition is normal when the vital signs namely heart rate and are in the range of 70 -100 BPM and 96 -100%, respectively.     The result of the fuzzy logic system can be simulated in MATLAB using the Rule Viewer as shown in Fig. 14. The Rule Viewer can be used to identify whether the expected parameters are obtained for the given inputs. The stability of the system and the accuracy can be estimated with the help of the diagram. For example in the simulation done in Fig. 6, the heart rate is set at 82 BPM and the is set at 100% and the output shows the patient is in normal condition. The fuzzy logic system was tested in all possible outcomes to verify the stability and accuracy of the rules. The Surface Viewer is utilized to see how one of the output is affected by one or more inputs. It constructs and plots a system output surface map, as illustrated in Fig. 15. With a successful simulation, the Fuzzy Logic variables, parameters, membership functions, and rules were coded into ESP8266 32-bit microcontroller to make a smart CKD monitoring system.  The Fuzzy Logic Controller was interfaced in the Simulink model to simulate the function. Table III shows the results from the tested parameters. The condition of the patient is displayed as "Normal" when the heart rate and are only in the normal range. Table IV shows the previous studies conducted by other researchers to monitor vital parameters in the past few years.
The comparisons were focused on the types of microcontrollers used, the presence of simulation, the parameters that were measured, the inclusion of an abnormalities detection method, and the accuracy of the device. Many of the studies utilizing the Arduino microcontroller had high accuracy. In this study, Fuzzy Logic will be used for the early detection of anemia and CVD in CKD patients. The results of the simulation, hardware and a typical medical device were compared to prove the accuracy of the simulation and hardware developed.

VI. HARDWARE IMPLEMENTATIONS
The successful simulation of the CKD monitoring system will be implemented into hardware for real-time verification. The hardware consists of a MAX30105 Pulse Oximeter, AD8232 ECG Sensor, and AD8232 ECG electrodes as the inputs. The Arduino based ESP8266 32-bit was used as the microcomputer and the OLED screen was used as the output to display the results. The Arduino based ESP8266 board has a built-in Wi-Fi feature that does not need an external Wi-Fi module making this system to be compact. The built-in Wi-Fi module has an IEEE 802.11 b/g/n that uses various frequencies including, but not limited to, 2.4 GHz, 5 GHz, 6 GHz, and 60 GHz frequency bands. In the case of noisy settings, the AD8232 has a signal conditioning block that can retrieve, enhance, and filter weak bio-potential signals. This implies that signal contamination from motion artifacts or remote electrode placement can be minimized. The AD8232 comes with 3-lead ECG electrodes that plug into a 3mm audio jack. The MAX30105 is an integrated particle-sensing module that can be used to produce PPG signals from the arterial pulse. The MAX30105 communicates through a standard compatible interface. This makes it easier for the microcontroller to process information with a simple circuit. The module uses a red light with a wavelength of 680nm and infrared light with a wavelength of 880nm. It also comes with a built-in digital filter and an analog to digital (ADC) signal converter. Fig. 16 shows the wiring diagram of the CKD monitoring system. The MAX30105 Pulse Oximeter and the OLED Screen are interfaced via the module at the A4 and A5 pins. The AD8232 ECG monitor is interfaced to the analog pin A0 of the ESP8266 while the Lo+ and Lo-of the ECG module are interfaced to digital pins D5 and D6 respectively. The AD8232 ECG leads are connected to the 3mm audio jack of the AD8232 ECG module. The ESP8266 is powered using a 9V battery. The ESP8266 microcontroller is programmed using the Arduino"s Integrated Development Environment (IDE) via C programming language. The libraries of the sensors, displays, and fuzzy logic systems were installed before programming. www.ijacsa.thesai.org The Arduino based ESP8266 microcontroller was programmed using the Arduino IDE. The program was written using C++ language. Fig. 17 shows the flowchart of the program that was coded into the ESP8266 microcontroller. The microcontroller initializes the libraries that will be used to run the program. The initialization includes the AD8232, MAX30105, SDD106 OLED, Fuzzy Logic, and Wi-Fi. Then, the connection to the internet will be attempted. With a successful internet connection, the Cloud Platform server will be done. Once connected the smart sensors will get the data from the patient. The ECG, heart rate, and will be obtained by processing the ECG signals and PPG signals. The obtained data will be sent simultaneously to the Fuzzy Logic interface and displayed on the OLED screen. The results from the Fuzzy Logic will be displayed on the same OLED as well. Finally, all the obtained data will be sent to the cloud platform via a Wi-Fi connection. If the device is not turn off, it will repeat the loop by obtaining data from the smart sensors.
The prototype of the CKD monitoring system hardware is shown in Fig. 18. The result of estimation was compared to the value obtained by a commercial fingertip pulse oximeter as shown in Fig. 19 to validate the measurement. The developed CKD monitoring system was tested on a normal person. The ECG leads were placed on the chest during a supine position [40] according to Einthoven's triangle for ECG lead placement as shown in Fig. 20.
The ECG leads are color coded where the green (left leg = LL) serves as the reference electrode, red, is for the left arm (LA), and yellow is for the right arm (RA). The RA and LA leads are placed below the right and left clavicle respectively. The LL lead is placed below the left rib bones. The ECG leads must not be placed on the bones to avoid obstructing the signals and it can cause noise. The left index finger is placed on the MAX 30105 pulse oximeter while the right index finger is put inside the commercial pulse oximeter. After a few seconds, the results were displayed. On the OLED panel, the ECG waveforms obtained by the AD8232 ECG sensor were vividly presented. In comparison to a typical ECG theoretical cycle wave, the ECG includes all of the elements of a regular sinus. Along with the output from the fuzzy logic controller, the heart rate and were clearly shown. The condition of the patient is displayed as "Nor" as the heart rate and were in the normal range of 70 BPM and 98%, respectively.     The cloud platform was set up using the Arduino Cloud IoT. The Arduino Cloud IoT is an application programming interface (API) that provides services for developers to configure, program, and connect to other devices. In this project, the ESP8266 microcontroller was connected to the internet via Wi-Fi to send the information to the server containing dashboards and storage. Fig. 21 shows the interface of the smartphone application. The first page of the application displays dashboard consisting of the patient"s ID. When the patient ID is selected in the dashboard the second page opens. The second page displays the , heart rate, and the patient"s condition. The and heart rate of the patient displays 97% and 69BPM respectively simultaneous to the results displayed in the local OLED screen. The same results can also be seen on the website and logged in to the cloud storage. Table V shows the results from comparing the developed CKD monitoring system to the commercial fingertip pulse oximeter. The heart rate has a deviation of 1 -2 BPM while the has a deviation of 1%. The fuzzy logic system programmed into the ESP8266 was compared to the results simulated in MATLAB and Simulink. The cloud application represents the readings obtained from the smartphone. Results show that there is no deviation in the outcome of the patient"s condition, thus proving 100% accuracy of the CKD monitoring system IoT-based. The prototype CKD monitoring system has an overall accuracy of 99%.  The proposed device has minor limitations that can be improved in future works. The biosensors, OLED display, and microcontroller are powered by a 9V battery that consumes a lot of power and prevents the device from being used for an extended period. Low powered biosensors and displays can be added or developed as an upgrade.

VII. CONCLUSION
A model of a simulation was designed to imitate the functionality of a low-cost monitoring system for early detection of CVD and anemia for CKD patients. The ECG signals produced in the simulation were similar to the theoretical cycle in the range of 0.8 -1.3mV with different heart rate range settings. The simulation done on to yield similar results to the Takuo Aoyagi algorithm. The hardware implementation verified the prototype CKD monitoring system in real-time by displaying the ECG, heart rate, and along with the patient"s condition with 99% accuracy when compared with a commercial fingertip pulse oximeter. The fuzzy logic coded into the ESP8266 32-bit microcontroller was accurate by 100% relative to the simulation done on MATLAB and Simulink. The suggested system contributes to the decrease of fatalities from chronic kidney disease patients by monitoring important parameters including ECG, HR, and with the inclusion of decision making using Fuzzy Logic.