Hello friends
im doing one project which collects health parameter of the patient so I'm using ESP8266 module as main controller and sensors MAX30100 pulse and Spo2 ,Blood pressure sensor with serial out(Blood Pressure Sensor - Serial output [1437] : Sunrom Electronics) , and MLX IR temperature sensor ... so I googled many time I did not found how to connect two I2C device to one SCL and SDA line and I'm also interfacing Blood pressure sensor along I'm nebie in ESP8266 and Arduino coding .... and I tried interfacing blood pressure sensor and MAX30100 but both not working here is code for that ... please I really need help ... if anyone know how solve please contact me on this mail ID (1MS18TE400@gmail.com)
#include <Wire.h>
#include <SoftwareSerial.h>
#include "MAX30100_PulseOximeter.h"
//#include <Adafruit_MLX90614.h>
#define BLYNK_PRINT Serial
#include <Blynk.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define REPORTING_PERIOD_MS 100
char auth[] = ""; // You should get Auth Token in the Blynk App.
char ssid[] = ""; // Your WiFi credentials.
char pass[] = "";
PulseOximeter pox;
SoftwareSerial portTwo(15, 13);
//Adafruit_MLX90614 mlx = Adafruit_MLX90614();
uint32_t tsLastReport = 0;
int spo2;
char sbuffer[30], ch;
unsigned char pos;
unsigned char read1, read2, read3;
//double temp_amb = 0;
//double temp_obj = 0;
//double calibration = 2.36;
void onBeatDetected()
{
Serial.println("Beat!");
}
char mygetchar(void)
{ //receive serial character from sensor (blocking while nothing received)
while (!portTwo.available());
return portTwo.read();
}
void setup()
{
Serial.begin(115200);
Serial1.begin(9600);
portTwo.begin(9600);
Blynk.begin(auth, ssid, pass);
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);
// mlx.begin();
}
void loop()
{
Blynk.run();
pox.update();
spo2 = pox.getSpO2();
if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
Serial.print("bpm / SpO2:");
Serial.print(spo2);
Serial.println("%");
Blynk.virtualWrite(V4, spo2);
tsLastReport = millis();
}
delay(10000);
///code for blood pressure sensor
ch = mygetchar(); //loop till character received
if (ch == 0x0A) // if received character is , 0x0A, 10 then process buffer
{
pos = 0; // buffer position reset for next reading
// extract data from serial buffer to 8 bit integer value
// convert data from ASCII to decimal
read1 = ((sbuffer[1] - '0') * 100) + ((sbuffer[2] - '0') * 10) + (sbuffer[3] - '0');
read2 = ((sbuffer[6] - '0') * 100) + ((sbuffer[7] - '0') * 10) + (sbuffer[8] - '0');
read3 = ((sbuffer[11] - '0') * 100) + ((sbuffer[12] - '0') * 10) + (sbuffer[13] - '0');
// Do whatever you wish to do with this sensor integer variables
// Show on LCD or Do some action as per your application
// Value of variables will be between 0-255
// example: send demo output to serial monitor on "Serial"
Serial.print("SYSTOLIC:");
Serial.print(read1);
Serial.print('\n');
Serial.print("DYSTOLIC:");
Serial.print(read2);
Serial.print('\n');
Serial.print("PULSE");
Serial.print(read3);
Serial.print('\n');
Serial.println();
} else { //store serial data to buffer
sbuffer[pos] = ch;
pos++;
}
delay(10000);
}