-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
Hi,
Thanks for this library. I bought the oximeter sensor from Sparkfun (https://www.sparkfun.com/products/15219). I am trying to read the IR led count data but there are some periodic gaps in the data. Here is a short excerpt of the Serial monitor: https://pastebin.com/85jETjyG
Here is a graph showing periodic plateaus in the data (which are typically just gaps in data as the ESP32 is just polling the same value until a new value is available).
I have the same behaviour when reading the data only on interrupt and when the data ready flag is set to 1 (I am using ESP-IDF for that test):
The code I used when using the Arduino library is the following:
#include <SparkFun_Bio_Sensor_Hub_Library.h>
#include <Wire.h>
// No other Address options.
#define DEF_ADDR 0x55
// Reset pin, MFIO pin
const int resPin = 26;
const int mfioPin = 25;
//#define SDA 21
//#define SCL 22
//#define SDA 27
//#define SCL 14
// Possible widths: 69, 118, 215, 411us
int width = 69;
// Possible samples: 50, 100, 200, 400, 800, 1000, 1600, 3200 samples/second
// Not every sample amount is possible with every width; check out our hookup
// guide for more information.
int samples = 1600;
int pulseWidthVal;
int sampleVal;
// Takes address, reset pin, and MFIO pin.
SparkFun_Bio_Sensor_Hub bioHub(resPin, mfioPin);
bioData body;
// following data:
// body.irLed - Infrared LED counts.
// body.redLed - Red LED counts.
// body.heartrate - Heartrate
// body.confidence - Confidence in the heartrate value
// body.oxygen - Blood oxygen level
// body.status - Has a finger been sensed?
void setup(){
Serial.begin(115200);
Wire.begin();
int result = bioHub.begin();
int error = bioHub.configSensor(); // Configure Sensor
error = bioHub.setPulseWidth(width);
error = bioHub.setSampleRate(samples);
delay(1000);
}
void loop(){
// Information from the readSensor function will be saved to our "body"
// variable.
body = bioHub.readSensor();
Serial.println(body.irLed);
// Serial.print(" ");
// Serial.println(body.redLed);
// Slow it down or your heart rate will go up trying to keep up
// with the flow of numbers
}
Any idea why I get those periodic gap in the raw data?
Thanks in advance!
Metadata
Metadata
Assignees
Labels
No labels