中文字幕 另类精品,亚洲欧美一区二区蜜桃,日本在线精品视频免费,孩交精品乱子片免费

<sup id="3hn2b"></sup>

    1. <sub id="3hn2b"><ol id="3hn2b"></ol></sub><legend id="3hn2b"></legend>

      1. <xmp id="3hn2b"></xmp>

      2. 新聞中心

        EEPW首頁 > 物聯(lián)網(wǎng)與傳感器 > 設計應用 > 基礎知識之血氧傳感器

        基礎知識之血氧傳感器

        作者: 時間:2024-03-18 來源:電子森林 收藏

        是一種用于測量人體血液中氧氣飽和度的設備。它通過非侵入性或微創(chuàng)性的方式獲取血氧水平的相關數(shù)據(jù)。通常使用光學原理來工作。

        本文引用地址:http://www.antipu.com.cn/article/202403/456426.htm

        血氧傳感器中最常見的類型是脈搏血氧飽和度(SpO2)傳感器,也被稱為脈搏血氧傳感器。SpO2傳感器利用光的吸收特性來測量血紅蛋白的氧合程度。它通過發(fā)射兩種不同波長的光(通常是紅光和紅外光)經(jīng)過皮膚照射到血液中,然后通過相應的光電傳感器測量經(jīng)過皮膚反射回來的光的強度。根據(jù)紅光和紅外光的吸收差異,可以計算出血液中氧氣的飽和度。

        人體需要并調節(jié)血液中氧氣的非常精確和特定的平衡。人體的正常動脈血氧飽和度(SpO2)為97-100%,或96-99%。如果該水平低于90%,則被認為是低氧血癥。動脈血氧水平低于80%可能會損害器官功能,例如大腦和心臟,應及時解決。持續(xù)的低氧水平可能導致呼吸或心臟驟停。

        血氧傳感器常見于醫(yī)療領域,特別是在監(jiān)護設備、手持式脈搏氧飽和度儀和睡眠呼吸監(jiān)測等應用中。此外,它們也逐漸應用于個人健康監(jiān)測設備,如智能手環(huán)、智能手表等。

        圖1:max30102光電式心率血氧傳感器

        血氧傳感器通常使用光學原理來測量血紅蛋白的氧合程度,其中最常見的類型是脈搏氧血飽和度(SpO2)傳感器。

        圖2:光學原理

        以下是血氧傳感器的工作原理:

        • 發(fā)射光:血氧傳感器發(fā)射兩種不同波長的光,通常是紅光和紅外光。這兩種波長的光可被血紅蛋白分別吸收。紅光波長大約在600-700納米范圍內,而紅外光波長大約在800-1000納米范圍內。
        • 光的吸收:發(fā)射的光通過皮膚照射到血液中。在經(jīng)過皮膚的組織和血液后,光會被血紅蛋白吸收。被氧合的血紅蛋白和脫氧的血紅蛋白對紅光和紅外光的吸收程度不同。
        • 光的檢測:血氧傳感器通過相應的光電傳感器測量經(jīng)過皮膚反射回來的光的強度。光電傳感器會測量紅光和紅外光的強度,并將其轉換為電信號。
        • 數(shù)據(jù)處理:血氧傳感器會對紅光和紅外光的強度進行比較和計算,以確定血液中氧氣的飽和度。通過比較兩種光的吸收差異,可以推導出血氧飽和度的估計值。

        血氧傳感器只能提供間接的血氧飽和度測量結果,并且有一定的誤差范圍。其他因素如溫度、燈光干擾、運動等也可能對測量結果產(chǎn)生影響。

        1 臨床監(jiān)護:血氧傳感器常用于臨床監(jiān)護中,例如在手術室、急診室和重癥監(jiān)護病房。通過監(jiān)測患者的血氧飽和度(SPO2)水平,醫(yī)護人員可以實時了解患者的氧氣供應情況,及時發(fā)現(xiàn)并處理低氧血癥或窒息等問題,確?;颊叩陌踩?/span>

        2 睡眠呼吸監(jiān)測:血氧傳感器被廣泛應用于睡眠呼吸監(jiān)測領域。睡眠時,佩戴血氧傳感器的設備(如脈搏氧飽和度儀)能夠監(jiān)測睡眠者的血氧水平。通過分析血氧飽和度數(shù)據(jù),醫(yī)生或睡眠專家可以評估睡眠質量、檢測睡眠呼吸暫停等呼吸障礙,并為患者提供相應的治療建議。

        3 慢性阻塞性肺疾?。–OPD)管理:COPD患者常使用血氧傳感器來管理他們的疾病。他們可以在家中使用脈搏氧飽和度儀來測量自己的血氧水平,并追蹤數(shù)據(jù)的變化。這有助于監(jiān)測疾病的進展、評估治療效果,并及時采取相應的措施,如調整藥物劑量或進行氧療。

        4 家庭健康監(jiān)測:現(xiàn)代的脈搏氧飽和度儀(Pulse Oximeter)通常集成了血氧傳感器,被廣泛應用于家庭健康監(jiān)測場景。人們可以通過在家中使用這種設備來監(jiān)測自己或家人的血氧水平,以及心率等信息。這對于早期發(fā)現(xiàn)可能存在的呼吸系統(tǒng)問題、心血管疾病和睡眠呼吸暫停等狀況非常有幫助。此外,一些健康追蹤設備和智能手表也集成了血氧傳感器,能夠提供用戶的血氧飽和度數(shù)據(jù),幫助用戶更好地了解自己的健康狀況。

        5 高海拔登山:登山者在攀登高海拔地區(qū)時通常會面臨低氧環(huán)境。血氧傳感器被用于監(jiān)測登山者的血氧水平,幫助他們了解身體在高海拔環(huán)境下的氧氣供應情況。這樣的信息可以幫助他們判斷是否需要停止攀登或采取其他適當?shù)男袆觼肀苊飧呱讲〉葷撛陲L險。

        6 運動訓練和健身監(jiān)測:血氧傳感器在運動訓練和健身監(jiān)測中起著重要作用。運動員可以使用集成了血氧傳感器的可穿戴設備,如智能手表或運動耳機,來監(jiān)測他們的血氧水平和心率等數(shù)據(jù)。這些數(shù)據(jù)可以幫助運動員和教練員了解身體在運動過程中的氧氣攝取能力和運動耐力水平,并進行相應的訓練調整。此外,血氧傳感器還可以幫助跑步愛好者監(jiān)測自己的運動表現(xiàn),提供健身指導和優(yōu)化跑步計劃。

        Maxim Integrated :Maxim Integrated是一家知名的集成電路設計和生產(chǎn)公司,提供多種心率傳感器芯片和模塊。其中,MAX30102是一款常見的心率傳感器模塊,集成了紅外LED、紅光LED和光電傳感器,適用于便攜設備和健康監(jiān)測設備等應用。

        Texas Instruments(TI):TI是一家全球領先的半導體公司,提供多款生物傳感器芯片和模塊。AFE4404是TI的一款心率監(jiān)測芯片,集成了紅外LED、綠光LED、光電傳感器和ADC等功能,可實現(xiàn)高精度的心率和血氧濃度測量。

        Analog Devices(ADI):ADI是一家知名的模擬與數(shù)字混合信號處理技術供應商,提供多種生物傳感器芯片和模塊。AD8232是ADI的一款心率傳感器芯片,專為心電圖(ECG)采集設計,具備高性能和低功耗特點。

        Nellcor (Medtronic):Nellcor是Medtronic旗下的品牌,專注于提供高質量的血氧傳感器芯片和模塊。他們的SpO2傳感器采用專有的信號處理算法,具有高靈敏度和抗干擾能力。Nellcor的血氧傳感器在醫(yī)療領域廣泛應用,包括重癥監(jiān)護、手術室和急診等環(huán)境。

        NXP Semiconductors:NXP Semiconductors是一家全球領先的半導體解決方案提供商,他們提供適用于醫(yī)療應用的心率、血氧和心電圖傳感器芯片。

        Silicon Labs:Silicon Labs是一家專注于集成電路解決方案的公司,他們提供用于生物傳感器應用的芯片產(chǎn)品,包括心率、血氧和心電圖傳感器芯片。

        在Thonny使用Mircopython編寫程序控制RP2040控制Max30102讀取心率數(shù)據(jù)

        Max30102芯片介紹

        MAX30102是一個集成的脈搏血氧計和心率監(jiān)測器模塊。它包括內部LED、光電探測器、光學元件和具有環(huán)境光抑制功能的低噪聲電子器件。

        MAX30102使用一個1.8V電源和一個用于內部LED的獨立3.3V電源。通過標準I2C兼容接口進行通信。該模塊可以通過零待機電流的軟件關閉,使電源導軌始終保持通電狀態(tài)。

        電路連接

        程序代碼

        程序文件需要文件

        • init.py
        • circular_buffer.py
        • spo2cal.py
        • HR_SpO2.py

        前面兩個文件可在github上面下載https://github.com/n-elia/MAX30102-MicroPython-driver/tree/main/max30102

        spo2cal.py程序如下

            # -*-coding:utf-8     # 25 samples per second (in algorithm.h)
           SAMPLE_FREQ = 25
           # taking moving average of 4 samples when calculating HR    # in algorithm.h, "DONOT CHANGE" comment is attached
           MA_SIZE = 4
           # sampling frequency * 4 (in algorithm.h)
           BUFFER_SIZE = 100 
             # this assumes ir_data and red_data as np.array
           def calc_hr_and_spo2(ir_data, red_data):
               """
               By detecting  peaks of PPG cycle and corresponding AC/DC
               of red/infra-red signal, the an_ratio for the SPO2 is computed.
               """
               # get dc mean
               ir_mean = int(sum(ir_data) / len(ir_data))         # remove DC mean and inver signal        # this lets peak detecter detect valley
               x = [ir_mean - x for x in ir_data]         # 4 point moving average        # x is np.array with int values, so automatically casted to int
               for i in range(len(x) - MA_SIZE):
                   x[i] = sum(x[i:i + MA_SIZE]) / MA_SIZE
                 # calculate threshold
               n_th = int(sum(x) / len(x))
               n_th = 30 if n_th < 30 else n_th  # min allowed
               n_th = 60 if n_th > 60 else n_th  # max allowed
         
               ir_valley_locs, n_peaks = find_peaks(x, BUFFER_SIZE, n_th, 4, 15)
               # print(ir_valley_locs[:n_peaks], ",", end="")
               peak_interval_sum = 0
               if n_peaks >= 2:
                   for i in range(1, n_peaks):
                       peak_interval_sum += (ir_valley_locs[i] - ir_valley_locs[i - 1])
                   peak_interval_sum = int(peak_interval_sum / (n_peaks - 1))
                   hr = int(SAMPLE_FREQ * 60 / peak_interval_sum)
                   hr_valid = True        else:
                   hr = -999  # unable to calculate because # of peaks are too small
                   hr_valid = False
                 # ---------spo2---------         # find precise min near ir_valley_locs (???)
               exact_ir_valley_locs_count = n_peaks
                 # find ir-red DC and ir-red AC for SPO2 calibration ratio        # find AC/DC maximum of raw
                 # FIXME: needed??
               for i in range(exact_ir_valley_locs_count):
                   if ir_valley_locs[i] > BUFFER_SIZE:
                       spo2 = -999  # do not use SPO2 since valley loc is out of range
                       spo2_valid = False                return hr, hr_valid, spo2, spo2_valid
         
               i_ratio_count = 0
               ratio = []         # find max between two valley locations        # and use ratio between AC component of Ir and Red DC component of Ir and Red for SpO2
               red_dc_max_index = -1
               ir_dc_max_index = -1
               for k in range(exact_ir_valley_locs_count - 1):
                   red_dc_max = -16777216
                   ir_dc_max = -16777216
                   if ir_valley_locs[k + 1] - ir_valley_locs[k] > 3:
                       for i in range(ir_valley_locs[k], ir_valley_locs[k + 1]):
                           if ir_data[i] > ir_dc_max:
                               ir_dc_max = ir_data[i]
                               ir_dc_max_index = i                    if red_data[i] > red_dc_max:
                               red_dc_max = red_data[i]
                               red_dc_max_index = i
         
                       red_ac = int((red_data[ir_valley_locs[k + 1]] - red_data[ir_valley_locs[k]]) * (red_dc_max_index - ir_valley_locs[k]))
                       red_ac = red_data[ir_valley_locs[k]] + int(red_ac / (ir_valley_locs[k + 1] - ir_valley_locs[k]))
                       red_ac = red_data[red_dc_max_index] - red_ac  # subtract linear DC components from raw
         
                       ir_ac = int((ir_data[ir_valley_locs[k + 1]] - ir_data[ir_valley_locs[k]]) * (ir_dc_max_index - ir_valley_locs[k]))
                       ir_ac = ir_data[ir_valley_locs[k]] + int(ir_ac / (ir_valley_locs[k + 1] - ir_valley_locs[k]))
                       ir_ac = ir_data[ir_dc_max_index] - ir_ac  # subtract linear DC components from raw
         
                       nume = red_ac * ir_dc_max
                       denom = ir_ac * red_dc_max                if (denom > 0 and i_ratio_count < 5) and nume != 0:
                           # original cpp implementation uses overflow intentionally.                    # but at 64-bit OS, Pyhthon 3.X uses 64-bit int and nume*100/denom does not trigger overflow                    # so using bit operation ( &0xffffffff ) is needed
                           ratio.append(int(((nume * 100) & 0xffffffff) / denom))
                           i_ratio_count += 1         # choose median value since PPG signal may vary from beat to beat
               ratio = sorted(ratio)  # sort to ascending order
               mid_index = int(i_ratio_count / 2) 
               ratio_ave = 0
               if mid_index > 1:
                   ratio_ave = int((ratio[mid_index - 1] + ratio[mid_index]) / 2)
               else:
                   if len(ratio) != 0:
                       ratio_ave = ratio[mid_index]         # why 184?
               # print("ratio average: ", ratio_ave)
               if ratio_ave > 2 and ratio_ave < 184:
                   # -45.060 * ratioAverage * ratioAverage / 10000 + 30.354 * ratioAverage / 100 + 94.845
                   spo2 = -45.060 * (ratio_ave ** 2) / 10000.0 + 30.054 * ratio_ave / 100.0 + 94.845
                   spo2_valid = True        else:
                   spo2 = -999
                   spo2_valid = False
                 return hr - 20, hr_valid, spo2, spo2_valid
         
         
           def find_peaks(x, size, min_height, min_dist, max_num):
               """
               Find at most MAX_NUM peaks above MIN_HEIGHT separated by at least MIN_DISTANCE
               """
               ir_valley_locs, n_peaks = find_peaks_above_min_height(x, size, min_height, max_num)
               ir_valley_locs, n_peaks = remove_close_peaks(n_peaks, ir_valley_locs, x, min_dist) 
               n_peaks = min([n_peaks, max_num])         return ir_valley_locs, n_peaks
         
         
           def find_peaks_above_min_height(x, size, min_height, max_num):
               """
               Find all peaks above MIN_HEIGHT
               """ 
               i = 0
               n_peaks = 0
               ir_valley_locs = []  # [0 for i in range(max_num)]
               while i < size - 1:
                   if x[i] > min_height and x[i] > x[i - 1]:  # find the left edge of potential peaks
                       n_width = 1
                       # original condition i+n_width < size may cause IndexError                # so I changed the condition to i+n_width < size - 1
                       while i + n_width < size - 1 and x[i] == x[i + n_width]:  # find flat peaks
                           n_width += 1
                       if x[i] > x[i + n_width] and n_peaks < max_num:  # find the right edge of peaks                    # ir_valley_locs[n_peaks] = i
                           ir_valley_locs.append(i)
                           n_peaks += 1  # original uses post increment
                           i += n_width + 1
                       else:
                           i += n_width            else:
                       i += 1         return ir_valley_locs, n_peaks
         
         
           def remove_close_peaks(n_peaks, ir_valley_locs, x, min_dist):
               """
               Remove peaks separated by less than MIN_DISTANCE
               """         # should be equal to maxim_sort_indices_descend        # order peaks from large to small
               # should ignore index:0
               sorted_indices = sorted(ir_valley_locs, key=lambda i: x[i])
               sorted_indices.reverse()         # this "for" loop expression does not check finish condition        # for i in range(-1, n_peaks):
               i = -1
               while i < n_peaks:
                   old_n_peaks = n_peaks
                   n_peaks = i + 1
                   # this "for" loop expression does not check finish condition            # for j in (i + 1, old_n_peaks):
                   j = i + 1
                   while j < old_n_peaks:
                       n_dist = (sorted_indices[j] - sorted_indices[i]) if i != -1 else (sorted_indices[j] + 1)  # lag-zero peak of autocorr is at index -1
                       if n_dist > min_dist or n_dist < -1 * min_dist:
                           sorted_indices[n_peaks] = sorted_indices[j]
                           n_peaks += 1  # original uses post increment
                       j += 1
                   i += 1 
               sorted_indices[:n_peaks] = sorted(sorted_indices[:n_peaks])         return sorted_indices, n_peaks
         
             if __name__ == "__main__":
               hr, hrb, sp, spb = calc_hr_and_spo2([12853, 15573, 15580, 15586, 15587, 15567, 15520, 15480, 15464, 15460, 15462, 15466, 15473, 15479, 15485, 15490, 15495, 15503, 15512, 15518, 15521, 15521, 15518, 15517, 15522, 15527, 15536, 15547, 15558, 15568, 15577, 15587, 15594, 15604, 15610, 15616, 15620, 15624, 15625, 15615, 15576, 15531, 15508, 15500, 15502, 15509, 15516, 15523, 15528, 15533, 15538, 15547, 15556, 15564, 15564, 15560, 15556, 15556, 15559, 15564, 15570, 15579, 15588, 15599, 15610, 15619, 15628, 15635, 15642, 15649, 15655, 15662, 15669, 15672, 15661, 15621, 15571, 15546, 15537, 15538, 15545, 15553, 15560, 15565, 15570, 15577, 15585, 15593, 15600, 15601, 15597, 15592, 15591, 15594, 15600, 15608, 15617, 15626, 15633, 15640], [12258, 14318, 14322, 14324, 14326, 14317, 14299, 14284, 14280, 14279, 14280, 14283, 14285, 14288, 14292, 14294, 14297, 14299, 14302, 14304, 14305, 14305, 14304, 14304, 14306, 14308, 14311, 14316, 14321, 14325, 14329, 14333, 14329, 14329, 14332, 14335, 14336, 14338, 14338, 14333, 14315, 14295, 14286, 14283, 14285, 14288, 14292, 14295, 14297, 14298, 14301, 14305, 14309, 14312, 14312, 14310, 14308, 14308, 14309, 14312, 14315, 14318, 14322, 14327, 14332, 14336, 14341, 14344, 14347, 14350, 14351, 14354, 14357, 14359, 14353, 14335, 14313, 14304, 14300, 14302, 14305, 14309, 14312, 14314, 14316, 14319, 14323, 14326, 14329, 14329, 14326, 14325, 14324, 14326, 14328, 14332, 14336, 14341, 14345, 14349]) 
               print("hr detected:", hrb)
               print("sp detected:", spb)         if (hrb == True and hr != -999):
                   hr2 = int(hr)
                   print("Heart Rate : ", hr2)
               if (spb == True and sp != -999):
                   sp2 = int(sp)
                   print("SPO2       : ", sp2) 
         

        HR_SpO2.py程序如下:

            from machine import SoftI2C, Pin, Timer
           from utime import ticks_diff, ticks_us
           from max30102 import MAX30102, MAX30105_PULSE_AMP_MEDIUM
           from spo2cal import calc_hr_and_spo2
         
         
           BEATS = 0  # 存儲心率
           FINGER_FLAG = False  # 默認表示未檢測到手指
         
           SPO2 = 0  # 存儲血氧
           TEMPERATURE = 0  # 存儲溫度
         
         
           def display_info(t):
               # 如果沒有檢測到手指,那么就不顯示        if FINGER_FLAG is False:
                   return 
               print('Heart Rate: ', BEATS, " SpO2:", SPO2, " Temperture:", TEMPERATURE) 
         
           def main():
               global BEATS, FINGER_FLAG, SPO2, TEMPERATURE  # 如果需要對全局變量修改,則需要global聲明
                 # 創(chuàng)建I2C對象(檢測MAX30102)
               i2c = SoftI2C(sda=Pin(16), scl=Pin(17), freq=400000)  # Fast: 400kHz, slow: 100kHz
                 # 創(chuàng)建傳感器對象
               sensor = MAX30102(i2c=i2c)         # 檢測是否有傳感器        if sensor.i2c_address not in i2c.scan():
                   print("沒有找到傳感器")
                   return
               elif not (sensor.check_part_id()):
                   # 檢查傳感器是否兼容
                   print("檢測到的I2C設備不是MAX30102或者MAX30105")
                   return
               else:
                   print("傳感器已識別到")         # 配置
               sensor.setup_sensor()
               sensor.set_sample_rate(400)
               sensor.set_fifo_average(8)
               sensor.set_active_leds_amplitude(MAX30105_PULSE_AMP_MEDIUM) 
               t_start = ticks_us()  # Starting time of the acquisition
         
               MAX_HISTORY = 32
               history = []
               beats_history = []
               beat = False
         
               red_list = []
               ir_list = []         while True:
                   sensor.check()
                   if sensor.available():
                       # FIFO 先進先出,從隊列中取數(shù)據(jù)。都是整形int
                       red_reading = sensor.pop_red_from_storage()
                       ir_reading = sensor.pop_ir_from_storage()                 if red_reading < 1000:
                           print('No finger')
                           FINGER_FLAG = False  # 表示沒有放手指                    continue
                       else:
                           FINGER_FLAG = True  # 表示手指已放
                         # 計算心率
                       history.append(red_reading)                 # 為了防止列表過大,這里取列表的后32個元素
                       history = history[-MAX_HISTORY:]                 # 提取必要數(shù)據(jù)
                       minima, maxima = min(history), max(history)
                       threshold_on = (minima + maxima * 3) // 4   # 3/4
                       threshold_off = (minima + maxima) // 2      # 1/2                 if not beat and red_reading > threshold_on:
                           beat = True                    
                           t_us = ticks_diff(ticks_us(), t_start)
                           t_s = t_us/1000000
                           f = 1/t_s
                           bpm = f * 60
                           if bpm < 500:
                               t_start = ticks_us()
                               beats_history.append(bpm)                    
                               beats_history = beats_history[-MAX_HISTORY:]   # 只保留最大30個元素數(shù)據(jù)
                               BEATS = round(sum(beats_history)/len(beats_history), 2)  # 四舍五入                if beat and red_reading < threshold_off:
                           beat = False
                         # 計算血氧
                       red_list.append(red_reading)
                       ir_list.append(ir_reading)
                       # 最多 只保留最新的100個
                       red_list = red_list[-100:]
                       ir_list = ir_list[-100:]
                       # 計算血氧值                if len(red_list) == 100 and len(ir_list) == 100:
                           hr, hrb, sp, spb = calc_hr_and_spo2(red_list, ir_list)
                           if hrb is True and spb is True:
                               if sp != -999:
                                   SPO2 = int(sp)                 # 計算溫度
                       TEMPERATURE = sensor.read_temperature() 
             if __name__ == '__main__': 
               tim = Timer(period=1000, mode=Timer.PERIODIC, callback=display_info) 
               main() 
         

        運行效果



        關鍵詞: 血氧傳感器

        評論


        技術專區(qū)

        關閉