titinho11 / CMS50E-raw-ppg-data

Raw ppg data from cms50e device
3 stars 3 forks source link

My device is CMS50E,I have some questions #1

Open BlackPPP opened 1 year ago

BlackPPP commented 1 year ago

My device is CMS50E,I have some questions 1.My device connects to the computer through the USB,But he can only communicate data through usbHID,Unable to find com port import hid h = hid.device() h.open(0x28E9, 0x028A) # VendorID/ProductID

while True:
    maintain()
    data = h.read(9)
    print(data)

2.The output data is as follows,print(data) [240, 112, 0, 0, 0, 0, 0, 0, 0] [240, 112, 0, 0, 0, 0, 0, 0, 0] [240, 112, 0, 0, 0, 0, 0, 0, 0] [240, 112, 0, 0, 0, 0, 0, 0, 0] [240, 112, 0, 0, 0, 0, 0, 0, 0]

3.I'm not sure why, could you help me solve it?Thank you

SunHaixin0324 commented 1 year ago

@BlackPPP I also encountered the same problem, may I ask if you have solved it? If you can tell me the solution, I would be very grateful.

BlackPPP commented 1 year ago

1.获取数据参考https://github.com/rene-aguirre/pywinusb, 下图红框为获取数据代码 运行代码时需启动血氧仪自带软件

3.获取数据分析, import matplotlib.pyplot as pltimport numpy as np import scipy import matplotlib.ticker as ticker

打开C给的文本文件,返回文件对象

file = open('k.txt', 'r')  # 第一个参数是文件名,第二个参数是打开模式('r' 表示只读) cont = file.readlines()

关闭文件

file.close()

去除每行末尾的换行符

cont = [line.strip() for line in cont[1:]]

将每行的字符串转换为列表

cont = [eval(line) for line in cont]

all_data=[] for sublist in cont:     sublist = sublist[:21]  # 保留每个数据包的前21个数     all_data += sublist     # 拼接 raw_ppg_3=[] raw_ppg_5=[] hr=[] spo2=[] for i in range(len(all_data)):     if all_data[i] == 235 and all_data[i+1] == 0:#检索数值235,若检测到则判断后一个数是否为0,若为0则记录第3个数为原始信号         raw_ppg_3.append(all_data[i + 3])         raw_ppg_5.append(all_data[i+5])     elif all_data[i] == 235 and all_data[i+1] != 0:#不为0(即1)则记录第3个数为脉率,第4个数为血氧         # continue         hr.append(all_data[i + 3])         spo2.append(all_data[i + 4])

peaks3, = scipy.signal.find_peaks(raw_ppg_3, height=None, threshold=None, distance=None, prominence=None, width=None, wlen=None, rel_height=None, plateau_size=None) peaks5, = scipy.signal.find_peaks(raw_ppg_5, height=None, threshold=None, distance=None, prominence=None, width=None, wlen=None, rel_height=None, plateau_size=None)

plt.figure() plt.plot(raw_ppg_3) plt.plot(raw_ppg_5) plt.show()

print("ok")

 

!!!潇~~~~ @.***

 

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2023年7月4日(星期二) 下午5:24 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [titinho11/CMS50E-raw-ppg-data] My device is CMS50E,I have some questions (Issue #1)

@BlackPPP I also encountered the same problem, may I ask if you have solved it? If you can tell me the solution, I would be very grateful.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

titinho11 commented 1 year ago

My device is CMS50E,I have some questions 1.My device connects to the computer through the USB,But he can only communicate data through usbHID,Unable to find com port import hid h = hid.device() h.open(0x28E9, 0x028A) # VendorID/ProductID

while True:
  maintain()
  data = h.read(9)
  print(data)

2.The output data is as follows,print(data) [240, 112, 0, 0, 0, 0, 0, 0, 0] [240, 112, 0, 0, 0, 0, 0, 0, 0] [240, 112, 0, 0, 0, 0, 0, 0, 0] [240, 112, 0, 0, 0, 0, 0, 0, 0] [240, 112, 0, 0, 0, 0, 0, 0, 0]

3.I'm not sure why, could you help me solve it?Thank you

Hi @BlackPPP , i guess your main concern is about the value you get when you print the data. The zeros you have is because the probe returns no useful information. If I remember correctly, this happened when I didn't put my finger inside. Normally, if you put your finger in the oximeter, it starts measuring the residual light and sends you back the ppg and spo2 data... and you won't get those zeros anymore.

BlackPPP commented 1 year ago

ut your finger in the oximeter, turn it on, then plug into the PC. Make sure that it works well, i.e. “Requires the upper computer software to remain continuously open”