2 Replace
2 Replace
com/scientificreports
Keywords photoplethysmography, blood glucose level estimation, deep learning, ResNet, TinyML
Diabetes is a chronic metabolic disorder that affects millions of people worldwide1–3. It arises when the body
either inadequately produces insulin or develops resistance to its effects4. Insulin, a hormone produced by the
pancreas, plays a crucial role in regulating blood glucose levels by facilitating its uptake into cells for energy
production2. Inadequate insulin production or action results in elevated blood glucose levels (hyperglycemia),
which, over time, can lead to severe complications, such as cardiovascular disease5, kidney damage6, nerve
damage7, and vision problems3,4. According to the World Health Organization (WHO), diabetes is a growing
global health concern with significant implications for individuals, families, and healthcare systems8. As of 2021,
an estimated 422 million people worldwide are living with diabetes, nearly four times the number in 19804.
Furthermore, WHO reports that in 2019 alone, approximately 1.5 million deaths were directly attributed to
this metabolic disorder8. The International Diabetes Federation (IDF) predicts that by the year 2045, the global
prevalence of diabetes will rise to around 700 million individuals4. This alarming increase can be attributed to
various factors such as population growth, aging societies, urbanization trends leading to sedentary lifestyles
and unhealthy dietary habits9. Consequently, there is a pressing need for effective prevention strategies as well
1Advanced Service Robots (ASR) Laboratory, Department of Mechatronics Engineering, School of Intelligent
Systems Engineering, College of Interdisciplinary Science and Technology, University of Tehran, Tehran, Iran.
2Department of Electrical Engineering, California Polytechnic State University, San Luis Obispo, California, USA.
email: [email protected]
as innovative diagnostic tools and treatment options to manage existing cases efficiently while minimizing
complications4.
Monitoring blood glucose levels is essential in the effective management of diabetes. Traditionally, blood
glucose level (BGL) measurement has been performed using invasive methods like finger stick testing, which
requires a small blood sample obtained through skin puncture10. However, this approach can be painful and
inconvenient for patients leading to non-compliance with recommended monitoring schedules11. To address
these challenges, researchers have been investigating non-invasive techniques that allow for more comfortable
and user-friendly ways of measuring BGL12–14. Photoplethysmography (PPG) is one such promising method
gaining attention in recent years12–14. PPG utilizes optical sensors to detect changes in blood volume by emitting
light into the skin and measuring the amount of light absorbed or reflected by blood vessels15. Since blood
glucose concentration affects various factors including tissue transparency and local hemodynamics, it may
influence PPG signal characteristics as well16. By analyzing specific features within acquired PPG signals using
advanced algorithms, it becomes possible to estimate BGL without causing discomfort or requiring any direct
contact with bodily fluids12. This non-invasive approach has potential benefits not only for improving patient
adherence but also facilitating continuous monitoring systems enabling better glycemic control and reduced risk
of complications17. Also PPG is a versatile technique that has applications beyond blood glucose level estimation.
By capturing subtle changes in blood volume using optical sensors, researchers have been able to explore its
potential for predicting various health parameters and conditions. Stress detection is one area where PPG has
shown promising results18. As stress can trigger physiological responses such as increased heart rate and altered
blood flow patterns, these variations can be detected by analyzing the characteristics of the PPG signal18,19.
Similarly, studies have demonstrated the feasibility of estimating blood pressure non-invasively using PPG data20.
By examining specific features within the acquired signals like pulse transit time or waveform morphologies, it
becomes possible to estimate systolic and diastolic blood pressure values without relying on traditional cuff
based measurements12.
Machine Learning (ML) and Artificial Intelligence (AI) have the potential to significantly enhance the utility
of PPG for BGL estimation12,21–24. These technologies can be used to develop sophisticated algorithms capable
of analyzing complex PPG signals and accurately estimating BGLs. ML and AI can help in identifying and
learning the intricate patterns in PPG signals associated with changes in BGLs, which may not be discernible
through traditional analysis methods. Furthermore, they can be used to create predictive models that can adapt
to individual physiological variations, thereby improving the accuracy of BGL estimation. The integration of
ML and AI in PPG-based BGL monitoring systems could lead to more reliable, personalized, and user-friendly
solutions for diabetes management21–24. In this work, we address the challenge of estimating BGL from raw PPG
signals. While previous studies have explored the use of raw PPG for BGL estimation25,26, they often suffer from
limited sample sizes and lack of diversity in subjects. To overcome these limitations, we present a novel approach
that incorporates a larger and more diverse dataset by using a 10-second and 1-second segmentation of PPG
signals. This segmentation technique significantly increases the size of our dataset, enabling us to train a more
robust and accurate model. We are conducting a comparative study between traditional 10-second segmentation
and a novel approach that processes and converts these segments into 1-second intervals. This comparison
utilizes two distinct datasets: one influenced by anesthesia and the other unaffected, demonstrating the model’s
robustness in handling diverse clinical scenarios. Our analysis highlights the model’s generalizability, effectively
predicting BGL from PPG data across conditions with and without anesthesia. Furthermore, we trained this
model on the largest dataset ever utilized for BGL prediction by PPG, emphasizing the scale and relevance of
our research. Additionally, we successfully implemented the best performing model on an embedded device,
showcasing its practical applicability with a swift processing time of only six seconds. This research not only
proves the efficacy of advanced segmentation techniques but also enhances the model’s utility in real world
settings.
Furthermore, our proposed model outperforms previous approaches that rely solely on PPG signal and
deep learning models25,26. Through rigorous experimentation and evaluation, we demonstrate the superior
performance of our method in estimating blood glucose levels from PPG signals. This work represents an
important advancement in the field and has the potential to contribute to the development of more effective and
reliable non-invasive BGL estimation techniques.
To conclude the introduction of this paper, we highlight the main contributions of our research, which set it
apart from existing studies and signify its impact in the field of non-invasive blood glucose estimation:
1. Innovative segmentation technique: We introduce a novel preprocessing method that converts traditional
10-second PPG signal segments into more granular 1-second segments. This finer segmentation allows for
more detailed analysis and potentially increases the sensitivity and accuracy of BGL estimations.
2. Extensive dataset utilization: Our study is distinguished using the largest dataset ever deployed for BGL
prediction using PPG technology. This extensive dataset includes a diverse range of subjects and scenarios,
enhancing the robustness and generalizability of our findings.
3. Cross-condition applicability: We rigorously test our model across two different datasets: one influenced by
anesthesia and the other not, effectively demonstrating the model’s capability to deliver reliable performance
under varied physiological conditions.
4. Real world implementation: We successfully implement our best performing model on an embedded device,
achieving rapid BGL estimations in just six seconds. This achievement underscores the practical applicability
of our approach for real time, continuous monitoring.
5. Superior performance metrics: Through meticulous experimentation and validation, our approach not only
meets but exceeds the accuracy of previous methods, as evidenced by a remarkable average root mean squared
error (RMSE) of 19.7 mg/dL and a 100% accuracy in clinical acceptance zones (A zone + B zone).The rest of
this paper is structured as follows: “Related works” section reviews existing studies on BGL estimation using
PPG signals and various modeling techniques. “Datasets” section describes the datasets used in this study.
“Data preprocessing and signal segmentation” section details the preprocessing and segmentation steps for
the PPG and BGL data. “Model architecture” section discusses the deep learning models evaluated, including
ResNet34, VGG16, and a hybrid CNN-LSTM with Attention. The metrics section explains the metrics used
to assess model performance. “Results” section presents the comparative performance of the models and
segmentation methods. “The optimizing model deployment on embedded devices” section covers the de-
ployment of ResNet34 on the STM32H743IIT6 micro-controller, including model optimization techniques.
Finally, the “Discussion” section addresses the findings, limitations, and effectiveness of the segmentation
methods, and the “Conclusion” summarizes key findings and suggests future research directions.
Related works
Several studies have explored the prediction of BGL using PPG signals, employing various approaches and
techniques. Some of these studies focused on feature extraction techniques to enhance the accuracy of BGL
prediction models12,27,28. These methods involve extracting relevant features from PPG signals, such as pulse
rate, pulse amplitude, and waveform characteristics, to capture the physiological variations associated with
glucose levels12,14. By incorporating these extracted features into predictive models, researchers aimed to
improve the accuracy and reliability of BGL estimation. Additionally, some studies incorporated auxiliary or
helper features, such as HbA1c (glycated hemoglobin) levels, in their predictive models. HbA1c provides an
indication of average blood glucose levels over the past two to three months, making it a potentially useful
factor for BGL prediction26. However, it is important to acknowledge the limitations of relying solely on HbA1c.
HbA1c provides an overview of long term glycemic control, but it may not capture immediate changes in BGL
or reflect short term variations that can be captured by real time monitoring using PPG signals. Moreover, some
studies utilizing raw PPG signals alone to estimate BGL26. They leveraged the inherent information present
in the PPG waveform to extract meaningful features directly, without resorting to additional data or feature
extraction methods12,26. The simplicity of using raw PPG signals is advantageous as it reduces complexity and
computational overhead.
Despite the usefulness of feature extraction techniques and auxiliary features like HbA1c26, there are
compelling reasons to consider using raw PPG signals as the primary data source for BGL prediction models.
The main advantage lies in the ease of obtaining PPG signals through wearable sensors or commonly available
mobile devices29,30. This accessibility makes PPG signals a practical choice for continuous monitoring and
enables real time estimation of BGL without the need for additional tests or complex procedures. One critical
aspect to consider in the development of models for BGL estimation using PPG is the robustness of these models,
particularly when data availability is limited. While PPG-based BGL estimation shows promise, the accuracy
and reliability of the models can be affected by the quantity and diversity of the data used for training. One
challenge that researchers face is the scarcity of data25, especially in studies involving a low number of subjects.
In some cases, the available datasets may only consist of a few individuals, making it difficult to capture the full
range of physiological variations and inter-individual differences.
This limitation can impact the generalizability of the developed models, as they may not adequately account
for the variability present in the broader population of individuals with diabetes. On the other end of the
spectrum, studies with a higher number of subjects, such as the one involving 2,538 individuals, may have
their own challenges. While a larger dataset offers more diversity and potential for robust model development,
it introduces complexities related to data management, computational requirements, and potential biases.
Handling and processing such large volumes of data require efficient algorithms, computational resources, and
careful consideration of potential confounding factors.
MUST dataset: university of science and technology of Iran, Mazandaran data collection
The dataset in question was collected by the digital systems research team at the University of Science and
Technology in Mazandaran, Behshahr, Iran (MUST)32. It contains 67 raw PPG signals, sampled at a frequency
of 2175 Hz. Each entry in the dataset is accompanied by labels for age, gender, and invasively measured blood
glucose levels, making it suitable for further research and the development of learning algorithms in non-
invasive blood glucose monitoring. This dataset is used solely for testing purposes.
Fig. 1. This figure illustrates the stages of processing PPG signals. The plot shows a 16-minute segment of
the signal centered around the measurement point (tm), including 8 minutes before and after. It also displays
the filtered signal, demonstrating the removal of noise and artifacts using the described methods in Refining
signals with advanced filtering techniques.
where f (ti ) represents the PPG signal at sample ti , and f (ti−1 ) and f (ti+1 ) are the signal values at the
neighboring points. This local maximum condition forms the basis for peak detection in the signal. To refine
peak detection, two additional conditions are applied:
• Height Threshold: This filters out noise and small fluctuations, ensuring that only peaks above a certain ampli-
tude are considered. Mathematically, for a peak at ti , the condition is (Eq. 3):
Fig. 2. One-second segment of a PPG signal, highlighting the characteristic waveform typically used for
analysis in BGL prediction.
• Distance Threshold: To avoid detecting multiple peaks in close proximity, a minimum distance between con-
secutive peaks is enforced. If two peaks are detected within a short time interval, only the more prominent
peak is retained. This requirement is expressed as (Eq. 4):
|ti − tj | > Dmin , ∀i ̸= j (4)
By applying these thresholds, the detected peaks are ensured to be both physiologically meaningful and
appropriately spaced, reducing the chance of false positives caused by noise or rapid fluctuations in the signal.
where Wi · T is the dot product of the window and the template, and ∥Wi ∥ and ∥T ∥ are their Euclidean norms.
Cosine similarity ranges from -1 to 1, where a value of 1 indicates perfect similarity, and values close to 0 indicate
low similarity.
To retain only high-quality segments, we discard any window whose cosine similarity with the template falls
below 85%. This threshold is a hyperparameter that can be adjusted depending on the specific requirements
of the model. By filtering out low-quality windows, we focus on the most informative segments of the signal,
enhancing the overall performance of the model by reducing noise and irrelevant data.
This process effectively condenses the PPG signal into 1-second windows that capture the most critical
information, reducing computational load while retaining key features of the waveform. To illustrate the
methodology, we present the pseudocode (Algorithm 1 ) for the precision interval segmentation process. The
algorithm involves peak detection, window extraction, template computation, and cosine similarity filtering, as
described in the previous sections.
Fig. 4. Architecture of the residual block used in the modified ResNet34 model for PPG signal analysis,
showing the flow of data through 1d-CNN layers, batch normalization, and ReLU activation, with a skip
connection to combat the vanishing gradient problem.
• Flatten Layer: Following the last residual block, a Flatten layer is used to reshape the output into a one dimen-
sional vector, preparing it for the subsequent dense layers.
• Dense Layers: The flattened output is fed into three dense layers. The first dense layer consists of 256 units
with ReLU activation, allowing for the extraction of higher level features and representations. The second
dense layer has 128 units with ReLU activation. The final layer has a single unit with a linear activation func-
tion that predicts the BGL value.
approach, leveraging both temporal and hierarchical features present in PPG signals for improved blood glucose
prediction.
Coefficient of determination
Coefficient of determination (R2 )38 (Eq. 8) is a statistical measure that indicates the proportion of variance
in the blood glucose values that can be explained by the model. It ranges from 0 to 1, where a value closer to 1
indicates a better fit of the model to the data.
Σi (Yi − Yi′ )2
R2 = 1 − (8)
Σi (Yi − Ȳi )2
• Zone A: This zone represents clinically accurate predictions, where both the predicted and reference blood
glucose values fall within a clinically acceptable range. Specifically, Zone A includes values where the refer-
ence blood glucose level is below 70 mg/dL and the predicted value is also below 70 mg/dL, or where the pre-
dicted value is within 20% of the reference value (i.e., between 80% and 120% of the reference)41. Predictions
in this zone indicate a high level of accuracy and clinical approval.
• Zone B: In this zone, the predicted blood glucose values deviate from the reference values but the discrepan-
cies are clinically benign and would not result in inappropriate treatment decisions. Zone B applies to predic-
Table 4. Comparative performance of three models using 1-second and 10-second segmentation methods:
evaluation metrics across test sets.
Table 5. Clarke error grid analysis for three models using 1-second and 10-second segmentation methods.
tions that do not fall into the more clinically risky zones but still deviate from the 20% range of the reference
value. These discrepancies are minor and do not significantly affect patient management41.
• Zone C: This zone includes predictions that may lead to unnecessary treatment. Predictions fall into this zone
if the reference value is between 70 and 290 mg/dL, and the predicted value deviates by more than 110 mg/dL
above the reference value. Additionally, if the reference value is between 130 and 180 mg/dL, predictions that
fall below a threshold defined by the formula (7/5) × reference − 182 also belong to Zone C. The deviations
in this zone could result in overly cautious or inappropriate treatment41.
• Zone D: Predictions in this zone indicate a potentially dangerous failure to detect hypoglycemia or hypergly-
cemia. This zone applies when the reference value is above 240 mg/dL, but the predicted values fall between 70
and 180 mg/dL, or when the reference value is below approximately 58 mg/dL (175/3) and the predicted value
is between 70 and 180 mg/dL. Additionally, if the reference value is between approximately 58 and 70 mg/dL,
predictions that are greater than 120% of the reference fall into Zone D. These errors may lead to dangerous
clinical outcomes and require further refinement of the prediction model41.
• Zone E: This zone represents the most critical prediction errors, where confusion in treatment may occur.
Predictions fall into Zone E if the reference value is above 180 mg/dL and the predicted value is below 70
mg/dL, or if the reference value is below 70 mg/dL and the predicted value is above 180 mg/dL. These severe
deviations could lead to incorrect treatment, such as mistaking hypoglycemia for hyperglycemia, and result in
harmful clinical decisions41.It is important to note that while predictions falling within Zone B are generally
considered acceptable, the goal is to minimize the number of predictions in Zones C, D, and E to ensure opti-
mal clinical performance and patient safety41. CEG serves as a valuable tool for assessing the clinical relevance
and safety of our predictive model by providing insights into the level of agreement between predicted and
reference blood glucose values and guiding further improvements to enhance clinical accuracy.
from no risk to potentially dangerous. This table displays the percentages of predictions in each zone for the
three models, providing a visual representation of each model’s accuracy and highlighting potential risks
associated with their predictions. Figures 6, 7, 8, 9, 10, and 11 illustrate the assessment of clinical risk levels
using the Clarke Error Grid by distinguishing zones and data points for the test sets of three models across two
segmentation methods. These figures provide a graphical representation of the agreement between predicted
and reference values, visualizing the distribution of predictions within the CEG zones to clarify the models’
accuracy and identify potential areas for improvement. Additionally, Figs. 12 and 13 display the training and
validation loss history throughout the training for three models using 10-second and 1-second segmentation
methods. These figures offer a detailed view of the loss metrics, illustrating performance improvements and
convergence behaviors of the models during the training phases.
In addition, we evaluated our optimal model ResNet34 designed for 1-second segments on the MUST
dataset. The dataset comprises recordings from 23 subjects, each providing multiple 10-second signal segments
accompanied by corresponding BGL test results. Initially, these signals were resampled to a frequency of
100Hz. Subsequently, following the procedures outlined in the data processing and segmentation section, these
10-second segments were meticulously processed to isolate special 1-second segments. These targeted segments
were specifically chosen to contain both systolic and diastolic peaks, aligning with the critical events of interest
as defined in our study protocol. Table 6 presents the performance metrics obtained with the ResNet34 model,
while Table 7 details the results from the CEG analysis.
Moreover, Figure 14 displays the residual plot, from which it can be concluded that there is an absence of
any discernible pattern, indicating excellent model predictions. Furthermore, Figure 15 illustrates the CEG plot,
with the detailed results documented in Table 7. Additionally, Figs. 16, 17, and 18 demonstrate the superior
performance of our proposed method, which benefits from a significantly larger dataset involving three times
more subjects than the nearest competitor, which included 2538 subjects. This extensive dataset has enabled
us to refine our model further, resulting in enhanced accuracy as evidenced by our superior results in both the
Fig. 10. Assessment of clinical risk levels for 1-second CNN-LSTM-ATTENTION predictions.
Fig. 11. Assessment of clinical risk levels for 10-second CNN-LSTM-ATTENTION predictions.
Fig. 12. Training and validation loss for different models using 10-second segments. The plot compares the
performance of ResNet34, VGG16, and CNN-LSTM with Attention models.
Fig. 13. Training and validation loss across different models for 1-second segments.
Table 6. Performance of 1-second ResNet34 using quantitative metrics for MUST dataset.
Zones (%) A B C D E
ResNet34-1s 76.6 23.4 0 0 0
Vgg16-1s 71.3 25.0 3.6 0.1 0
CNN-LSTM-ATTENTION-1s 69.0 24.3 5.1 0.5 0.3
A zone of the Clarke Error Grid and RMSE metrics. This robust performance underlines the effectiveness of
our approach in delivering precise and reliable BGL estimates, setting a new benchmark in the field. Table 8
summarizes these comparisons, highlighting the distinguishing features of our approach. Our study leverages a
significantly larger and more diverse dataset, with 6,388 training and testing subjects (70% train, 15% validation
Fig. 14. Residual plot for predicted blood glucose levels using the MUST dataset. The plot shows the residuals
(difference between predicted and actual values) against the predicted values, helping to assess the accuracy
and consistency of the model predictions.
Fig. 15. Assessment of clinical risk levels for MUST dataset predictions.
Fig. 16. Comparing the number of subjects in the study to the number of subjects in previous studies.
and 15% test) and 67 testing subjects spanning an age range from 0.3 to 94 years. This broad range improves
the generalizability of the model across different age groups, which is an advantage over many prior studies that
often utilize smaller datasets or more limited age groups. Furthermore, our model is compatible with STM32
microcontrollers, enabling real-time, embedded BGL monitoring-setting it apart from previous works which
generally lack embedded compatibility or are designed for non-real-time applications.
When comparing the clinical accuracy of our method to previous studies, we achieve 72.6% accuracy in Zone
A and 25.9% in Zone B, according to the clarke error grid analysis (CEGA). While our performance in Zone B
is lower than some previous works, the versatility and real-time applicability of our approach offer substantial
practical advantages for continuous BGL monitoring in various clinical settings. Additionally, we report a RMSE
of 19.7 mg/dL and a MAE of 14.8 mg/dL in our testing results (Table 6). Our model’s performance, particularly
in terms of RMSE and MAE, highlights the trade-off between clinical accuracy and practical implementation in
resource-constrained environments. In contrast to prior works that often rely on more complex, offline systems,
low number of subjects, our embedded approach with STM32 microcontrollers provides a solution that can
be deployed in real-world, resource-constrained environments. This capability is particularly beneficial for
continuous, accessible BGL monitoring, making it applicable in low-cost, portable devices that can be used in
diverse settings, from home care to clinical environments.
A B
Zone Zone Embedded
Authors Subjects (%) (%) Model Input data Age-range implementation Dataset
Linear Regression / University
Physiological features, features 9-80 Mean
Monte Moreno12 Support Vector Machine / personnel and
410 87.71 10.32 derived from PPG, and other vital = 37.9, SD = No
(2011) Artificial Neural Network ambulatory medical
signals 13.3
/ Random Forest assistance staff
Physiological features, features
J. Yadav et al.27 Multi Linear Regression, 21 - 30 Mean =
50 86.01 13.99 derived from PPG, and other vital No Collected by Author
(2017) Artificial Neural Network 24, SD = 3
signals
The dynamics of meal absorption,
R. Bunescu et al.42 / insulin, and glucose, along with
10 NA NA Support Vector Machine NA No Collected by Author
(2013) a feature generated using ARIMA
modeling
S. Ramasaha yam21 Measurements of light absorption FPGA
55 95.38 4.6 Artificial Neural Network NA NA
(2015) intensities implementation
Jahangir Medical
S. Habbu28 (2019) 611 83.0 17.0 Artificial Neural Network Features derived from PPG 4-70 No and Research
Centre, India
ML
P. Jain et al.25 (2019) 190 97.0 3.0 Deep Neural Network PPG 17-77 implementation Collected by Author
on Arduino
Shantanu Sen Gupta 25-80 Mean =
26 96.0 3.85 Random Forest, XGBoost 17 features derived from PPG No Collected by Author
et al.43 (2021) 30.31, SD=2.38
38 - 80 Mean Institutional Review
1d CNN with micro and
J. Chu et al.26 (2021) 2538 60.6 37.4 Raw PPG = 63.15, SD = No Board of Academia
macro training
9.67 Sinica, Taiwan
Z. Nie et al.44 8 89.6 10.4 Machine learning IPPG, NIR, Feature extraction, RFR 20-35 No Collected by Author
Shisen Chen et al.45 PPG kinetic features, PPG 16-82 Mean=
260 87.39 12.11 Deep Neural Network No Collected by Author
(2024) Derivatives 43, SD= 13.8
6388(train
Deep Neural Network 0.3-94 Mean= VitalDB (train and
Our Work + test) + 72.6 25.9 Raw PPG Using STM32
(CNN) 58.8, SD= 15.1 test) + MUST (test)
67(test)
powerful GPUs, followed by model optimization and secure data transfer, culminating in direct execution from
external flash memory. This approach enhances both performance and operational security, demonstrating a
sophisticated strategy to apply machine learning effectively in power-sensitive environments like IoT and edge
devices.
However, deploying these models on wearable devices presents challenges due to constraints like limited
battery life, RAM capacity, processing power, and potential latency issues46. These factors are critical in scenarios
where the model must be accessible for public and medical purposes. Edge computing tackles these obstacles by
facilitating model inference directly on the local device48, enhancing responsiveness and reducing the need for
continuous cloud connectivity.
However, deploying deep networks on resource limited edge devices necessitates substantial optimization
of compute and memory demands. Networks are generally trained on well resourced servers and subsequently
refined for efficient operation on edge hardware. Primary optimization strategies involve model compression,
utilization of lower numerical precision, and hardware aware adaptation to ensure effective performance within
these constraints46. So, in this section, we discuss the implementation of the ResNet34 model, which was selected
as our optimal model for 1-second segmentation, on the STM32H743IIT6 micro-controller.
Fig. 19. Workflow of embedded systems development: This diagram illustrates the process of inferencing on
an embedded device, beginning with data collection and processing. The workflow involves utilizing a remote
server (Secure Shell (SSH) is employed for secure communication between the local computer and the remote
server) with a 3090 GPU for training and validating models. The selected model undergoes optimization
through pruning and quantization, followed by compilation into a binary format using C++ compilers,
preparing it for execution on the STM32 MCU. The model binary is then transferred from the internal
memory of the STM32H743IIT6 to the external flash memory (W25Q256), enabling direct execution using the
’Execute in Place’ (XIP) function.
Fig. 20. Key specifications of the STM32H743IIT6 microcontroller, highlighting its processing power, memory
and storage capacity, and efficient power consumption, making it suitable for TinyML applications.
through the serial port on the STM32H743IIT6 microcontroller, processing and visualizing the predictions on a
connected computer. This setup was effective in displaying the glucose prediction results in real-time, although
we did not use an external monitor directly connected to the microcontroller.
Table 9, provided in this subsection, details the model size before and after these modifications and includes
the inference time of the model on the device. Additionally, we present performance metrics to demonstrate
the effectiveness of the model in this constrained environment. Also, Figs. 21 and 22 illustrate the process and
comparison of the base model, the pruned model, and the pruning-preserving quantization-aware training
Fig. 21. Mean Squared Error (MSE) loss comparison of three different model types: Base Model, Pruned
Model, and PQAT Model, showing the performance differences in predicting blood glucose levels.
Fig. 22. Size comparison of three different model types: Base Model, Pruned Model, and PQAT Model,
showing the differences in model size in megabytes.
(PQAT). These figures show the MSE loss and the model size, respectively, highlighting the benefits of each
approach.
While the base model is shown in the figures as a reference, it is too large to be deployed directly on
microcontrollers due to memory constraints. The PQAT model, however, provides a significant advantage
over the pruned-only model. As demonstrated in the figures, PQAT reduces the model size while preserving
accuracy, as it incorporates quantization during the training process. This makes the PQAT model the optimal
choice for deployment on resource-constrained microcontrollers, as it strikes the best balance between size,
performance, and efficiency. We conclude that the PQAT model is the recommended approach for efficient
execution in TinyML environments.
Discussion
In this study, we present several key innovations that distinguish our approach in the field of non-invasive
BGL estimation using PPG signals. One of the primary advantages is the introduction of a novel preprocessing
technique that shifts from the traditional 10-second segmentation to a more granular 1-second segmentation.
This finer segmentation allows for capturing crucial physiological details, such as systolic and diastolic peaks,
leading to more sensitive and accurate predictions. Additionally, this 1-second segmentation simplifies and
speeds up the processing on embedded devices, making real-time BGL estimation more feasible in resource-
constrained environments. We tested two methods of segmentation with different time intervals to determine
their effectiveness in predicting BGL from PPG signals. Our analysis showed that using 1-second segments,
which include both systolic and diastolic peaks (one complete cardiac cycle), yielded good results. This suggests
that the sequence of cycles does not significantly impact the prediction accuracy, indicating that longer segments
do not necessarily improve performance.
Moreover, our findings revealed that sequential models like the hybrid CNN-LSTM-Attention, which rely on
the order of data points, are not as effective in this context as deeper models, such as ResNet34, that can capture
more complex patterns within each cycle. Deeper models demonstrated better performance in predicting BGL
from PPG signals. Additionally, the robustness and generalizability of our model were enhanced by utilizing
the largest dataset ever deployed for BGL prediction using PPG technology. This extensive dataset, which
includes a wide variety of subjects and conditions, helped demonstrate that our model performs consistently
across different physiological states, including cases influenced by anesthesia and normal states. The successful
deployment of the model on an embedded device, achieving real-time BGL estimation within just six seconds,
further underscores the practical applicability of our approach.
A key novelty of this work lies in the successful implementation of the model on an embedded device, the
STM32H743IIT6 microcontroller. The deployment of the model achieved real-time BGL estimation within just
six seconds, which demonstrates not only the accuracy but also the practical applicability of our approach in
real-world, resource-constrained environments. The ability to achieve such rapid processing on an embedded
system is a significant advantage for continuous and non-invasive glucose monitoring applications.
Despite these strengths, the study also has some limitations. The system’s performance in predicting extreme
BGL values, such as in cases of hypo- and hyperglycemia, may have been limited by the insufficient representation
of abnormal glucose levels in the dataset, which could affect accuracy in critical scenarios. While the model
performed well within normal glucose ranges, its ability to generalize to rare and extreme cases remains an area
for improvement.
The current dataset, although comprehensive, had a distribution that favored normal glucose levels, which
may have limited the model’s ability to learn from and predict rare abnormal values. Future research should focus
on collecting a more diverse range of data, especially including more abnormal BGL cases, to further enhance
the model’s performance. Finally, refining the balance between short- and long-term signal information will be
necessary to improve the system’s overall reliability, especially in predicting dynamic changes in glucose levels.
Conclusion
This research has successfully demonstrated the practical application of ResNet34 in enhancing non-invasive
glucose monitoring using PPG signals. Our study systematically evaluated three deep learning models, with
ResNet34 emerging as particularly effective in processing and analyzing PPG data, which was collected under
diverse clinical conditions to ensure robustness and accuracy. By adapting ResNet34 for embedded devices, we
achieved rapid and accurate blood glucose estimations, addressing key challenges in diabetes management, such
as the invasiveness and inconvenience of traditional monitoring methods. The implementation of the model on
an embedded device not only provided real time analytics but also maintained high accuracy, crucial for patient
trust and regulatory approval.
The study underscores the importance of comprehensive dataset utilization and continuous model validation
. The use of a novel preprocessing technique that segments PPG signals into more precise intervals significantly
enhanced the model’s predictive accuracy, demonstrating the critical role of fine tuning and optimization in
deploying deep learning models in medical applications. In conclusion, the findings from this research point
towards a future where non-invasive, continuous glucose monitoring can be seamlessly integrated into everyday
life, offering a significant improvement in the quality of life for individuals with diabetes. Future work will focus
on expanding dataset diversity, refining model architectures, and enhancing the computational efficiency of
these systems to further improve their deployment in clinical and real world settings.
Data availability
The datasets and code used in this study are publicly available and can be accessed through the following sources:
VitalDB dataset: The VitalDB dataset31 is publicly accessible at VitalDB. This dataset includes comprehensive pe-
rioperative biosignal data, such as PPG and blood glucose levels, which were used for model training and testing
in this study. MUST dataset: The MUST dataset32, collected by the digital systems research team at the University
of Science and Technology in Mazandaran, Iran, is available for download on Mendeley Data at Mendeley Data.
This dataset includes raw PPG signals and corresponding blood glucose levels. Code and Additional Data: To
facilitate reproducibility and further research, all relevant scripts, additional data, and documentation required
to replicate the findings of this study are available on GitHub. Access the repository at http
s://github.com/m
ahd
References
1. Zhang, Y., Zhang, Y., Siddiqui, S. A. & Kos, A. Non-invasive blood-glucose estimation using smartphone ppg signals and subspace
knn classifier. Elektrotehniski Vestnik 86, 68–74 (2019).
2. Wilcox, G. Insulin and insulin resistance. Clin. Biochem. Rev. 26, 19 (2005).
3. Hossain, S. et al. Estimation of blood glucose from ppg signal using convolutional neural network. In 2019 IEEE International
Conference on Biomedical Engineering, Computer and Information Technology for Health (BECITHCON) (ed. Hossain, S.) 53–58
(IEEE, 2019).
4. Atlas, I. Idf diabetes atlas. International Diabetes Federation (9th edition), Retrieved from http://www.idf.org/about-diabetes/fact
s-figures (2019).
5. Nesto, R. W. Correlation between cardiovascular disease and diabetes mellitus: current concepts. Am. J. Med. 116, 11–22 (2004).
6. MacIsaac, R. J., Ekinci, E. I. & Jerums, G. Markers of and risk factors for the development and progression of diabetic kidney
disease. Am. J. Kidney Dis. 63, S39–S62 (2014).
7. Rojas, D. R., Kuner, R. & Agarwal, N. Metabolomic signature of type 1 diabetes-induced sensory loss and nerve damage in diabetic
neuropathy. J. Mol. Med. 97, 845–854 (2019).
8. Roth, G. Global burden of disease collaborative network. Global burden of disease study 2017 (gbd 2017) results. Seattle, united
states: Institute for health metrics and evaluation (ihme). Lancet 392, 1736–88 (2018).
9. Bommer, C. et al. Global economic burden of diabetes in adults: projections from 2015 to 2030. Diabetes Care 41, 963–970 (2018).
10. Pickering, D. & Marsden, J. How to measure blood glucose. Community Eye Health 27, 56 (2014).
11. So, C.-F., Choi, K.-S., Wong, T.-K. & Chung, J. W.-L. Recent advances in noninvasive glucose monitoring. Med. Dev. Evid. Res.
45–52 (2012).
12. Monte-Moreno, E. Non-invasive estimate of blood glucose and blood pressure from a photoplethysmograph by means of machine
learning techniques. Artif. Intell. Med. 53, 127–138 (2011).
13. Chowdhury, T. T., Mishma, T., Osman, S. & Rahman, T. Estimation of blood glucose level of type-2 diabetes patients using
smartphone video through pca-da. In: Proc. 6th International Conference on Networking, Systems and Security, 104–108 (2019).
14. Gupta, S. S., Hossain, S., Haque, C. A. & Kim, K.-D. In-vivo estimation of glucose level using ppg signal. In 2020 International
Conference on Information and Communication Technology Convergence (ICTC) (ed. Gupta, S. S.) 733–736 (IEEE, 2020).
15. Castaneda, D., Esparza, A., Ghamari, M., Soltanpur, C. & Nazeran, H. A review on wearable photoplethysmography sensors and
their potential future applications in health care. Int. J. Biosensors Bioelectron. 4, 195 (2018).
16. Shokrekhodaei, M. & Quinones, S. Review of non-invasive glucose sensing techniques: Optical, electrical and breath acetone.
Sensors 20, 1251 (2020).
17. Reddy, N., Verma, N. & Dungan, K. Monitoring technologies-continuous glucose monitoring, mobile technology, biomarkers of
glycemic control (2020).
18. Hasanpoor, Y., Tarvirdizadeh, B., Alipour, K. & Ghamari, M. Stress assessment with convolutional neural network using ppg
signals. In 2022 10th RSI International Conference on Robotics and Mechatronics (ICRoM) (ed. Hasanpoor, Y.) 472–477 (IEEE,
2022).
19. Hasanpoor, Y., Motaman, K., Tarvirdizadeh, B., Alipour, K. & Ghamari, M. Stress detection using ppg signal and combined
deep cnn-mlp network. In 2022 29th National and 7th International Iranian Conference on Biomedical Engineering (ICBME) (ed.
Hasanpoor, Y.) 223–228 (IEEE, 2022).
20. Mousavi, S. S. et al. Blood pressure estimation from appropriate and inappropriate ppg signals using a whole-based method.
Biomed. Signal Process. Control 47, 196–206 (2019).
21. Ramasahayam, S., Arora, L., Chowdhury, S. R. & Anumukonda, M. Fpga based system for blood glucose sensing using
photoplethysmography and online motion artifact correction using adaline. In 2015 9th International Conference on Sensing
Technology (ICST) (ed. Ramasahayam, S.) 22–27 (IEEE, 2015).
22. Periyasamy, R. & Anand, S. A study on non-invasive blood glucose estimation-an approach using capacitance measurement
technique. In 2016 International Conference on Signal Processing, Communication, Power and Embedded System (SCOPES) (ed.
Periyasamy, R.) 847–850 (IEEE, 2016).
23. Avram, R. et al. A digital biomarker of diabetes from smartphone-based vascular signals. Nat. Med. 26, 1576–1582 (2020).
24. Allen, J. Photoplethysmography and its application in clinical physiological measurement. Physiol. Meas. 28, R1 (2007).
25. Jain, P., Joshi, A. M. & Mohanty, S. P. iglu 1.0: An accurate non-invasive near-infrared dual short wavelengths spectroscopy based
glucometer for smart healthcare. Preprint at arXiv:1911.04471 (2019).
26. Chu, J. et al. 90% accuracy for photoplethysmography-based non-invasive blood glucose prediction by deep learning with cohort
arrangement and quarterly measured hba1c. Sensors 21, 7815 (2021).
27. Yadav, J., Rani, A., Singh, V. & Murari, B. M. Investigations on multisensor-based noninvasive blood glucose measurement system.
J. Med. Devices 11, 031006 (2017).
28. Habbu, S., Dale, M. & Ghongade, R. Estimation of blood glucose by non-invasive method using photoplethysmography. Sādhanā
44, 135 (2019).
29. Rachim, V. P. & Chung, W.-Y. Wearable-band type visible-near infrared optical biosensor for non-invasive blood glucose
monitoring. Sens. Actuators B Chem. 286, 173–180 (2019).
30. Johnston, L., Wang, G., Hu, K., Qian, C. & Liu, G. Advances in biosensors for continuous glucose monitoring towards wearables.
Front. Bioeng. Biotechnol. 9, 733810 (2021).
31. Lee, H.-C. et al. Vitaldb, a high-fidelity multi-parameter vital signs database in surgical patients. Sci. Data 9, 279 (2022).
32. Kermani, A. & Esmaeili, H. The dataset of photoplethysmography signals collected from a pulse sensor to measure blood glucose
level. https://doi.org/10.17632/37pm7jk7jn.3 (2023).
33. He, K., Zhang, X., Ren, S. & Sun, J. Deep residual learning for image recognition. In: Proc. IEEE Conference on Computer Vision
and Pattern Recognition, 770–778 (2016).
34. Szegedy, C. et al. Going deeper with convolutions. In: Proc. IEEE Conference on Computer Vision and Pattern Recognition, 1–9
(2015).
35. Simonyan, K. & Zisserman, A. Very deep convolutional networks for large-scale image recognition. Preprint at arXiv:1409.1556
(2014).
36. Bickel, P. J. & Doksum, K. A. Mathematical Statistics: Basic Ideas and Selected Topics, Volumes I-II Package (CRC Press, 2015).
37. Willmott, C. J. & Matsuura, K. Advantages of the mean absolute error (mae) over the root mean square error (rmse) in assessing
average model performance. Climate Res. 30, 79–82 (2005).
38. Cameron, A. C. & Windmeijer, F. A. An r-squared measure of goodness of fit for some common nonlinear regression models. J.
Econometr. 77, 329–342 (1997).
39. Paul, B., Manuel, M. P. & Alex, Z. C. Design and development of non invasive glucose measurement system. In 2012 1st International
Symposium on Physics and Technology of Sensors (ISPTS-1) (ed. Paul, B.) 43–46 (IEEE, 2012).
40. Willmott, C. J., Matsuura, K. & Robeson, S. M. Ambiguities inherent in sums-of-squares-based error statistics. Atmos. Environ. 43,
749–752 (2009).
41. Clarke, W. L., Cox, D., Gonder-Frederick, L. A., Carter, W. & Pohl, S. L. Evaluating clinical accuracy of systems for self-monitoring
of blood glucose. Diabetes Care 10, 622–628 (1987).
42. Bunescu, R., Struble, N., Marling, C., Shubrook, J. & Schwartz, F. Blood glucose level prediction using physiological models and
support vector regression. In 2013 12th International Conference on Machine Learning and Applications Vol. 1 (ed. Bunescu, R.)
135–140 (IEEE, 2013).
43. Gupta, S. S., Kwon, T.-H., Hossain, S. & Kim, K.-D. Towards non-invasive blood glucose measurement using machine learning: An
all-purpose ppg system design. Biomed. Signal Process. Control 68, 102706 (2021).
44. Nie, Z., Rong, M. & Li, K. Blood glucose prediction based on imaging photoplethysmography in combination with machine
learning. Biomed. Signal Process. Control 79, 104179 (2023).
45. Chen, S. et al. Multi-view cross-fusion transformer based on kinetic features for non-invasive blood glucose measurement using
ppg signal. IEEE J. Biomed. Health Inform. (2024).
46. Rostami, A., Tarvirdizadeh, B., Alipour, K. & Ghamari, M. Real-time stress detection from raw noisy ppg signals using lstm model
leveraging tinyml. Arab. J. Sci. Eng. 1–23 (2024).
47. Li, S., Walls, R. J. & Guo, T. Characterizing and modeling distributed training with transient cloud gpu servers. In 2020 IEEE 40th
International Conference on Distributed Computing Systems (ICDCS) (ed. Li, S.) 943–953 (IEEE, 2020).
48. Ren, J., Pan, Y., Goscinski, A. & Beyah, R. A. Edge computing for the internet of things. IEEE Network 32, 6–7 (2018).
49. Immonen, R. & Hämäläinen, T. Tiny machine learning for resource-constrained microcontrollers. J. Sensors2022 (2022).
Acknowledgements
The authors would like to extend their gratitude to the contributors of the VitalDB dataset31 for their diligent
preparation and provision of the dataset, which was crucial for both training and testing purposes in this study.
Similarly, the authors wish to thank the contributors of the MUST dataset32 for preparing and providing the
dataset, which was used specifically for testing purposes.
Author contributions
All authors made significant contributions to the research presented in this manuscript and have agreed to its
publication. M.Z. conceptualized the study, led the data analysis, and drafted the manuscript. K.A., B.T., and
M.G. provided supervisory support, were critically involved in the technical aspects of the research, and partic-
ipated in the review and editing of the manuscript. All authors reviewed and approved the final version of the
manuscript
Declarations
Competing interests
The authors declare no competing interests.
Additional information
Correspondence and requests for materials should be addressed to K.A.
Reprints and permissions information is available at www.nature.com/reprints.
Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and
institutional affiliations.
Open Access This article is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives
4.0 International License, which permits any non-commercial use, sharing, distribution and reproduction in
any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide
a link to the Creative Commons licence, and indicate if you modified the licensed material. You do not have
permission under this licence to share adapted material derived from this article or parts of it. The images or
other third party material in this article are included in the article’s Creative Commons licence, unless indicated
otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence
and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to
obtain permission directly from the copyright holder. To view a copy of this licence, visit http://c reativecom
mo
ns.org/l icenses/by -nc-nd/4.0/.