pyupm_max30100 module¶
-
class
pyupm_max30100.
MAX30100
(i2c_bus)[source]¶ Bases:
object
API for the Pulse oximeter and heart-rate sensor.
ID: max30100
Name: Pulse Oximeter and Heart-rate Sensor
Category: medical
Manufacturer: maxim
Link:https://www.maximintegrated.com/en/products/analog/sensors-and- sensor- interface/MAX30100.html
Connection: i2c gpio The MAX30100 is an integrated pulse oximetry and heartrate monitor sensor solution. It combines two LEDs, a photodetector, optimized optics, and low-noise analog signal processing to detect pulse oximetry and heart- rate signals.
I2C sensor which can be used to read: Heart-rate Peripheral capillary oxygen saturation temperature
C++ includes: max30100.hpp
-
current
(ir, r)[source]¶ void current(MAX30100_LED_CURRENT ir, MAX30100_LED_CURRENT r)
Set the current for the infrared and red LEDs
ir: LED current enum
r: LED current enum
std::runtime_error: on I2C command failure
-
current_ir
()[source]¶ MAX30100_LED_CURRENT current_ir()
Get the infrared LED current
std::runtime_error: on I2C command failure
-
current_r
()[source]¶ MAX30100_LED_CURRENT current_r()
Get the red LED current
std::runtime_error: on I2C command failure
-
high_res_enable
(*args)[source]¶ bool high_res_enable()
Get the high-resolution enable bit
Current high-resolution bit value
std::runtime_error: on I2C command failure
-
mode
(*args)[source]¶ MAX30100_MODE mode()
Get the sampling mode
Current sampling mode
std::runtime_error: on I2C command failure
-
pulse_width
(*args)[source]¶ MAX30100_LED_PW pulse_width()
Get the LED pulse width
Current LED pulse width
std::runtime_error: on I2C command failure
-
read
(reg)[source]¶ uint8_t read(MAX30100_REG reg)
Read Oximeter and heart-rate sensor registers
reg: Target register to read
Data returned from sensor
std::runtime_error: if I2C read command fails
-
reset
()[source]¶ void reset()
Reset sensor
When the RESET bit is set to one, all configuration, threshold, and data registers are reset to their power-on-state. The only exception is writing both RESET and TEMP_EN bits to one at the same time since temperature data registers 0x16 and 0x17 are not cleared. The RESET bit is cleared automatically back to zero after the reset sequence is completed.
std::runtime_error: on I2C command failure
-
sample
()[source]¶ max30100_value sample()
Sample a single set of infrared/red values
Note, all setup (sample rate, LED current, and pulse width must be done prior to calling this sample method.
One IR/R sample
std::runtime_error: on I2C command failure
-
sample_continuous
(gpio_pin, buffered, cb=None)[source]¶ void sample_continuous(int gpio_pin, bool buffered, Callback *cb=NULL)
Continuously sample Infrared/Red values.
This method requires a GPIO pin which is used to signal sample/samples ready. The INT * pin is open-drain and requires a pullup resistor. The interrupt pin is not designed to sink large currents, so the pull-up resistor value should be large, such as 4.7k ohm. The RCWL-0530 PCB which this library was designed with had the I2C lines and INT pin pulled up to 1.8v.
Note, all setup (sample rate, mode, LED current, and pulse width must be done prior to calling this sample method.
gpio_pin: GPIO pin for interrupt (input from sensor INT pin)
buffered: Enable buffered sampling. In buffered sampling mode, the device reads 16 samples at a time. This can help with I2C read timing. buffered == true, enable buffered sampling buffered == false, single- sample mode
cb: Pointer to instance of Callback class. If parameter is left NULL, a default instance of the Callback class will be used which prints out the IR/R values.
std::runtime_error: on I2C command failure
-
sample_rate
(*args)[source]¶ MAX30100_SR sample_rate()
Get the sample rate
Current sample rate
std::runtime_error: on I2C command failure
-
sleep
(sleep)[source]¶ void sleep(bool sleep)
Put device into power-save mode. While in power-save mode, all registers retain their values, and write/read operations function as normal. All interrupts are cleared to zero in this mode.
sleep: Enter/exit power-save mode
std::runtime_error: on I2C command failure
-
temperature
()[source]¶ float temperature()
Get temperature reading from device rd_data Temperature in degrees Celsius
std::runtime_error: on I2C command failure
-