Hi, I'm trying to display the heart rate on this sensor, but the only thing that's showing is that the oxmeter is running fine, but after that, it doesn't show me the heart beats, but it's showing me something like " ???[??[?????[??????????????M??????????". I'm new to this and I don't know what to do.
Please post your code
The easier you make it to read and copy your code the more likely it is that you will get help
Please follow the advice given in the link below when posting code , use code tags and post the code here
If you get errors when compiling please copy them from the IDE using the "Copy error messages" button and paste the clipboard here in code tags
Does the serial speed of the serial monitor match the serial speed of your secret sketch?
#include <Wire.h>
#include "MAX30100_PulseOximeter.h"
#define REPORTING_PERIOD_MS 1000
PulseOximeter pox;
uint32_t tsLastReport = 0;
void onBeatDetected()
{
Serial.println("Beat!");
}
void setup()
{
Serial.begin(115200);
Serial.print("Initializing pulse oximeter..");
// Initialize the PulseOximeter instance
// Failures are generally due to an improper I2C wiring, missing power supply
// or wrong target chip
if (!pox.begin()) {
Serial.println("FAILED");
for(;;);
} else {
Serial.println("SUCCESS");
}
//pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);
// Register a callback for the beat detection
pox.setOnBeatDetectedCallback(onBeatDetected);
}
void loop()
{
// Make sure to call update as fast as possible
pox.update();
if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
Serial.print("Heart rate:");
Serial.print(pox.getHeartRate());
Serial.print("bpm");
tsLastReport = millis();
}
}
My secret sketch isn't even secret, is taken from this forum Interfacing MAX30100 Pulse Oximeter Sensor with Arduino . Also I own the purple oximeter.
It was until you posted it and you did that wrong too
The easier you make it to read and copy your code the more likely it is that you will get help
Please follow the advice given in the link below when posting code , use code tags and post the code here
If you get errors when compiling please copy them from the IDE using the "Copy error messages" button and paste the clipboard here in code tags
I've edited my code. The problem is not in compiling, it is in the serial monitor. The only thing that's showing right, it's the Serial print with Initializing pulse oximeter .. SUCCESS
, shortly after, the only thing that's showing are just a bunch of random question marks and some random letters, instead of Beat!
or Heart rate:
... bpm
.
How is the oximeter wired to the Arduino?
The setup is :
VIN - 5V
GND - GND
SCL - A5
SDA - A4
Maybe try the debugging example from the library.
I found the sollution, the only thing that I had to do, I had to lower the Serial.begin
from 112500 to 9500.
...both of which are pretty unusual values.
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.