Tensimeter Digital Online Blynk + BPM Heartbeat
Pada kesempatan kali ini saya aka menjelaskan mengenai bagaimana cara membuat sebuah tensimeter digital yang dapat dimonitor secara online menggunakan aplikasi Blynk. alat ini layaknya seperti tensimeter yang dapat mengukur sistole dan diastole serta juga dapat mengukur bpm. yang harus diperhatikan pada alat ini yaitu harus dilakukan kalibrasi secara berkala agar didapat hasil yang akurat.
a. Wemos D1 mini
c. LCD 16x2 + I2C
d. Sensor Bpm Max30100
e. Driver Pompa dan Solenoid
f. Skema Alat
#include <Arduino.h>
#include <math.h>
#include <Wire.h>
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include "MAX30100.h"
#include <LiquidCrystal_I2C.h>
MAX30100* pulseOxymeter;
LiquidCrystal_I2C lcd(0x27, 16,2);
char auth[] = "hjgjhgjhGJHGOIUOiuoikjbbhvSDGDH";
char ssid[] = "hotspotku hp";
char pass[] = "123456789";
SimpleTimer timer;
float spo;
float bpm;
int counter;
int motor = D7;
int solenoid = D6;
int dataadc;
int tombol = D4;
int tombolx;
int hitung;
float vol;
float mmhg;
float mmhgx;
float sistole;
float diastole;
int sistolex;
int diastolex;
int mark = 0;
void sendSensor()
{
Blynk.virtualWrite(V5, bpm);
Blynk.virtualWrite(V6, sistolex);
Blynk.virtualWrite(V7, diastolex);
delay(1000);
}
void setup() {
lcd.clear();
lcd.begin();
lcd.noCursor();
Wire.begin();
Serial.begin(9600);
Serial.println("Pulse oxymeter test!");
pulseOxymeter = new MAX30100();
Blynk.begin(auth, ssid, pass);
timer.setInterval(1000L, sendSensor);
pinMode(motor,OUTPUT);
pinMode(solenoid,OUTPUT);
pinMode(tombol,INPUT_PULLUP);
lcd.setCursor(0,0);
lcd.print("BPM= ");
lcd.setCursor(0,1);
lcd.print("S= D= ");
}
void loop() {
dataadc = analogRead(A0);
mmhgx = (dataadc - 46.222) / 3.2;
lcd.setCursor(0,1);
lcd.print("S= ");
lcd.print(sistolex);
lcd.print(" D= ");
lcd.print(diastolex);
lcd.print(" ");
tombolx = digitalRead(tombol);
if(tombolx == LOW){
mark = 0;
lcd.clear();
delay(1000);
digitalWrite(motor,HIGH);
digitalWrite(solenoid,HIGH);
mulai();
}
pulseoxymeter_t result = pulseOxymeter->update();
if( result.pulseDetected == true )
{
//Serial.print( "BPM: " );
//Serial.print( result.heartBPM );
lcd.setCursor(0,0);
lcd.print("BPM= ");
lcd.print(result.heartBPM);
lcd.print(" ");
bpm = result.heartBPM;
spo = result.SaO2;
}
counter++;
if(counter > 100){
counter = 0;
Blynk.run();
timer.run();
}
delay(10);
}
void mulai(){
dataadc = analogRead(A0);
mmhg = (dataadc - 46.222) / 3.2;
if((mmhg >= mmhgx + 10)&&(mmhg > 100)&&(mark == 0)){
//digitalWrite(motor,LOW);
Serial.println("SISTOLE");
sistole = mmhg;
mark = 2;
digitalWrite(motor,LOW);
}
if((mmhg >= mmhgx + 5)&&(mmhg > 50)&&(mmhg < 90)&&(mark == 2)){
//digitalWrite(motor,LOW);
Serial.println("DIASTOLE");
diastole = mmhg;
mark = 3;
}
lcd.setCursor(0,1);
lcd.print("S= ");
lcd.print(mmhg);
lcd.print(" ");
if(mmhg >= 150)
{
digitalWrite(motor,LOW);
}
mmhgx = mmhg;
Serial.println(mmhg);
if((mark == 3)&&(mmhg < 50)){
lcd.clear();
delay(1000);
mark = 0;
sistolex = sistole;
diastolex = diastole;
digitalWrite(solenoid,LOW);
Blynk.run();
timer.run();
return;
}
delay(1);
mulai();
}
h. VIDEO HASILNYA
No comments:
Post a Comment