adafruit_ble_heart_rate
¶
BLE Heart Rate Service
Author(s): Dan Halbert for Adafruit Industries
The Heart Rate Service is specified here: https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Services/org.bluetooth.service.heart_rate.xml
Implementation Notes¶
Hardware:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
Adafruit’s BLE library: https://github.com/adafruit/Adafruit_CircuitPython_BLE
- class adafruit_ble_heart_rate.HeartRateMeasurementValues(heart_rate, contact, energy_expended, rr_intervals)¶
Namedtuple for measurement values.
HeartRateMeasurementValues.heart_rate
Heart rate (int), in beats per minute.
HeartRateMeasurementValues.contact
True
if device is contacting the body,False
if not,None
if device does not support contact detection.HeartRateMeasurementValues.energy_expended
Energy expended (int), in kilo joules, or
None
if no value.HeartRateMeasurementValues.rr_intervals
Sequence of RR intervals, measuring the time between beats. Oldest first, in ints that are units of 1024ths of a second. This sequence will be empty if the device does not report the intervals. Caution: inexpensive heart rate monitors may not measure this accurately. Do not use for diagnosis.
For example:
bpm = svc.measurement_values.heart_rate
- contact¶
Alias for field number 1
- energy_expended¶
Alias for field number 2
- heart_rate¶
Alias for field number 0
- rr_intervals¶
Alias for field number 3
- class adafruit_ble_heart_rate.HeartRateService(service: HeartRateService | None = None)¶
Service for reading from a Heart Rate sensor.
- property location: str¶
The location of the sensor on the human body, as a string.
Note that the specification describes a limited number of locations. But the sensor manufacturer may specify using a non-standard location. For instance, some armbands are meant to be worn just below the inner elbow, but that is not a prescribed location. So the sensor will report something else, such as “Wrist”.
Possible values are: “Other”, “Chest”, “Wrist”, “Finger”, “Hand”, “Ear Lobe”, “Foot”, and “InvalidLocation” (if value returned does not match the specification).