martes, 25 de septiembre de 2018

PULSE OXIMETRY



Obtaining Oximetry Signal





To obtain oximetry signal, its necessary use two photodiodes, the first is an infrared diode and the second diode is a Red led. The Oximetry measures the relationship between oxygenated hemoglobin and desoxygenated hemoglobin with a diferent absortion spectrum, for the desoxygenated hemoglobin is already 920nm-950nm fot that reason can be detected by the infrared diode and the oxygenated hemoglobin is 600nm-650nm, detected by the red led that is in 660nm. To receive the signal through the finger is used a photoreceptor detecting changes in wave length.


Resultado de imagen para pulsioximetria funcionamiento
Figure 1, Oximetry Functioning , picture taken from: https://comprarpulsioximetro.com/como-funciona-un-pulsioximetro/

Transimpedance Amplifier


When the photodiodes emit infrared and red light through the finger, there is a change in the wavelength  and in the current in the cuircuit, but to create a control of the variable, its necessary convert that current to a voltage value with a transimpedance amplifier like in the following figure: 

Figure2, Transimpedance amplifier 

In this case, the gain of the amplifier is Gain=1000 because the original signal is in the mv order, and in the microcontroller need a higher voltage than milivolts, calculated with the equation  Taking on R1 resistance of 1KΩ clearing of the equation  and replacing the gain and the R1 results 

Band-pass filter: 

The frequency spectrum for the oximetry is between 0.016Hz and 3Hz,to delete all the noise from another frequencies, a band-pass filter composed by a low pass filter and a high pass filter.

  • High Pass filter: The pass filter is built with a center frequency of 0.15Hz, allowing the pass of all frequencies above this value. The folloving equation describes RC values according to the center frequency: where fc is the chosen frequency, R is the resistor's value and C is the capacitor's value, in this case C=1μf replacing in the equation, looking for the resistor´s value we that  1.061MΩ
  • Figure 3, High Pass Filter

  • Low Pass filter: The low pass filter is built with a center frequency of 10Hz stopping all the frequencies above this value, and allowing all the frequencies under the value. The math operations to know the resistor's value is the same with a capacitor's commercial value of C=1μf,  =15kΩ.
    Figure 4, Low Pass filter


Heart Rate 

The infrared diode detects the desoxygenated hemoglobin,is possible detect the heart rate because the heart pump oxygenated blood to all the body, if the infrared diode read a change of voltage when the blood arrives to the fingers,we could know when is a beat. To get that information was used a microcontroller (Arduino UNO), the out of the circuit is connected to the arduino´s ADC converter to read that voltage inside the microcontroller. The firt step is obtain the voltage in the arduino converting analog signal into a digiatl signal with the ADC converter, the bits resolution of the arduino uno is 10 bits (2^10) and the voltage referenceis Arduino's source (5v), in this way the digital voltage is:

The voltage is approximately 2.6v, reading this value we can create a counter ,each time that the voltage is greater than 2v the counter increase in 1 unit during fifteen seconds, to know the bets per minute, the counter´s value is multiplied by 4 (15s*4=60s) completing the data collection. the next figure shows the arduino´s code implemented:

Figure 5, Code implemented to get heart rate.


Oxygen Saturation (SPO2)

The light absortion emitted by the photodiodes is due to the skin, blood vessels and venous the arterial blood flow is pulsatile and the other fluids are constant,givin us 4 type of voltage  when the red led is turned on there are dc voltage(no pulsatile) and Ac voltage (pulsatile) and the same with the infrared led. to obtain oxygen saturation, the photodiodes were turned on with the Arduino´s digital pins during 5 seconds, first was activates the red Led detecting the changes of voltage between Dc and AC, if the voltages is greater than 2v, is an AC red led voltage and was saved into an array but if the voltages is lower than 2v is a DC red led voltage saved into another array. When the time is complete, was calculates a mean of the two arrays (DC and AC red led voltage).After that, the infrared diode was turned on during five seconds with the same process. 

Figure 6, Turning on Red LED


Figure 7, Turning on Infrared diode

when all the values are taken, the absortion coefficient R is calculated with the following equation:
                                                                               
 R's value allows know the oxygen saturation (SPO2) with a oxyhemmoglobin dissociation curve, shown in the next picture:
Figure 8, Oxyhemoglobine dissociation curve, tajen from: file:///C:/Users/chris/Downloads/P.A.%20Daneri-Electromedicina_%20Equipos%20de%20Diagn%C3%B3stico%20y%20Cuidados%20Intensivos-Hasa%20(2007)%20(1).pdf
To know the oxygen saturation,its necessary calculate the curve's slope with the equation :
                                                                                                                 
The first point p1 is (1,85) and the second point p2 (3.4,0), applying the equationand finally the regression  where y is the oxygen saturation value obtained with the implemented circuit, the regressioncalculated in this design is:


Alarm

To make the alarm was used a obstacle sensor, when there isn´t something close to the sensor, the sensor´s output is 5v but when it detects the presence of an object ,in this case finger,the sensor´s output is 0v.The Arduino's Digital pins Receive the logic voltage, while this voltage is HIGH (5v), in the LCD appears a message (locate finger), if the person locate finger , the voltage is 0 and it comes out of the while cycle.


Pulse oximetry schematic




Results

Commercial pulse oximeter V.S Designed pulse Oximeter 


Finger´s detection



Oxymetry Signal



jueves, 6 de septiembre de 2018

EKG BIPOLAR LEADS


Buffer circuit.


The buffer circuit with an operational amplifier makes the input of the amplifier equal to the output, it increases the impedance of the circuit and decrease current’s value. it’s used to protect the patient from electrical currents. It was built with an operational amplifier lf353 connecting the electrodes to the positive input (right arm), the second positive input of the amplifier (left arm) and finally the left leg’s electrode to another amplifier in the positive input.



Wilson network.

This network is the reference to get the bipolar derivations. The voltage in each side is the respective electrode biopotential. The Wilson network is composed by nine 10k resistors with a low tolrance.

This network is the mix of the 3 electrodes of right arm, left arm and left leg like  Einthoven explained , getting the differential of potential between two electrodes and registering DI DII and DIII derivations:
·         DI: differential of potential between right arm(-) and left arm(+).
·         DII: differential of potential between right arm(-) and left leg(+).
·         DIII: differential of potential between left arm(-) and left leg(+).



Amplification.


With an instrumentation amplifier INA 114AP, each derivation signal was amplified with a gain value of 200 . the resistor´s value calculated from the equation  is 250 ohms, but in a commercial way, the resistor value used was 240ohms. INA 114 inputs came from wilson network: In the first ina (DI) right arm is connected to the inversor input and the left arm to the not inversor input. In the second INA (DII) the right arm is connected in the inversor input and the left leg in the not inversor input. Finally the third INA (DIII), the left arm is connected to the inversor input and the left leg in the not inversor input.

Band-Pass Filter .

To clean the EKG signal obtained from the body of a patient, the active filter is one of the best options because is a low-cost filter in analog circuits. In this case, the band pass filter is built in two parts: a high pass filter and a low pass filter.

·        High pass filter: 

The high pass filter is built with a center frequency of 0.15Hz, allowing the pass of all frequencies above this value. The frequency of a person in the ECG signal is close to 3 Hz, for that reason, the signal will appear in the oscilloscope. The following equation describes RC values according to the center frequency:where fc is the chosen frequency, R is the resistor´s value and C is the capacitor´s value. To build the filter, the capacitor´s value is set with a commercial value, in this case C = 1μf, replacing in the equation, looking for the resistor´s value we obtain that1.061MΩ.



Figure 1,high pass filter schematic

·        Low pass filter:

The low pass filter is built with a center frequency of 30hz, stopping all the frequencies above this value, and allowing all the frequencies under the value. The math operations to know the resistor´s value is the same with a capacitor´s commercial value of C = 1μf, 5.30K, but the resistor´s value found is not a commercial value, for that reason, 5.6KΩ is the chosen value in the construction of the filter.

Figure 2, Low pass filter schematic

Band-stop filter.

Also is called Notch filter, is used to clean the ECG signal from electrical noise of the light bulbs, currents of the voltage sources and the oscilloscope.

·        Band-stop filter 60Hz


The center frequency chosen is 60Hz. The equation to get the values Is the same, but in  this case, the filter is a second order filter, to get a exactly filter of frequencies. With a capacitor´s     value C= 100nf the resistor´s value calculated is26.525kΩ but in a commercial way, the R´s value is 27kΩ.In this filter, is necessary calculate the quality factor, if the quality factor is high, the signal is better, but if the quality factor is low, the signal can lost energy .the quality factor is expressed by the following equation :where, w0 is the frequency of the notch filter, w2 and w1 are the frequencies of the high pas filter and low pas filter respective. The quality factor in this case is  obtaining a value of 2.

Figure 3,band-stop filter 60Hz schematic

·        Band-stop filter 50 HZ:

The center frequency chosen is 50Hz. The equation to get the values Is the same, but in this case, the filter is a second order filter, to get a exactly filter of frequencies. With a capacitor´s  value C= 1μf the resistor´s value calculated 
is3.18kΩ but in a commercial way, the R´s value is 3.3kΩ. In this filter, is necessary calculate the quality factor, if the quality factor is high, the signal is better, but if the quality factor is low, the signal can lost energy .the quality factor is expressed by the following equation :  where, w0 is the frequency of the notch filter, w2 and w1 are the frequencies of the high pas filter and low pas filter respective. The quality factor in this case is  obtaining a value of 1.67.



Figure 4,Band-stop filter 50Hz schematic



Alarm system.


The alarm system was built with an Arduino UNO board and three-color leds, yellow, green and red identifying each electrode connection, the left arm was the yellow led, the right arm was the red led and the green led was left leg connection.



In the first derivation exist a potential difference between right arm and left arm, to check if the right arm electrode was connected, the change of voltage in the first INA (derivation I), was used to create an interval of voltage, when the right arm was connected the voltage was lower than 1v (voltage<1v) and disconnected the voltage was higher than 1v (voltage>1v).  If the voltage < 1v the red led was off but if the voltage > 1v the red led turned on. In the second derivation there is a potential difference between right arm and left leg and was used to identify the left leg connection with the same steps, when the left leg was connected the voltage in the INA output was higher than 1.5v but when the voltage was lower than 1.5 v the green led turned on. Finally to check the left arm connection, the third derivation show the potential difference between left arm and left leg, if the left arm electrode was disconnected the voltage was higher than 3v turning on the yellow led but if the voltage was lower than 3v, the led turned off. 

                                                                       Figure 5,alarm design 


Bipolar EKG schematic
                                                                                  Figure 6, EKG schematic


Results.

The EKG circuit was proved in the two students of the group, first in Christian Charry obtaining the following signals:
DI






DII


DIII


Them, to make a comparisson, the ciruit was proved in the other student, Natalia Orozco, with her respectives results. 




DI


Figure 7,DI bipolar derivation
DII


Figure 8, DII bipolar derivation

DIII


Figure 9, DIII bipolar derivation



Comparisson between the student´s signals



Figure 10,DIII natalia´s derivation



Figure11,DIII Chirsitan´s derivation

As you can see in the Christian signals, the t wave is bigger than in the natalia´s signals, it colud be a pathologie to analize in the future with a specialist and a real diagnostic but in these signals, the frecuency is different for the two students, where CHristian had a lower frecuency than natalia.