/esp-idf-max32664-hub

MAX32664 Hub library for ESP-IDF

Primary LanguageC++MIT LicenseMIT

SparkFun Pulse Oximeter and Heart Rate Sensor component for ESP-IDF

This is a modified version of the original from Sparkfun

Use it at your own risk.


SparkFun Pulse Oximeter and Heart Rate Monitor

SparkFun Pulse Oximeter and Heart Rate Monitor (SEN-15291)

The sensor is an I²C based biometric sensor, utilizing two chips from Maxim Integrated: the MAX32664 Bio Metric Sensor Hub and the MAX30101 Pulse Oximetry and Heart-Rate Module.

Documentation

  • Hookup Guide - Basic hookup guide for the SparkFun Pulse Oximeter and Heart Rate Sensor.

Products that use this library

License Information

This product is open source!

Various bits of the code have different licenses applied. Anything SparkFun wrote is beerware; if you see me (or any other SparkFun employee) at the local and you've found our code helpful, please buy us a round!

Please use, reuse, and modify these files as you see fit. Please maintain attribution to SparkFun Electronics and release anything derivative under the same license.

Distributed as-is; no warranty is given.

How to Use

From the ESP-IDF component registry

This component is available in the ESP-IDF component registry.

  1. To add this component to your project, run: idf.py add-dependency "franzbischoff/max32664-hub^0.9.5"

  2. To create a project from the example, run: idf.py create-project-from-example "franzbischoff/max32664-hub^0.9.5:basic"

From this repository

  1. Clone this repository into your project's components folder.

  2. Or, as a submodule: In your project, add this as a submodule to your components/ directory.

git submodule add https://github.com/franzbischoff/esp-idf-max32664-hub
git submodule update --init --recursive

The library can be configured via idf.py menuconfig under Component config->MAX32664 I2C config.

Example

One of the original examples was modified and is in the example/ directory.

Tips, Tricks, and Gotchas

This code was mainly rewritten to use the i2c driver directly from ESP-IDF. The original code was using the Wire library from Arduino. Since the time is short, I transcripted much of the Wire code, so this code can be further improved by using the i2c functions even more directly (contributions are welcome).

The Wire library uses semaphores everywhere, and I do not know if this is really needed here since the i2c driver may be using semaphores itself. These code chunks are disabled by default but can be enabled by defining the macro CONFIG_ENABLE_HAL_LOCKS in the component config.

The example contained in this repository is minimal. It is advised to check the examples from the original Sparkfun's repository. You may want to tweak the Pulse Width and Sampling Rate for your application, and different values may require different delay times in the loop process.

The initial readings may be preceded by a few warnings from the I2C driver. You can ignore them safely.

Wait for the sensor to start reading, and then you can try with your finger on the sensor. Be patient, as it may take a few (lot) seconds to get the first readings. Try switching fingers if it takes too long, and don't press too hard.

If you get lots of I2C timeout errors, check the power supply. You may need to use a separate 3.3V power supply for the sensor.

Finally, check if CONFIG_FREERTOS_HZ is set to 1000 in menuconfig. If not, set it to 1000!