I using esp 01 adapter to connect with arduino
Vcc- 5V for Arduino Uno
Gnd-Gnd
RX-2
TX-3
SENSOR-LM35 , MAX30102
firmware i use is this https://www.youtube.com/watch?app=desktop&v=MPyShmRcgD0
My project is Health Monitoring System, here is the coding
#define BLYNK_TEMPLATE_NAME "Heath Monitoring System"
#define BLYNK_AUTH_TOKEN "KqgPmpyCAf9XrWiLNWWmREecLQUEYfBP"
#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include "MAX30102_PulseOximeter.h"
char auth[] = BLYNK_AUTH_TOKEN;
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "";
char pass[] = "";
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(2, 3); // RX, TX\
// Your ESP8266 baud rate:
#define ESP8266_BAUD 9600
ESP8266 wifi(&EspSerial);
#define REPORTING_PERIOD_MS 1000
#define sensor A0
LiquidCrystal_I2C lcd(0x27, 16, 2);
byte smile[] = {
B00000,
B00000,
B01010,
B00000,
B10001,
B01110,
B00000,
B00000
};
byte mod[] = {
B00000,
B00000,
B01010,
B00000,
B11111,
B00000,
B00000,
B00000
};
byte sad[] = {
B00000,
B00000,
B01010,
B00000,
B01110,
B10001,
B00000,
B00000
};
PulseOximeter pox;
uint32_t tsLastReport = 0;
float BPM, SpO2;
void onBeatDetected()
{
Serial.println("Beat!!!");
}
void setup()
{
Serial.begin(9600);
// Set ESP8266 baud rate
EspSerial.begin(ESP8266_BAUD);
delay(10);
//Blynk.begin(auth, wifi, ssid, pass);
// You can also specify server:
Blynk.begin(auth, wifi, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(auth, wifi, ssid, pass, IPAddress(192,168,1,100), 8080);
lcd.init();
lcd.backlight();
lcd.createChar(1 , smile);
lcd.createChar(2 , mod);
lcd.createChar(3 , sad);
lcd.setCursor(0, 0);
lcd.print(" Pluse");
lcd.setCursor(0, 1);
lcd.print(" Oximeter");
delay(2000);
if (!pox.begin()) {
Serial.println("FAILED");
for (;;);
} else {
Serial.println("SUCCESS");
}
pox.setIRLedCurrent(MAX30102_LED_CURR_7_6MA);
pox.setOnBeatDetectedCallback(onBeatDetected);
}
void temperature()
{
float reading=analogRead(sensor);
float temperature=reading*((5.0*100.0-0.5)/1024.0); //VOTAGE*ADC converting from 10 mv per degree wit 500 mV offset to degrees ((voltage - 500mV) times 100)
delay(10);
/*------Display Result------*/
lcd.setCursor(12,0);
lcd.print(temperature,1);
lcd.print("C");
}
void loop()
{
Blynk.run();
BPM = pox.getHeartRate();
SpO2 = pox.getSpO2();
pox.update();
if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
Blynk.virtualWrite(V4, BPM);
Blynk.virtualWrite(V1, SpO2);
lcd.clear();
lcd.setCursor(0 , 0);
lcd.print("BPM : ");
lcd.print(pox.getHeartRate(),1);
lcd.setCursor(0 , 1);
lcd.print("Sp02: ");
lcd.print(pox.getSpO2());
lcd.print("%");
tsLastReport = millis();
if (pox.getSpO2() >= 96) {
lcd.setCursor(15 , 1);
lcd.write(1);
}
else if (pox.getSpO2() <= 95 && pox.getSpO2() >= 91) {
lcd.setCursor(15 , 1);
lcd.write(2);
}
else if (pox.getSpO2() <= 90) {
lcd.setCursor(15 , 1);
lcd.write(3);
}
temperature();
}
}