Difference between revisions of "Team:Queens Canada/Thermistor"

Line 25: Line 25:
 
air as the child breathes in. These changes in temperature are reflected in the changes in resistivity of the  
 
air as the child breathes in. These changes in temperature are reflected in the changes in resistivity of the  
 
thermistor, the maximums and minimums of these changes over time can be counted to calculate a rate.</p>
 
thermistor, the maximums and minimums of these changes over time can be counted to calculate a rate.</p>
<p style="width:1200px;margin-left:12%">The code written to calculate this rate first takes a reading of the thermistor’s resistivity once every second  
+
<p style="width:1200px;margin-left:12%;font-size:18pt">The code written to calculate this rate first takes a reading of the thermistor’s resistivity once every second  
 
for 100 seconds and stores the values in an array. This data can be plotted against time to create a sinusoidal wave  
 
for 100 seconds and stores the values in an array. This data can be plotted against time to create a sinusoidal wave  
 
as shown below. However, to count the peaks corresponding to each individual breath, the data must be preprocessed to  
 
as shown below. However, to count the peaks corresponding to each individual breath, the data must be preprocessed to  
 
remove outlying maximums and minimums.</p>
 
remove outlying maximums and minimums.</p>
 
<img src="https://static.igem.org/mediawiki/2018/f/f5/T--Queens_Canada--RawThermistorData.png" alt='Raw Thermistor Data'/>
 
<img src="https://static.igem.org/mediawiki/2018/f/f5/T--Queens_Canada--RawThermistorData.png" alt='Raw Thermistor Data'/>
<p style="width:1200px;margin-left:12%">This is done using an exponential filter, which is a type of low pass filter used to remove high frequency noise.  
+
<p style="width:1200px;margin-left:12%;font-size:18pt">This is done using an exponential filter, which is a type of low pass filter used to remove high frequency noise.  
 
It is also an autoregression filter, which means that it relies on past output and input, so that over time it relies  
 
It is also an autoregression filter, which means that it relies on past output and input, so that over time it relies  
 
more heavily on past values and is able to detect patterns such as a steady breathing rate. The filtered data can be  
 
more heavily on past values and is able to detect patterns such as a steady breathing rate. The filtered data can be  
 
plotted to produce the sinusoidal wave shown below.</p>
 
plotted to produce the sinusoidal wave shown below.</p>
 
<img style="width:1200px;margin-left:12%" src="https://static.igem.org/mediawiki/2018/7/7f/T--Queens_Canada--FilteredThermistorData.png" alt='Filtered Thermistor Data'/>
 
<img style="width:1200px;margin-left:12%" src="https://static.igem.org/mediawiki/2018/7/7f/T--Queens_Canada--FilteredThermistorData.png" alt='Filtered Thermistor Data'/>
<p style="width:1200px;margin-left:12%">The cleaned data can then be analyzed to detect peaks. This is done by comparing each value to the previous value  
+
<p style="width:1200px;margin-left:12%;font-size:18pt">The cleaned data can then be analyzed to detect peaks. This is done by comparing each value to the previous value  
 
and the value following it. If the current value is larger than both, it must be a maximum and the number of peaks is  
 
and the value following it. If the current value is larger than both, it must be a maximum and the number of peaks is  
 
increased. The total number of peaks, corresponding to the total number of breathes, is then divided by 100 seconds  
 
increased. The total number of peaks, corresponding to the total number of breathes, is then divided by 100 seconds  

Revision as of 00:22, 16 October 2018

Thermistor - Breathing Rate

To measure breathing rate, multiple readings are taken of the NTC thermistor’s resistivity over a set period of time. As the child breathes out, warmer air comes in contact with the thermistor, which is then followed by colder air as the child breathes in. These changes in temperature are reflected in the changes in resistivity of the thermistor, the maximums and minimums of these changes over time can be counted to calculate a rate.

The code written to calculate this rate first takes a reading of the thermistor’s resistivity once every second for 100 seconds and stores the values in an array. This data can be plotted against time to create a sinusoidal wave as shown below. However, to count the peaks corresponding to each individual breath, the data must be preprocessed to remove outlying maximums and minimums.

Raw Thermistor Data

This is done using an exponential filter, which is a type of low pass filter used to remove high frequency noise. It is also an autoregression filter, which means that it relies on past output and input, so that over time it relies more heavily on past values and is able to detect patterns such as a steady breathing rate. The filtered data can be plotted to produce the sinusoidal wave shown below.

Filtered Thermistor Data

The cleaned data can then be analyzed to detect peaks. This is done by comparing each value to the previous value and the value following it. If the current value is larger than both, it must be a maximum and the number of peaks is increased. The total number of peaks, corresponding to the total number of breathes, is then divided by 100 seconds to determine a rate of breathes per second.