adafruit / Adafruit_CircuitPython_BLE_BerryMed_Pulse_Oximeter

BLE Support for BerryMed Pulse Oximeters
MIT License
7 stars 6 forks source link

BerryMedPulseOximeterService.value returning None #6

Closed p-riebs closed 4 years ago

p-riebs commented 4 years ago

I'm running the example script and getting None values returned from BerryMedPulseOximeterService.value. Heartrate and blood oxygen are being shown on the device and I'm able to connect to the device. I've waited 5-10 minutes for real values to be returned.

Model number on the pulse oximeter: BM1000 Connecting device: Raspberry Pi 4

Package versions: bleak 0.8.0 adafruit-blinka-bleio 1.1.0

I'm running on bluez-firmware_1.2-4+rpt2_all to workaround the current issue here: https://github.com/adafruit/Adafruit_CircuitPython_BLE_BerryMed_Pulse_Oximeter/issues/3

Output

pi@raspberrypi:~ $ python3 ble_berrymed_pulse_oximeter_simpletest.py 
Scanning...
BerryMed
Connected
Stopped scan
Fetch connection
Device: Berry BM1000B
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
dhalbert commented 4 years ago

Please use https://github.com/dhalbert/Adafruit_Blinka_bleio/tree/macos-fixes with bleak 0.8.0 and see if that works for you. I'll be submitting that to the library soon.

p-riebs commented 4 years ago

I tried your branch and it works! I'm curious to know if it's normal for the inconsistent output values. As you can see below there many None values between each reading. Feel free to mark this as closed if this is expected behavior otherwise I can open another issue with more data.

pi@raspberrypi:~ $ python3 ble_berrymed_pulse_oximeter_simpletest.py 
Scanning...
Stopped scan
Scanning...
Stopped scan
Scanning...
BerryMed
Connected
Stopped scan
Fetch connection
Device: Berry BM1000B
None
None
None
PulseOximeterValues(valid=False, spo2=127, pulse_rate=255, pleth=50, finger_present=True)
None
None
None
None
None
None
None
None
PulseOximeterValues(valid=True, spo2=100, pulse_rate=82, pleth=58, finger_present=True)
None
None
None
None
None
None
None
None
None
None
None
PulseOximeterValues(valid=True, spo2=100, pulse_rate=84, pleth=37, finger_present=True)

And in other cases they are very close together

PulseOximeterValues(valid=True, spo2=98, pulse_rate=81, pleth=47, finger_present=True)
PulseOximeterValues(valid=True, spo2=100, pulse_rate=81, pleth=39, finger_present=True)
None
None
None
PulseOximeterValues(valid=True, spo2=99, pulse_rate=78, pleth=26, finger_present=True)
PulseOximeterValues(valid=True, spo2=99, pulse_rate=78, pleth=95, finger_present=True)
None
PulseOximeterValues(valid=True, spo2=99, pulse_rate=78, pleth=63, finger_present=True)
dhalbert commented 4 years ago

The example program is reading values as fast as possible, so the None values indicate that a new value hasn't arrived yet. Glad you got it working! I'll close this, and since it seems to be working for most people, I'm going to PR my branch into the library and get it in the bundle.