Full text
Universidade do Minho Escola de Engenharia Carlos Miguel Sousa e Silva Monitoring of Marine Animais - Development and Testing of an Oximetry and Heartbeat Sensor junho de 2022 UMinho | 2022 Carlos Miguel Sousa e Silva Monitoring of Marine Animais - Development and Testing of an Oximetry and Heartbeat Sensor
Carlos Miguel Sousa e Silva Monitoring of Marine Animais - Development and Testing of an Oximetry and Heartbeat Sensor Dissertação de Mestrado Mestrado em Engenharia Eletrónica Industrial e Computadores Instrumentação e Microssistemas Eletrónicos Trabalho efetuado sob a orientação do Professor Doutor Luís Gonçalves Universidade do Minho Escola de Engenharia junho de 2022
DIREITOS DE AUTOR E CONDIÇÕES DE UTILIZAÇÃO DO TRABALHO POR TERCEIROS Este é um trabalho académico que pode ser utilizado por terceiros desde que respeitadas as regras e boas práticas internacionalmente aceites, no que concerne aos direitos de autor e direitos conexos. Assim, o presente trabalho pode ser utilizado nos termos previstos na licença abaixo indicada. Caso o utilizador necessite de permissão para poder fazer um uso do trabalho em condições não previstas no licenciamento indicado, deverá contactar o autor, através do RepositóriUM da Universidade do Minho. Licença concedida aos utilizadores deste trabalho Atribuição-NãoComercial-SemDerivações CC BY-NC-ND https://creativecommons.org/licenses/by-nc-nd/4.0/
Este trabalho foi cofinanciado por fundos nacionais através da FCT - Fundação para a Ciência e Tecnologia no âmbito do Projeto de Investigação “ASTRIIS .: Atlantic Sustainability Through Remote and Integrated In-situ Solutions , ref.: POCI-01-0247-FEDER-046092,cofinanciado pelo Fundo Europeu de Desenvolvimento Regional –FEDER, através do SI&IDT Programas Mobilizadores, Programa Operacional de Competitividade e Internacionalização (POCI) -COMPETE 2020, do Portugal 2020,tendo como Organismo Intermédio de acompanhamento à realização do investimento, a Agência Nacional de Inovação –ANI
i Acknowledgements This dissertation marks the end of a journey. A journey through a difficult road, full of bumps, holes and crossroads that would not have been made, had I been alone. So, this won’t feel like the end if I don’t thank everyone that accompanied me and helped me to push through it. To my parents, Maria Manuela and João Luís, for all the love and support, all the sacrifices made, all the patience you had dealing with me and mostly, all the guidance you gave to try and prepare me for what this world has to offer, I give the most special thank you. Without both I would not be who I am nor where I am. To my brother Luís, who was also a guide and a friend throughout my whole life, thank you for all the advice and companionship. A very special thanks to my grandparents, António Neves, and Rosa Cardoso, for always being present and for making sure that in my life I never lacked anything, even if it meant giving me everything they had. A big thank you to my supervisor, Professor PhD Luís Gonçalves, for all the knowledge given, for the availability and for the support through this project. Without him it would have not been possible to accomplish this work. To all my battle brothers and sisters, with special care for Merkel, Dimitri, Pipi, Xico, Rocky, Sofia, Monte, Ponto, Technão and Piggy, thank you for all the help, support, tears, and laughs. This trip was definitely easier with you guys by my side. Also, a great thanks to Henrique, Martinho, Francisco, and Antero, for giving me the truest friendship anyone could ask for. Lastly, to the person who fought all the battles by my side, who supported me through all the lows and shared all the highs. Who always helped me see the light when everything was dark. To Carolina, my wild rose, thank you.
ii Statement of Integrity I hereby declare having conducted this academic work with integrity. I confirm that I have not used plagiarism or any form of undue use of information or falsification of results along the process leading to its elaboration. I further declare that I have fully acknowledged the Code of Ethical Conduct of the University of Minho.
iii Resumo A monitorização marinha tem se tornado bastante popular, com muitas instituições a usar “ tags ”, dispositivos invasivos ou não-invasivos que são implantados em animais para monitorizar alguns parâmetros, usualmente relativos ao seu meio circundante, como a temperatura e a pressão da água, a sua localização, etc. Estes dispositivos são importantes, no entanto, são maioritariamente usados para monitorização de movimento e ainda existem muito poucos meios de monitorizar o que se está a passar dentro dos corpos durante algo como um mergulho profundo, durante caças ou para apenas verificar se o espécimen está saudável. Esta dissertação representa uma tentativa de replicar a tecnologia que é mais comumente utilizada para a medição de saturação de oxigénio e ritmo cardíaco em humanos, adaptá-la e aplicá-la em animais marinhos. O método denomina-se Oximetria de Pulso. Dois dispositivos desenvolvidos com a medição de oximetria de pulso em humanos em mente foram escolhidos, o MAX30100 e o MAX30110 da MAXIM Integrated. Foram analisados, estudados e testados in vivo num animal marinho (Raia Curva), o que deu um vislumbre de como se deve abordar o desenvolvimento de um oxímetro de pulso completo, pequeno, de baixo consumo, versátil para poder ser aplicado na maioria dos animais marinhos e capaz de ser integrado num sistema de monitorização. Os testes realizados em ambiente controlado revelaram resultados promissores relativamente ao uso desta tecnologia em animais marinhos, sem haver a necessidade de grandes adaptações, mas também demonstrou que o verdadeiro desafio é aplicá-la de tal forma que os resultados sejam viáveis. Palavras-Chave: Monitorização Marinha, Oximetria de pulso, não-invasivo, baixo consumo.
iv Abstract Marine monitoring has become quite popular with lots of institutions using tags, invasive or non-invasive devices that are attached to animals to monitor certain parameters, usually of their surrounding mean, like water temperature, water pressure, their location, etc. These devices are important, however, they are mostly used for motion tracking and there are still very few means of monitoring what’s going on inside of their bodies during somethings like deep dives, when they hunt or even if they are in a healthy condition. This dissertation represents an attempt to replicate the technology that is most commonly used for oxygen saturation and heart rate measurement on humans, adapt it and apply it on marine animals. This method is called Pulse Oximetry. Two devices developed for pulse oximetry measuring on humans were chosen, the MAX30100 and MAX30110, from MAXIM Integrated. They were analysed, studied, and tested in vivo on a marine animal (Undulate Ray), which gave an insight on how to approach the development of a small, non-invasive and low-power complete pulse oximeter, versatile so it can be applied in most marine animals and capable of being integrated in a monitoring system. The tests carried out in a controlled environment showed promising results about the use of this technology on marine animals without any major adaptation, but also showed that applying it in such a way that the results are viable is the real challenge. Key Words: Marine Monitoring, Pulse Oximetry, non-invasive, low-power.
xi List of Abbreviations 2D Two-Dimensional. 3D Three-Dimensional. AC Alternate Current. ADC Analog to Digital Converter. ALC Ambient Light Cancellation. BPM Beats per Minute. CO2 Carbon Dioxide DC Direct Current. DFT Discrete Fourier Transform FFT Fast Fourier Transform Hb Deoxyhemoglobin. HbO2 Oxygenated Hemoglobin. HPF High Pass Filter. LED Light Emitting Diode. LPF Low Pass Filter. PCB Printed Circuit Board. PPG Photoplethysmogram. SaO2 Blood Oxygen Saturation SMD Surface Mount Device. SNR Signal to Noise Ratio. SpO2 Peripheral blood oxygen saturation SRAM Static Random Access Memory
1 1. Introduction In this chapter, the motivation, contextualization, the objectives of the project and the structure of the document are presented. The motivation consists of a brief introduction on why it is important to develop this sort of projects and the benefits it could bring for the future of ocean monitoring. The contextualization provides a small explanation of how the core technique that is used works, how it is used and how it is applied in the context of this dissertation. The next point is an enumeration and description of the objectives that were defined in order to achieve valid results. The last point of this chapter acts as a guide for the reader through the whole document. 1.1 Motivation In a world that is being tormented by pollution and over-hunting, improving the ways of monitoring ecosystems and their inhabitants is crucial. Some monitoring/tracking devices are available for use in these applications, mainly implementing motion tracking. However, monitoring the physiological parameters of marine animals (e.g., oxygenation, heart rate) is still a very recent reality for ocean biologists. This kind of monitoring not only unveils the heath state of the animal, which allows to better understand the diseases that might plague it or could be a direct indicator of a problem in the ecosystem but can also be used to uncover something like the physiological phenomena that occur during the long deep dives of some cetaceans. Having said this, having small, non-invasive devices that can track the vital signs of a marine animal, while causing minimal impact on its lifestyle has become a necessity since it is a less harmful way than conventional methods. 1.2 Contextualization A typical human being can go on average, about three months without food and three days without water, but only about two or three minutes without oxygen. After that, the lack of oxygenation to the brain causes a faint - a protection mechanism of the body to force the person to start breathing again. It is safe to say that oxygen (O2) is one of the most important elements required to sustain life. O2 is acquired through the lungs in the process of respiration, where it bonds with red blood cells which become Oxygenated Hemoglobin (HbO2) and flow through the circulatory system to provide O2 to the body. Then, after
2 delivering, they bond with the CO2 from the cells and become Deoxygenated Hemoglobin (Hb) and go to the lungs again, to the pulmonary alveoli, to replace the CO2 with O2, completing the cycle (Figure 1.1). Figure 1.1 - Respiration Cycle Blood oxygen saturation (SaO2) is the ratio of HbO2 to total Hb, and usually in a healthy human specimen it should be between 95-100%. Even expert clinicians are only able to detect signs of low SaO2 when the patients skin starts turning blue, at about 85%. When this happens, the doctor might only have close to three minutes to prevent the risk of brain damage, heart failure or death [1].Because of these risks, it is very important to keep track of SaO2 as it is a very good indicator of a patient’s health, human or nonhuman. The most common technique to estimate SaO2, and the one that will be approached in this dissertation is Pulse Oximetry. Pulse oximetry is a non-invasive test for estimating SaO2 by interpreting the peripheral blood oxygen saturation (SpO2) using two light sources. It is also able to detect heart pulses, so it can also be used to calculate the heart rate. Typically, an infrared light emitting diode (LED) and a red or green LED are used along with a photodiode to capture the light. Depending on the measurement site, either the transmissive or reflective method can be used. For the transmissive mode, the LEDs are placed on the opposite side of the photodiode. The reflective mode uses the LEDs and photodiode on the same side. Transmissive mode pulse oximeters are the ones used most due to their accuracy and stability since the light sources are directly transmitted to the photodiode. This operation, on humans, is usually carried out on a finger or on the ear lobe, because this technique requires that the place of measurement must be thin [2]. For this reason, the demand for reflective mode oximetry is increasing as it does not require a thin measurement site. It can be used in diverse measurement sites such as the feet, forehead, chest, and wrists, as long as its vascularized [3].
3 Pulse oximeters have been commercially available for some time and have seen a tremendous increase in popularity, becoming a standard in critical care monitoring devices in hospitals and operating rooms. The instrument transcutaneously estimates the oxygen saturation of arterial blood and provides vital information about a patient's cardiorespiratory functions. There are already a lot of options of pulse oximeters for humans, and they work in most land mammals, but as for wild marine animals in general the story is not the same. There are not a lot of options, what exists is usually invasive and doesn’t provide real time measurements. Having something like a regular pulse oximeter for humans, but specialized for marine animals, would provide a lot of insight into what happens inside their bodies during their normal daily activities, when they do deep dives or when they hunt, and would also allow to keep track of their health. The focal point of this dissertation would then be to develop a prototype of a device that allows the application of this technique on most marine animals. It may seem odd to try and develop a device that works both on fish and on mammals, but, despite some differences, the blood vessels of fish are analogous to those of other vertebrates. However, the heart of most fish does not pump oxygenated blood like the heart of a mammal, but rather venous blood to the gills for respiration. As it is important for the device to be versatile, the technique studied in this project is the reflective mode pulse oximetry. This only makes sense accounting the fact that it is a lot more forgiving regarding the choice of location to take measurements. 1.3 Objectives The final goal of this dissertation is to develop a prototype of a device that can be applied along with a coupling mechanism to marine animals, to take heart rate and SpO2 measurements using reflective mode pulse oximetry. The prototype will be paired with additional circuitry, to transmit the measurements via UART, so there will be no need for storing data. To aid in achieving this, a set of objectives was envisioned as seen below. ➢ Comparison of commercially available sensors This is the first objective of this dissertation, as it is directed towards the development of a fully operational prototype as it was said above and using commercially available devices would make it a lot easier than having to design the hardware from scratch. It was concluded by having two different Heart Rate and SpO2 kits tested.
4 ➢ Use of commercially available components for measurement in marine animals This objective was concluded using the Heart Rate Click board and an STM32 Microcontroller and programming it with an application software using C language. Using humans as test subjects this objective allowed to refine the filters used for digital filtering and the algorithms for heart rate and SpO2 calculation. ➢ Hardware development for oximetry and heartbeat sensor prototype After the results from the first objective are deemed acceptable, the next stage can be set in motion, which involves the development of a PCB (Printed Circuit Board), including a mimicked version of the Heart Rate Click Board hardware, an integrated microcontroller, voltage regulators and connectors to allow a battery to be fitted. ➢ Software development for prototype oximetry and heartbeat sensor Aligned with the last objective, since the microcontroller of the prototype is slightly different from the one used for the early tests, there are some software changes that need to be addressed. Not only for this reason, but also because the prototype needs to be able to store/transmit the data acquired from the test animals, to be interpreted. ➢ Sensor Miniaturization Once the previous design is tried and tested, the PCB size must be reduced. This is made considering that the final device should be as small as it can be so that the impact on the animal lifestyle is minimal. ➢ Development of a functional prototype to be tested in vivo The in vivo tests consist of placing the prototype against the test animal’s skin in a controlled environment, so the prototype should already be small and encapsulated in a waterproof case. The LED’s and photodiode will also be placed in such a way that there is little to no distance between them and the animal’s skin. The purpose of this objective is to take all this into consideration so that the device’s measurement errors are minimized and to take conclusions on how to place it in using a coupling device.
5 ➢ Testing in a real environment Lastly, the prototype will be paired with the battery and a coupling device, so that it is able to be tested on an animal in a real environment. This objective is the culmination of all the previous ones and will represent the conclusion of the final device. 1.4 Document Structure This point acts as a guiding thread through the entire document, to allow the reader to understand better the thought process behind the structure of this dissertation. Following this chapter’s brief introduction, a literature review of the state of the art was made, where the main technique used throughout this project is explained, as well as the device used to apply it, the different ways of applying it, what is available commercially and some of the limitations intrinsic to this technology. From there, the third chapter begins, and it is where the first implementation of a device using a pulse oximetry sensor was made, as well as the description of another sensor that was used for testing purposes. Chapter four refers to the implementation of a complete pulse oximeter with an embedded microcontroller unit and all the steps involved in this process. Chapter five is solely dedicated to all the tests made, in humans and in marine animals, to attempt in proving that this technology can indeed be applied in marine animals for monitoring purposes. Lastly, the final chapter presents the conclusions taken from the entire project and some of the future work that can be made to improve the project and to make it easier for someone who decides to pick up the work where it was left.
6 2. State of the Art In this chapter, some aspects of the technology used are going to be discussed in-depth, starting with the method used to detect the heart rate and estimate the SpO2. Then the device itself, and some of its iterations with different principles of functioning. Lastly, some of the considerations that are needed for projects involving wild marine animals. 2.1 Pulse Oximetry Pulse oximetry is the non-invasive optical technique that is more commonly used to determine the heart rate and blood oxygen saturation of a specimen. This technology exists due to contributions coming from as far as the 1700s, with Johann Lambert which formulated a law stating that the absorbance of a material sample is directly proportional to its thickness. After that in the 1800s, August Beer added that the absorbance is proportional to the concentrations of the attenuating species in the material samples. The combination of these ideas became known as the Beer-Lambert Law and is considered the scientific cornerstone behind pulse oximetry. This law states that the intensity of light decreases exponentially while traversing through an absorptive medium. It is this diminishing in intensity that allows this technique to work, since this is what is seen in the photoplethysmogram (PPG) [4]. But a lot of other very important contributions were made before the technique became what it is today. It was only in 1972 that Takuo Aoyagi, a bioengineer, developed the first iteration of the method that is currently used [5][6]. Figure 2.1 - Extinction Factor of Light Through Hemoglobin [9]
7 As it was said in the contextualization, the way this technique works is, a photodetector absorbs light energy, which can be used to monitor a patient’s pulse rate and oximetry. It is a cheap optical process that can be used to perceive changes in the blood volume of the capillary beds of body tissues. The induced voltage of the photodetector changes along with the volume of blood flow in the vessels. This fluctuation from the heart pulses is used to calculate the heart rate [7]. Pulse oximetry estimates SaO2 based on the light absorption properties of red blood cells. Hb changes its light absorption attributes when mixed with oxygen. Pulse oximetry exploits difference in light absorption between Hb and HbO2. HbO2 absorbs more red light (660 nm wavelength) and lesser infrared light (940 nm wavelength) than Hb as it can be seen in Figure 2.1 [3][8]. The PPG carries both an Alternate Current (AC) and a Direct Current (DC) component. The DC component is there because of reflective material that is always present such as skin, muscles, bones, and venous blood. The AC component will consist mostly of the light reflection of pulsatile arterial blood. This component is usually tainted due to motion artifacts since this test is very motion sensitive. It should be noted that only arteries carry an AC component, venous blood only contributes to the DC component of the signal. Figure 2.2 and Figure 2.3 tear down exactly what was just said. Figure 2.2 - Light intensity attenuation through tissue [4] Figure 2.3 - Cross Section Comparison of Arteries and Capillary/Veins [10]
8 2.2 Pulse Oximeter The most basic approximation of a pulse oximeter circuit is as seen below in Figure 2.4. This is by no means similar to the circuits that are inside the boards used throughout this dissertation, as they are more sophisticated, but it helps to get a better notion of how the system works. Figure 2.4 - Basic Pulse Oximeter Circuit In a very crude way, the task of the circuit on the left is to power and drive the L1 LED, whose light is reflected in the tissues and received by the photodiode D1, which converts into a voltage that is amplified by U1. The output signal from U1 would be sent to a microcontroller to be processed and interpreted. Important to note that with this setup you can only measure heart rate, as to also estimate SpO2, there must be a replication of this circuit with a second LED as both are needed to estimate SpO2. The output signal from this type of circuit looks like the one on Figure 2.5. It is in this signal that it is seen the slow contraction followed by the quick dilation of the blood vessels, from the sudden increase in volume corresponding to the heartbeat of the specimen. Figure 2.5 – Photoplethysmogram
9 Reflective vs Transmissive Pulse Oximetry Picking up on what was said previously in the contextualization, there are two types of oximeters that make use of this technology. The reflective mode and transmissive mode pulse oximeters. The general behaviour of them is the same, two LEDs of different wavelengths, one photodiode to detect light. They differ in the position of the LEDs relative to the photodiode and what exactly the photodiode detects. For the reflective mode, as the name states, the light pulses are directed toward the tissues, and the photodiode is placed near them, on the same side of the measuring site, and detects only what is reflected by them. For the transmissive mode, the measuring site is placed in between the LEDs and the photodiode, and it detects the amount of light that was able to pierce through the tissues. A simplistic image of these modes of operation can be seen in Figure 2.6. Figure 2.6 - Reflective Pulse Oximetry vs Transmissive Pulse Oximetry Commercially Available Devices Nowadays pulse oximeters have become very common, and there are a lot of devices that include them as one of their features. Not only for medical applications, but also in sports since it is a cheap option to keep track of heart rate and SpO2 during effort. The most common uses for the reflective technology are present in devices like smart watches (Figure 2.7 on the left), where the LEDs pulse on the wrist, and give immediate readings. It is in these applications that are usually used green LEDs instead of red ones, because they have a lower tendency to induce errors due to motion artifacts, at the cost of lower penetrating power and sensitivity to darker skin colours. In most medical applications the transmissive technology is the current choice (Figure 2.7 on the right) because it isn’t as limited in terms of results. It
16 3.3 STM32F767ZI MCU Figure 3.4 - STM32F767ZIT6 Nucleo 144 During this early stage of investigation, testing and development, the device chosen for the task of receiving and processing the sensor data was the STM32F767ZIT6 Nucleo 144 development board. This board contains the STM32F767ZI MCU, which is a 20 x 20 mm chip with a 216 MHz Arm® Cortex®-M7 core, 2Mbytes Flash and 512 Kbytes Static Random Access Memory (SRAM) [14]. The development board can be seen in Figure 3.4. With these characteristics, it is capable of receiving and processing the data quickly even when the processing consists of applying complex filters and making calculations with the resulting signal. This board is used mainly for developing purposes, but in a future PCB implementation, a smaller, low power version of this microcontroller will be used. The connection diagram between sensor, microcontroller and computer can be seen in Figure 3.5 and in Figure 3.6 the real setup. As it was said before, the communication between sensor and microcontroller happens via I2C and between microcontroller and computer via UART. Also, a breadboard was used to assist in the connection of the board to the microcontroller during the earlier stages of development. The power lines, 3.3 V and GND were connected to the respective 3.3 V and GND from the STM board. The INT, SCL and SDA lines were connected respectively to the PB0, PB6 and PB9 pins.
17 Figure 3.5 - Connection Diagram Figure 3.6 - Sensor, microcontroller, and computer setup for testing purposes 3.4 Software Software-wise, the approach is pretty straightforward. The computer language chosen for this project was C/Keil C and the first step was to establish the connection sensor-MCU and MCU-computer so that the data can be sent and received for processing and visualization. The unprocessed samples can be analysed and used to make the heart rate and SpO2 calculations manually using the computer, but they are very noisy, thus making it impossible for the MCU to use them without first processing them. This brings us to the second step, where the raw samples go through digital filters to remove noise and the DC component of the signal. The last step is the development of functions to compute the heart rate and SpO2 effectively.
18 Important to note that to make the task of optimizing the filters easier, all the digital filtering and calculations were first made using MATLAB since this is a very user friendly tool when it comes to digital processing. But, to complete this, an Open Source library for the MAX30100 sensor in C was used, as it was still needed to transmit the data to the computer via UART [15]. There was no need for software development in this stage as the library already had all the functions required. Once the results were deemed satisfying, the next stage could take place, which was the implementation of similar filters and making those same calculations using the microcontroller. Lastly, for the sake of consistency some parameters that were selected for the sensor will always be the same through the entirety of the project. These parameters are the sensors sample rate which will be kept at 50 Hz, for power saving, and the LED pulse width will be 1600 µs, that corresponds to an 8% duty cycle. 3.4.1 Filtering MATLAB was the software chosen for the first implementation of the digital filtering, because it has all the tools required to design digital filters easily. It has the Filter Designer which is a very useful and intuitive tool when it comes to designing and analysing filters. It allows the user to set all the parameters to match the specifications required for the project. Having said this, it makes sense to use this tool to design and optimize the filters, before heading towards their implementation in C language. To better understand what needs to be made, the first step is to look at the raw data. Figure 3.7 - Raw Red Samples (Top) and Raw Infrared Samples (Bottom) Figure 3.7 is taken from the MATLAB plotting tool where the signal was captured with the 50 Hz sample frequency, which means that each sample has a 20 ms period. At first glance it can be seen that there is a lot of high frequency noise that must be mitigated. Because of that, a Low Pass Filter (LPF) was
19 implemented. The cut off frequency of the LPF had to be higher than 1 Hz, so as to not lose the heartbeat oscillation (1 Hz corresponds to 60 beats per minute (BPM)), and lower than 5 Hz, to filter most of the noise and keep the fundamental frequency of heartrate. After some trial and error, between the response time and the noise cancellation, the conclusion was that the most efficient frequency was 3 Hz, instead of 5 Hz. Besides that, there was still the need to remove the DC component to make the process of acquiring the heart rate easier and for the SpO2 calculations. The DC component is the 0 Hz frequency element of a signal, so, to remove it, it is also applied a High Pass Filter with a cut off frequency very close to 0. The closer it is to 0, the more effective the filter is but it also becomes very slow to stabilize, the further away from 0, it’s the opposite, it is quite fast to stabilize but also less effective. After comparing results, a 0.3 Hz cut off frequency was chosen. Lastly, the signal was inverted because that makes it easier for the software to acknowledge the heartbeat peaks. The magnitude response of the implemented filters can be seen in Figure 3.8. Figure 3.8 - Top: Magnitude response of the Low Pass Filter; Bottom: Magnitude response of the High Pass Filter The results from applying these filters are shown in Figure 3.9 (Red and infrared samples not taken at the same time).The results are as expected, after applying the LPF, most of the noise is cancelled, and after going through the HPF, the DC component is removed, leaving a clean signal with distinct peaks that can now be used to calculate the heart rate and SpO2.
20 Figure 3.9 - Filter Results in MATLAB 3.4.2 C/Keil C Implementation Having attained the desirable results on MATLAB, the implementation in C can be tackled. Aside from some functions in the library that were used, it was still required to code the most important ones, since the library didn’t feature any signal processing, heart rate or SpO2 calculator functions. Research was made, because, despite finding support to some extent, most of what was found was not reliable enough. So, in the end, what mostly happened was an adaptation, and mix of different approaches, until all implementations were considered to be good enough. 3.4.2.1 Algorithm Flow Charts Flow charts of the three main components of the code were made to help in the understanding of the thought process behind the developed software. These correspond to the main code, the interrupt routine and the data processing. Main code The main code begins with the configurations of the peripherals of the microcontroller, followed by the configurations of the MAX30100 sensor. The microcontroller configurations were made using STM32CUBEmx software, and the sensor configurations were made with the MAX30100 C library. After that, the UART is activated and waits for a character (char) to be received. After the char has been received, the program waits for the external interrupt from the sensor, as it is the indication that the FIFO of the sensor is full, and the data can be read. From there, we enter the Interrupt Routine where the data is collected and then there is a flag that signals that all the data has been collected and is ready to be processed, so if the value of the flag is ‘1’, the program enters the stage of data processing (Figure 3.10).
21 Figure 3.10 - Main Code Flow Chart Interrupt Routine Has said above, in this routine the data is collected, 16 samples at a time. But in terms of processing, 16 is a very low number of samples, so, while the value of the flag is ‘0’, the program keeps entering a function that gathers a predetermined number of samples. This number of samples is defined by the user based on the desired application. Once the function finished collecting, the value of the flag is set to ‘1’ so that the program knows that it can enter the final stage, the data processing (Figure 3.11).
22 Figure 3.11 - Interrupt Routine Flow Chart Data Processing Following the flow, the first thing that happens in this component is a test of the flag value. If it’s ‘0’, not enough samples have been saved, so the program has to wait. If it’s ‘1’, the data is ready for the processing. The processing consists of applying the low and high pass filters to both the red and infrared signals. After that, the low pass filtered infrared data is used in the “FindPeaks” function, whose duty is to find the location of the peaks in the signal and save them in an array. This array is then passed to another routine, that uses the locations found to calculate the period of the signal and use that to calculate the heart rate. After that, the filter data is used again, now to estimate the SpO2. In the end, the flag value is set at ‘0’ so the program knows that it can start collecting samples again (Figure 3.12).
23 Figure 3.12 - Data Processing Flow Chart 3.4.2.2 Signal Processing Using what was learned the MATLAB phase of the project, the execution of the signal processing in C began with the development of a 3 Hz LPF and a 0.3 Hz HPF. After searching, and applying different types of approaches on filters, all with less favourable results, a website was recommended that had filter implementations that matched the needs for the project and that could, with some adaptation, function in this application [16]. The filters chosen for the application were a Butterworth LPF and a Butterworth HPF. The implementation was not in conformity with the methodology that was being used in the project so the first thing that was done was to save processing power, and so, the calculation of coefficients was made into a function that runs before the “while(1)” loop, so that after the boot, they only need to be calculated once. Then the filtering was split into two different functions, one that receives every sample, and feeds them to the other, which filters them one by one and returns the filtered sample. The process begins when the program initiates, with calculating the constants used in the filters based on the desired sample frequency, order and cut off frequency. Four filters are used, but because the same LPF and HPF are used for the red and infrared signals, the coefficients are duplicated. So, it only makes sense to use the LPF coefficients in both LPFs and the same for the HPFs. Then, once the
24 “CollectSamples” routine is completed, the raw red and infrared samples are fed as an input to the LPFs. The output of this is fed to the HPFs. These actions can be visualized in Figure 3.13. Figure 3.13 - Signal Processing Block Diagram The magnitude response of the implemented filters can be seen in Figure 3.14 and the resulting data from applying them can be analysed in Figure 3.15. Taking into consideration Figure 3.7 representing the raw data, as can be seen, the LPFs do their job of removing most of the noise and leaving two fairly clean signals. The HPFs receive these signals, remove the DC component, and invert them. Overall, the results are as expected, and the outputs can now be used in the next step. Figure 3.14 - Top: Magnitude response of the Low Pass Filter Implemented in C language; Bottom: Magnitude response of the High Pass Filter Implemented in C language
25 Figure 3.15 - Digital Filtering Results 3.4.2.3 Heart Rate Calculator The heart rate calculation is divided in two main parts. The first part being the “FindPeaks” routine, to detect the peaks present in the signal and the second the heart rate calculator. The approach for finding peaks in the signal was changed from finding the actual peaks from the PPG, to finding the peaks where the highest gradient is found. This made this task a lot easier, and the approach will be explained below. For the “FindPeaks” routine, the implementation began with a simple question: “What is a peak?” To which the answer is rather simple, “The peak of a signal is the point that has a higher value than both the previous and the next point”. Putting it this way, it seems basic, but in a signal that usually has some residual noise and undesirable peaks, this statement is recurrent. An example of this is seen in Figure 3.16. In green are the peaks that should be considered for the heart rate calculation, and in red are examples of the ones that shouldn’t. Figure 3.16 - Green: Desirable Peaks; Red: Undesirable Peaks Looking at the figure above, it is noticeable that some conditions can be implemented to make the MCU acknowledge the right peaks. The first condition implemented was, any peak that is below the average
32 4. Implementation Results After confirming that the technology aimed and developed for humans could work for marine animals without a lot of adaptations, the next stage was set in motion, which was the development of a miniaturized version of a device, with an embedded microcontroller. Basically, an all-in-one low-power prototype capable of being attached to an animal and without any peripherals, that is capable of collecting and processing the samples, make the SpO2 and heart rate calculations and transmitting the results via serial port. 4.1 Low Power Implementation The first step of this topic is to choose all the components required for the correct functioning of the prototype. A battery is going to be used to power the device, and it outputs 4 V when fully charged and drops to 3.1 V when discharged, so, a voltage regulator is necessary to keep the power supply from the battery constant. This powers the MCU, but the sensor requires a different voltage to work properly, 1.8 V being the typical value, so there’s a need for another voltage regulator, in this case, one that drops the power from 3.1 V to 1.8 V. After this, the MCU needs a clock so, a low speed external crystal was chosen. From there, the remaining components are passive and because of that, were chosen for the most part based on their price. As it is important for the prototype to work for as much time as possible, power consumption is a priority. When choosing hardware for this solution, three metrics were followed to improve battery life: active power consumption, standby power consumption and quiescent current (IQ). In the end, only three components are actively consuming power, the MCU and the voltage regulators. For that, the reasoning behind their choices is discussed below. MCU The MCU used in the first stages of this project, the STM32F767ZI has an Arm® 32-bit Cortex®-M7 CPU, so it is very capable, but in terms of size and power consumption is by far not the best. So, an alternative had to be found and special attention was given to devices featuring an Arm® Cortex®-M0+, which is usually used for low-power and ultra-low-power applications. Taking this into consideration, the MCU chosen for the application is a STMicroelectronics device, from their ultra-low-power line, the L051K8T6TR. This is a 7 mm x 7 mm chip with a 32 MHz Cortex®-M0+,
33 64 kB Flash, 8 kB SRAM, 2 kB EEPROM and 27 GPIOs [17]. Thanks to the small size and low power consumption (Table 4.1), this MCU is good choice for the proposed application. Table 4.1 - STM32L051K8 Specifications MCU Core Power Supply Consumption Size Flash Max. CPU Frequency STM32 L051K8 Arm® Cortex® -M0+ 1.65 V – 3.6 V 88 μA/MHz @ run 0.27 μA @ stop 0.4 μA @ standby 7 x 7 (mm2) 32 kB 32 MHz Sensor The choice of pulse oximetry and heart rate sensor was kept the same because the software developed was already developed specifically for the MAX30100 and changing it at this point would add difficulty and unnecessarily delay the development of the project. And since it has good power consumption, consuming an average of 600 μA, it is the best choice (Table 4.2) [13]. Table 4.2 - MAX30100 Specifications Sensor Power Supply Consumption Size Interface Low Power Modes MAX30100 1.7 V – 2.0 V (Sensor) 3.1 V – 5 V (LEDs) 600 μA 5.6mm x 2.8mm I2C Shutdown Voltage Regulators As it was said above, the main concern when choosing the voltage regulators was the quiescent current. This current can be defined as the amount of current used by an IC when in a quiescent state, which roughly translates to any period of time in which the IC is in either no load or non-switching condition, but still enabled. So, it is quite important in mobile applications where maximizing battery life is essential. Based on this, to regulate the voltage to 3.1 V it was chosen the TPS7A0531PDBVR which is a LowDropout regulator (LDO) with a very low, 1 μA IQ [18]. The 1.8 V required to power the sensor were achieved using the ADP166AUJZ-1.8-R7 which is also a LDO with an 890 nA IQ with 1 μA load [19].
34 Table 4.3 - Voltage Regulators Specifications Voltage Regulator Input Voltage Output Voltage Output Current Quiescent Current TPS7A0531PDBVR 1.4 V – 5.5 V 3.1 V 0 – 200 mA 540 nA w/ 0 μA Load 890 nA w/ 1 μA Load ADP166AUJZ-1.8R7 2.2 V – 5.5 V 1.8 V 0 – 150 mA 1 μA The use of switching voltage regulators was also considered. However, due to small voltage drops expected in the application (4 V to 3.1 V in the primary regulator and 3.1 V to 1.8 V in the secondary regulator), the efficiency of switching regulators becomes similar to linear regulators, and therefore, the linear option overcomes the other in design simplicity. Power Supply The requirement of this project for battery life is that it must last at least 72 hours. With this in mind, to choose the battery, the total power consumption of the device has to be considered as it is what defines the capacity that the battery needs to have in order to last the amount of time defined. Table 4.4 - PCB Component Power Consumption Component Active Sleep MAX30100 3.6 mA 730 µA Microcontroller 8 mA 21 µA Voltage Regulators 65 µA 1 µA The theoretical total current consumption value can be estimated from the sum of the consumption from each individual active component as seen in Table 4.4.
35 This adds up to a little bit less than 12 mA active consumption and less than 1 mA sleep consumption. As this is only theoretical, it will be considered that the device consumes 15 mA to provide some margin of error. 72 ℎ∗ 15 𝑚𝐴=1080 𝑚𝐴ℎ For the device to continuously take measurements for 72 hours straight, the battery must have a capacity of at least 1080 mAh. As 72 hours is the minimum, a larger battery will be chosen, for the device to have a larger battery life, in this case, the LG Lithium Ion INR18650 F1L 3350 mAh. 3350 𝑚𝐴ℎ 15 𝑚𝐴 =223,33 ℎ With this device and this consumption, the device can last about 223 hours on one charge which translates to roughly 9 days. 4.2 PCB Design With all the active components chosen, the process of making the PCB to affix them in designated locations can begin. This process consists of two steps, with the first being the drawing of the circuit schematic and the second being the implementation of the PCB. These steps were made using the software Altium Designer. 4.2.1 Circuit Schematic To better understand what was done, the approach will be to tear down the complete design in subcircuits and they will be explained individually. Having said this, four main subcircuits can be identified. The MCU subcircuit, the sensor subcircuit and the two voltage regulators subcircuits. There are also some other components that are necessary such as resistors and decoupling/bypass capacitors. Decoupling/Bypass Capacitors The first component that will be mentioned will be one that is seen through both the MCU and sensor circuits, the decoupling or bypass capacitor. This tool is used because active devices are connected to their respective power supplies using traces that have finite resistance and inductance. There are situations in which the current drawn by them changes, causing the voltage drop between the power supply and the device to change accordingly, due to these impedances. If this happens with several
36 devices, there’s a chance that the operation of one of them causes a voltage change large enough to affect the others. The decoupling capacitor offers a route for the transient currents, rather than letting them flow through the common impedance [20]. Having said this, five capacitors, one 1nF, two 10 nF and two 100nF were included in the schematic with the intention of being placed, one near the MCU, and the other four, two near both VDD inputs and two near the VDDA inputs (Figure 4.1). Figure 4.1 - Decoupling Capacitors The remaining ones that were added will be mentioned below, in the text concerning the sensor subcircuit. MCU Subcircuit Figure 4.2 - MCU Subcircuit The MCU Subcircuit (Figure 4.2) will essentially contain all the components used for it, and its desired peripherals, to operate correctly, in particular the Reset, the Bootloader and the clock input.
37 For the Reset are used a 100 kΩ pull-up resistor connected to the 3.3 V and a 10 nF decoupling capacitor connected to the ground. For the Bootloader a 10 kΩ resistor is used connected to ground. As a clock input, a 32.768 kHz crystal is used with both terminals coupled to capacitors connected to the ground. Sensor Subcircuit The MAX30100 sensor requires three pull up resistors for the I2C communication lines and for the Interrupt line, the value chosen was 47 kΩ. Besides that, a 10 µF and a 100 nF capacitors are used in the same way as the ones for the MCU, as decoupling capacitors, placed near the power inputs of both the LEDs and the sensor. All this is represented in Figure 4.3. Figure 4.3 - Sensor Subcircuit Voltage Regulators Subcircuits Both voltage regulator circuits included additional components as advised in their respective datasheets, to ensure the correct functioning of the devices. For the TPS7A0531PDBVR (Figure 4.4), it is recommended to use an input capacitor to minimize transient currents drawn from the power supply and an output capacitor to greatly improve the load transient response. In the case of the ADP166AUJZ-1.8R7 (Figure 4.5), the input capacitor ensures stability for the device and the output capacitor is included for the same reason as the other regulator, to improve the transient response from the load.
38 Figure 4.4 - 3.1 V Voltage Regulator Subcircuit Figure 4.5 - 1.8 V Voltage Regulator Subcircuit Ports Figure 4.6 - Included Ports In addition to all the components, ports were included in the design for the input of power, the programming of the MCU, the UART communications and, if necessary, exterior drivers for the sensor’s
39 LEDs (Figure 4.6). They are very important, especially in first or early implementations of PCBs as they provide easy access not only to the points required for outward connections, but also for finding errors in the PCB. Now that all the subcircuits were mentioned and explained, they can be seen all together in Figure 4.7 which shows the complete schematic. From there, the implementation of the PCB can begin as will be discussed in the next subchapter. Figure 4.7 - Complete Circuit Schematic 4.2.2 PCB Implementation For the design of the PCB, there were two main points to be kept in mind, as to increase the chances of developing a successful prototype: • It should be as small as possible • It will have to be waterproof Knowing this, the components were arranged in a way so that the overall size would be as small as possible, while also bearing in mind that they will have to be hand welded. This is an important point, although not crucial, because surface mount devices (SMD) are already hard to weld, even while having some room to work with, so everything that does not need to be very close to other components, was given a little space. To help with the task of waterproofing, the main decision taken was that all the
40 components would be placed on one side of the PCB, with the exception of the sensor that would be placed on the opposite side. This allows for easy utilization of resin again, since even if some components are taller than the sensor, they are on the other side, and can be completely encased, posing no problems or risks whatsoever. With all this in mind, the design was addressed almost in a similar fashion as the schematic, with the board being “divided” into subcircuits. These were then placed in strategic positions, in a balance between being near crucial points for that subcircuit like power inputs or the microcontroller and being placed in such a way so that the traces are as short as possible, because long traces can become antennas that generate unwanted noise. This is especially important in low power solutions. Figure 4.8 represents in 2D the final layout of the components as they stand on the PCB. The red lines represent the top layer traces and the blue ones, the bottom layer traces. It may not be perceivable at first, but the components are grouped in sub-circuits throughout the layout (please note Figure 4.9). Figure 4.8 - 2D PCB Layout
41 • The green background areas numbered as “1” contain both voltage regulators circuits, and their associated components. • The yellow background areas numbered as “2” contain the sensor circuit. Some components like the pull-up resistors don’t have to be placed near the sensor, so they were placed where it suited best. • The blue background area numbered as “3” contains the MCU circuit with the crystal and all the remaining components. The remaining squares and circles that are placed near the outward edge of the board are all the ports that were included and placed there since the edge makes the access to them easier. Figure 4.9 - PCB Sub-circuits All that’s left is to send the PCB documents for printing and then weld all the components in their rightful places. The resulting top and bottom layers should look something like Figure 4.10. The real PCB after printing is seen in Figure 4.11. The final size is 39 mm * 24 mm, so it is smaller than the entire Heart Rate Click Board, while also having an embedded microcontroller. This means that dimension wise, the miniaturization was a success. It is ready for testing all the continuities and making sure that everything is in order and ready for welding. If everything checks out, the clean PCB is concluded to be in working order and ready for the next stage, the welding.
48 Power Consumption Test As for this test, it was evaluated how the sample rate and the LED current affect the overall power consumption of the device. To perform it the device was set as usually, but with a digital multimeter connected in series between the microcontroller and the board to measure the current consumed (Figure 5.8) and then the parameters mentioned were changed to find the best balance between performance and power consumption. The values chosen were the same as the previous test, for the same motive. Figure 5.8 - Current and Sample Rate Test Setup • 50 Hz Table 5.1 - Board Consumption at 50 Hz Sample Rate LED peak current (mA) Board consumption (mA) 4.4 2.54 14.2 3.19 20.8 3.52 27.1 3.80 33.8 4.04 46.2 4.48 50 4.58
49 • 100 Hz Table 5.2 - Board Consumption at 100 Hz Sample Rate LED peak current (mA) Board consumption (mA) 4.4 3.08 14.2 4.56 20.8 5.31 27.1 5.94 33.8 6.51 46.2 7.52 50 7.74 From these two tests, two main conclusions can be taken. • Using a sample rate of 100 Hz over 50 Hz isn’t justified, because the difference of performance is nearly negligible but the current consumed almost doubles. • Since the LPF developed can nullify most of the high frequency noise present in the signal, nearly every option of LED current is viable so the choice can be the one with the best power consumed/performance ratio. With this in mind, the values that were set are: Sample Rate: 50 Hz LED current: 20.8 mA Software Test The test used to validate the software was a comparison of measurements between the MAX30100 sensor with the software developed and the device used for calibration. The setup was to place one finger on the sensor while another finger from the same hand had the medical device while a helper took notes of the SpO2 and heart rate values from the sensor and the medical device. This setup can be seen in Figure 5.9. At first it seemed like something was wrong because the readings were not matching, but after some time, it was concluded that the medical device was giving slightly delayed results compared to the sensor and that the results from the developed software were in fact accurate.
50 Figure 5.9 - Human Tests Setup 5.1.2 In Vivo The marine animal that was used for testing was a ray, specifically the undulate ray ( Raja undulata ). The animal was captured by fishermen and brought to shore alive, inside a container filled with sea water. The test subject is seen in Figure 5.10. Figure 5.10 - Test Subject Since the filters were calibrated for usage on humans, they could not work for the animal in question. So, in this first attempt, all that was done was the collecting of raw samples for later analysis. For testing, the animal was brought out of the container, the sensor was placed in different places on the body of the animal, for roughly the same amount of time, to see which location would give the best results.
51 Everything had to be done very quickly since samples taken from a stressed animal, can be very different from the same animal in a relaxed state. Figure 5.11 is a picture taken in one of the moments of testing. Figure 5.11 - Testing the Resin Encased MAX30100 Prototype The results from performing this test can be seen in Figure 5.12 and Figure 5.13. These correspond to the red and infrared LED results respectively. They had to be taken separately due to a software problem that occurred at the time. In both graphs, the DC component was removed and a 3 sample moving average filter was applied after to reduce most of the high frequency noise and leave the signal more readable. In both figures, in blue are the raw samples and in orange, the filtered samples. Looking at these results it can’t be said that there is a heartbeat among all the noise, some repetitive peaks are noticeable. This could be promising but at the moment, all that can be done is speculate about what is present in this samples and hopefully the results from the other sensor being tested will show better results. Figure 5.12 - MAX30100 Red led result in a marine animal
52 Figure 5.13 - MAX30100 Infrared led result in a marine animal 5.2 MAX30110ACCEVKIT The tests performed with this kit followed the same metrics as the ones done with the Heart Rate Click Board, to make sure the comparison was as reliable as possible with the exception that power consumption wasn’t tested. Since this kit doesn’t allow for the usage of self-developed software, all that was done was the collecting of raw samples, to see if the MAX30110 could be a useful addition to the project. Also, the interface used to operate the kit also allowed the testing of different parameters while receiving live results, which was very useful for optimizing their values. 5.2.1 Humans As was said, human testing of the MAX30110 consisted of changing the main parameters, sample rate and LED power, using the software provided and comparing the results as to optimize them and maximize the probability of achieving a good outcome when it came to in vivo testing. In all tests a 30 sample medium filter was applied to remove the DC component from the signals and in blue are the red samples and the infrared in orange.
53 Sample Rate • 50 Hz Figure 5.14 - MAX30110 50 Hz Sample Rate Result • 100 Hz Figure 5.15 - MAX30110 100 Hz Sample Rate Result After comparing results from 500 samples (Figure 5.14 and Figure 5.15), it is observed that having a higher sample rate isn’t needed since the results are very much alike. Therefore, it was decided to use the 50 Hz sample rate.
54 LED Power • 1 mA Figure 5.16 - MAX30110 1 mA LED Power Result • 3 mA Figure 5.17 - MAX30110 3 mA LED Power Result • 5 mA Figure 5.18 - MAX30110 5 mA LED Power Result The 1 mA and 3 mA (Figure 5.16 and Figure 5.17) results are very much similar and as expected, but when the current goes up to 5 mA (Figure 5.18) something goes wrong. In this case what’s happening is the amount of light being reflected is too much for the ADC range and it saturates. Since both 1 mA and
55 3 mA results where acceptable, choosing one over the other is indifferent, but as the animal’s veins could be found deeper than human veins, it was opted for the 3 mA to give the light more penetrating power. 5.2.2 In Vivo As it was said, the test performed in vivo with this sensor was virtually the same as the one performed for the MAX30100, therefore meaning that the raw samples were collected by placing the sensor in various places of the animal’s body, focusing on the belly (Figure 5.19). Since this sensor allowed for live visualization of the data being collected, the test wasn’t made “blindly”, without knowing if the data was by any means viable. This meant that it was possible to focus on points of the body where the PPG looked the most like a human PPG, or where the signal was most rhythmic, resembling a heart rate. Figure 5.19 – Testing the MAX30110 Sensor The results from this test can be seen in Figure 5.20. In blue are the red samples and in orange the infrared. This time both samples were taken concurrently. A lot more samples were taken, but only the most promising results will be shown.
56 Figure 5.20 - MAX30110 In Vivo Results With this device, there is still a lot of noise but towards half of the samples, there starts to appear something rhythmic possible resembling a heart rate. Moreover, the red and infrared signals are similar, as expected from the literature, if the SpO2 is constant. Two consecutive peaks were chosen, and after converting the x axis from “sample number” to “time”, it was even possible to make a heart rate calculation, using the formula mentioned in chapter 3. 𝐵𝑝𝑚= 60 𝑇𝑃𝑖𝑐𝑜2−𝑇𝑃𝑖𝑐𝑜1⇔ ⇔𝐵𝑝𝑚= 60 5,02−4,34⇔ ⇔𝐵𝑝𝑚=88 5.3 Chapter Summary The results obtained from the tests performed and discussed in this chapter are representative of three things. First, the optimization of every available parameter to achieve the best performance to consumption ratio in the MAX30100 sensor, to be applied in the low power application and for the in vivo testing. Next the testing of different parameters to attain the best possible results while testing the MAX30110 in vivo. From the low power application to the in vivo testing, the results were considered good, while also acknowledging that they can be better since this technology, without any major adaptations isn’t as reliable for wild animals as it is for humans.
57 6. Conclusions and Future Work This chapter will contain an analysis of the objectives completed and of the conclusions reached during the progress of this dissertation, as well as some of the future work that can be done to improve the prototype from the findings made. The purpose of this being, if someone decides to pick up the work where the author left it, there will already be sort of a guideline of where to begin and what to improve/change. 6.1 Conclusions The aim of this dissertation was to test if pulse oximetry techniques developed with human care in mind could function in monitoring devices for marine animals and then designing a device capable of applying them but specialized in marine animals. Through the progress of the project, two devices were tested, focusing on the MAX30100 as it was included in a board easier to adapt and to develop software for. The software was developed with versatility in mind so that when it came to testing, the device could be tuned to fit the requirements for each different individual that it could be tested on. The opportunity to test the sensors in an actual marine animal, brought light to some important considerations that weren’t taken into account at the beginning of the project. A lot of marine animals, like rays, produce a thick, slimy coat around their bodies to protect them. This slime, being transparent, doesn’t affect the light from the sensors, but highly affect their stability while placed against the animal’s skin. This means that any non-invasive means of attaching the device to the animal will most likely be associated with poor results due to motion artifacts, so either different approaches on the technique or new ways of fixating must be considered. This opportunity also showed that despite being very similar, the MAX30110, with its higher sensitivity, provided better results and would probably be a better option for the development of a new prototype. Unfortunately, the objective of designing a complete low power pulse oximeter with an embedded microcontroller couldn’t be completed, but with a little more effort it can be as every aspect of the design is already made, and the problems it underwent aren’t associated with it.
64 A. 5 - Findpeaks Function A. 6 - Heart Rate and SpO2 Calculator Functions
65 A. 7 - Interrupt Handler Function A. 8 - Main Loop Function