hello guys, I'm working on a project that use MAX30100 pulse oximetry and DS18B20 Temperature sensor.
when I merged their codes together, MAX30100 doesn't work, but when I play each one they work probably. if anyone can help please.
this is the code while I'm a new user and can't upload it
#include <Wire.h> #include "MAX30100_PulseOximeter.h" #include <OneWire.h> #include <DallasTemperature.h> #define REPORTING_PERIOD_MS 1000
// Define to which pin of the Arduino the output of the TMP36 is connected:
// 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);
sensors.begin();
}
void loop()
{
// Make sure to call update as fast as possible
which one is better?? i work on OXullo Library
but when I operate each sensor on his own they work, but when i combine the both sensors the MAX30100 Gives results (0) so it is only work without giving results
i have tried them all, when i start the DS18B20 with MAX30100 serial monitor gives me a very good results for temperature, but!! the Heart Rate and SPo2 the results were zeros
So it looks like you are getting temperature updates only twice a second. That means that something in your use of the temperature sensor is causing large delays. The pulse sensor can't see pulses if it only gets 2 samples per second.
Figure out how to avoid delays in the DS18B20 library. One option might be to read the temperature only once per minute.
#include <Wire.h> #include "MAX30100_PulseOximeter.h" #include <OneWire.h> #include <DallasTemperature.h> #define REPORTING_PERIOD_MS 1000
// Define to which pin of the Arduino the output of the TMP36 is connected:
// 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);
sensors.begin();
}
void loop()
{
// Make sure to call update as fast as possible
I'm afraid that's not how it works on this forum. It's not a free code writing service. If you want someone to write your code for you, head to the Jobs and Paid Consultancy Forum and negotiate a mutually agreeable price.
Alternately, you can see the WaitForConversion and WaitForConversion2 examples that come with the DallasTemperature library. They demonstrate how to use it in a non-blocking manner.
Unfortunately not yet🙁 and now I'm facing another problem with SIM800L EvB it's getting hot when i connect it and didn't register on the network ever🙁 although the whole connection is correct
Ok. What I realised after looking for the issue is that both sensors work without the esp8266wifiserver. After I put the code for the WiFi server,I get the results only for one sensors. After many tryings,I realised that If I comment the requestTemperatures() function,the max30100 works and the ds18b20 sensors shows only one temperatures which doesn’t change.
I think that it s a problem at requestTemperatures() function from Dallas library.
void DallasTemperature::requestTemperatures()
{
_wire->reset();
_wire->skip();
_wire->write(STARTCONVO, parasite);
Turn off the WaitForConversion option and use a millis() timer to fetch the temperature and kick off a new conversion at intervals no faster than the sensor can complete a conversion.