Translate

Monitor dan Kendali Suhu Menggunakan PID Thermocouple Tipe K

 Monitor dan Kendali Suhu Menggunakan PID Thermocouple Tipe K 


          Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang bisa memonitor dan mengendalikan suhu menggunakan PID Control, alat ini menggunakan sensor thermocouple tipe K dan sensor asap. untuk fiturnya yaitu alat ini dapat diatur waktunya kapan dia ON dan OFF serta bisa disetting setpoint suhunya. untuk lebih jelasnya berikut adalah daftar komponen dan programnya.



a. Arduino Uno




b. Thermocouple Tipe K + Amplifier




c. Sensor Asap




d. RTC 




e. SSR (Solid state relay)






f. Program Arduino IDE

#include <Wire.h>
#include <LiquidCrystal_I2C.h> 
#include <max6675.h>
#define DS3231_I2C_ADDRESS 0x68

LiquidCrystal_I2C lcd(0x27, 20, 4);

int soPin = 7;
int thermoCS = 6;
int thermoCLK = 5;
int urutan;
int so1Pin  = 10;
int CS1Pin = 9;
int CLK1Pin= 8;
int ledM = 11;
int ledH = 13;
int buzzer = 12;

MAX6675 thermocouple(thermoCLK, thermoCS, soPin);
MAX6675 thermocouple1(CLK1Pin, CS1Pin, so1Pin);

int btset = A1;
int btup = A2;
int btdown = A3;
int btok = 2;
int btback = 4;
int ssr = 3;

int mark = 0;
int kipasx;
int x;
int btsetx;
int btupx;
int btdownx;
int btokx;
int btbackx;

int jam;
int asap;
int temp1;
int temp2;
int jamku;
float suhusp;
int modeku;
int menitku;

float kp = 1.15;
float ki = 0.67;
float kd = 0.15;

float p,i,d,suhu,pid;
float error,errorx,sumerr;
float sp;
float pidku;

byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;

// Convert normal decimal numbers to binary coded decimal
byte decToBcd(byte val)
{
  return( (val/10*16) + (val%10) );
}
// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
{
  return( (val/16*10) + (val%16) );
}

void setup()
{
  lcd.begin();
  lcd.clear();
  lcd.noCursor();
 
  pinMode(buzzer,OUTPUT);
  pinMode(ledM,OUTPUT);
  pinMode(ledH,OUTPUT);
  pinMode(ssr,OUTPUT);
  pinMode(btset,INPUT_PULLUP);
  pinMode(btup,INPUT_PULLUP);
  pinMode(btdown,INPUT_PULLUP);
  pinMode(btok,INPUT_PULLUP);
  pinMode(btback,INPUT_PULLUP);
 
  Wire.begin();
  Serial.begin(9600);
  // DS3231 seconds, minutes, hours, day, date, month, year
  setDS3231time(0,0,0,6,5,10,18); 
}

void setDS3231time(byte second, byte minute, byte hour, byte dayOfWeek, byte
dayOfMonth, byte month, byte year)
{
  // sets time and date data to DS3231
  Wire.beginTransmission(DS3231_I2C_ADDRESS);
  Wire.write(0); // set next input to start at the seconds register
  Wire.write(decToBcd(second)); // set seconds
  Wire.write(decToBcd(minute)); // set minutes
  Wire.write(decToBcd(hour)); // set hours
  Wire.write(decToBcd(dayOfWeek)); // set day of week (1=Sunday, 7=Saturday)
  Wire.write(decToBcd(dayOfMonth)); // set date (1 to 31)
  Wire.write(decToBcd(month)); // set month
  Wire.write(decToBcd(year)); // set year (0 to 99)
  Wire.endTransmission();
}

void readDS3231time(byte *second,
byte *minute,
byte *hour,
byte *dayOfWeek,
byte *dayOfMonth,
byte *month,
byte *year)
{
  Wire.beginTransmission(DS3231_I2C_ADDRESS);
  Wire.write(0); // set DS3231 register pointer to 00h
  Wire.endTransmission();
  Wire.requestFrom(DS3231_I2C_ADDRESS, 7);
  // request seven bytes of data from DS3231 starting from register 00h
  *second = bcdToDec(Wire.read() & 0x7f);
  *minute = bcdToDec(Wire.read());
  *hour = bcdToDec(Wire.read() & 0x3f);
  *dayOfWeek = bcdToDec(Wire.read());
  *dayOfMonth = bcdToDec(Wire.read());
  *month = bcdToDec(Wire.read());
  *year = bcdToDec(Wire.read());
}

void displayTime()
{
 
  // retrieve data from DS3231
  readDS3231time(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month,
  &year);
 
  lcd.setCursor(0,0);
  // send it to the serial monitor
  lcd.print(hour, DEC);
  // convert the byte variable to a decimal number when displayed
  lcd.print(":");
  if (minute<10)
  {
    lcd.print("0");
  }
  lcd.print(minute, DEC);
  lcd.print(":");
  if (second<10)
  {
    lcd.print("0");
  }
  lcd.print(second, DEC);
    
}

void loop()
{
  digitalWrite(ssr,HIGH);
  
  asap = analogRead(A0);  
  temp1 = thermocouple.readCelsius();
  temp2 = thermocouple1.readCelsius();
    
  lcd.setCursor(0,1);
  lcd.print("SUHU1 : "); 
  lcd.print(temp1 );
  lcd.print(" 'C     ");
  
  lcd.setCursor(0,2);
  lcd.print("SUHU2 : "); 
  lcd.print(temp2);
  lcd.print(" 'C     ");

  lcd.setCursor(0,3);
  lcd.print("ASAP: "); 
  lcd.print(asap);
  lcd.print("   ");
  
  btsetx = digitalRead(btset);
  
  if(btsetx == 0){
  delay(200);
  lcd.clear();  
  pilih();
  }
  
  if(modeku == 1){
  delay(200);
  lcd.clear();    
  setmanual();
  setDS3231time(0,0,0,6,5,10,18); 
  mulaimanu();
  }

  if(modeku == 2){
  delay(200);
  lcd.clear();    
  setDS3231time(0,0,0,6,5,10,18); 
  
  suhusp = 32.2;
  urutan = 1;
  mulaioto();
  
  suhusp = 48.8;
  urutan = 2;
  mulaioto();
  
  suhusp = 54.4;
  urutan = 3;
  mulaioto();
  
  suhusp = 65.5;
  urutan = 4;
  mulaioto();
  }   
      
  //displayTime();
  delay(1000);
   
}

void pilih(){

  btokx = digitalRead(btok);
  btbackx = digitalRead(btback);
  
  lcd.setCursor(5,0);
  lcd.print("PILIH MODE"); 
  lcd.setCursor(0,2);
  lcd.print("MANUAL      OTOMATIS");
  
  if(btokx == 0){
  delay(1000);
  lcd.clear();  
  modeku = 2;
  return;
  }
  
  if(btbackx == 0){
  delay(1000);
  lcd.clear();    
  modeku = 1;
  return;
  }

pilih();
}

void setmanual(){
  
lcd.setCursor(0,0);
lcd.print("PILIH JAM: ");  
lcd.print(jamku);
lcd.print("   "); 
lcd.setCursor(0,1);
lcd.print("PILIH MENIT: ");  
lcd.print(menitku);
lcd.print("   "); 
lcd.setCursor(0,2);
lcd.print("PILIH SUHU: ");  
lcd.print(suhusp);
lcd.print("   "); 

if(jamku < 0){
jamku = 0;
}

if(suhusp < 0){
suhusp = 0;
}

btsetx = digitalRead(btset);
btupx = digitalRead(btup);
btdownx = digitalRead(btdown);
btokx = digitalRead(btok);
btbackx = digitalRead(btback);

if(btupx == 0){
delay(200);
menitku = menitku + 30;
}

if(btdownx == 0){
delay(200);
menitku = menitku - 30;
}

if(menitku > 30){
jamku++;
menitku = 0;
}

if(menitku < 0){
menitku = 0;
jamku--;
}

if(btokx == 0){
delay(200);
suhusp = suhusp + 0.5;
}

if(btbackx == 0){
delay(200);
suhusp = suhusp - 0.5;
}

if(btsetx == 0){
delay(200);
lcd.clear();
return;
}

setmanual();
}

void mulaimanu(){
  
  btokx = digitalRead(btok);
  btbackx = digitalRead(btback);
  
  if((btbackx == 0)&&(btokx == 0)){
  lcd.clear();
  delay(1000);
  modeku = 0;
  return;
  }
  
  analogWrite(ssr,pidku);
 
  error = suhusp - temp1;
  p = error * kp;
  sumerr = error + errorx;
  i = ki * sumerr;
  d = kd * (error - errorx) ;
  pid = p + i + d;
 
  if(pid < 1){
  pid = 0;
  }
 
  if(pid > 255){
  pid = 255;
  }
 
  pidku = 255 - pid;
 
  lcd.setCursor(11,3); 
  lcd.print(jamku);
  lcd.print(".");
  lcd.print(menitku);
  lcd.print("/");
  lcd.print(suhusp);
   
  asap = analogRead(A0); 
  temp1 = thermocouple.readCelsius();
  temp2 = thermocouple1.readCelsius();
  
  lcd.setCursor(14,1);
  lcd.print(pid);
  lcd.print("  ");
  
  lcd.setCursor(14,0);
  lcd.print("MANUAL"); 
  
  lcd.setCursor(0,1);
  lcd.print("SUHU1: "); 
  lcd.print(temp1);
  lcd.print(" 'C ");
  
  lcd.setCursor(0,2);
  lcd.print("SUHU2: "); 
  lcd.print(temp2);
  lcd.print(" 'C ");
  
  lcd.setCursor(0,3);
  lcd.print("ASAP: "); 
  lcd.print(asap);
  lcd.print(" ");
  
  displayTime();
  delay(1000);
  
  if((hour == jamku)&&(minute == menitku)){
  lcd.clear();
  delay(1000);
  modeku = 0;
  return;
  }
  
  if(asap < 500){
  digitalWrite(ledH,HIGH);
  digitalWrite(ledM,LOW);
  digitalWrite(buzzer,LOW);
  }
  
  if(asap > 500){
  digitalWrite(ledH,LOW);
  digitalWrite(ledM,HIGH);
  digitalWrite(buzzer,HIGH);
  }
  
errorx = error;  
mulaimanu();
}

void mulaioto(){
    
  btokx = digitalRead(btok);
  btbackx = digitalRead(btback);
 
 if((btbackx == 0)&&(btokx == 0)){
  lcd.clear();
  delay(1000);
  modeku = 0;
  return;
  }
  
  analogWrite(ssr,pidku);
 
  error = suhusp - temp1;
  p = error * kp;
  sumerr = error + errorx;
  i = ki * sumerr;
  d = kd * (error - errorx) ;
  pid = p + i + d;
  
  if(pid < 1){
  pid = 0;
  }
 
  if(pid > 255){
  pid = 255;
  }
 
  pidku = 255 - pid;
  
  lcd.setCursor(11,3); 
  lcd.print("1");
  lcd.print(".");
  lcd.print("30");
  lcd.print("/");
  lcd.print(suhusp);
   
  asap = analogRead(A0); 
  temp1 = thermocouple.readCelsius();
  temp2 = thermocouple1.readCelsius();
  
  lcd.setCursor(14,1);
  lcd.print(pid);
  lcd.print("  ");
  
  lcd.setCursor(14,0);
  lcd.print("OTO"); 
  lcd.print(urutan); 
  lcd.setCursor(0,1);
  lcd.print("SUHU1: "); 
  lcd.print(temp1);
  lcd.print(" 'C ");
  
  lcd.setCursor(0,2);
  lcd.print("SUHU2: "); 
  lcd.print(temp2);
  lcd.print(" 'C ");
  
  lcd.setCursor(0,3);
  lcd.print("ASAP: "); 
  lcd.print(asap);
  lcd.print(" ");
  
  displayTime();
  delay(1000);
  
  if((hour == 1)&&(minute == 30)){
  lcd.clear();
  delay(1000);
  modeku = 0;
  return;
  }  
  
  if(asap < 500){
  digitalWrite(ledH,HIGH);
  digitalWrite(ledM,LOW);
  digitalWrite(buzzer,LOW);
  }
  
  if(asap > 500){
  digitalWrite(ledH,LOW);
  digitalWrite(ledM,HIGH);
  digitalWrite(buzzer,HIGH);
  }

errorx = error;    
mulaioto();  
}  




g. VIDEO HASILNYA









Monitor Kadar Oksigen dalam Darah (SPO2) ONLINE Thingspeak

 Monitor Kadar Oksigen dalam Darah (SPO2) ONLINE Thingspeak
 

           Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang dapat mengukur kadar oksigen dalam darah dengan monitor via Thingspeak secara online. jadi komunikasi alat dengan server dengan menggunakan internet. sensor yang dipakai adalah max30100 untuk lebih jelasnya berikut adalah daftar komponen dan programnya.



a. Wemos D1 mini




b. Sensor Max30100




c. LCD + I2C






d. Program Arduino IDE

#include <ThingSpeak.h>
#include <ESP8266WiFi.h>
#include <Wire.h>
#include "MAX30100.h"
#include <LiquidCrystal_I2C.h>   
LiquidCrystal_I2C lcd(0x27,16,2);

WiFiClient client;

// ThingSpeak Settings

String apiKey = "56GJDDGKJH56GJF";
const char *ssid = "okok";
const char *pass = "123456789";
const char* server = "api.thingspeak.com";

MAX30100* pulseOxymeter;

int counter;
float Spo;

void setup() {
 
  Wire.begin();
  Serial.begin(115200);
  lcd.begin();
  lcd.clear();
 
  Serial.println("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED){\
   pulseOxymeter = new MAX30100();
 
    delay(200);
    Serial.println(".");
    }
  Serial.println("");
  Serial.println("WiFi connected");
}

void loop(){
 
pulseoxymeter_t result = pulseOxymeter->update();
 
if( result.pulseDetected == true ){
    
    lcd.setCursor(2,0);
    lcd.print( "SpO2: " );
    lcd.print( result.SaO2);
    lcd.println( " %          ");
   
 Spo = result.SaO2;
 
}
 
  counter++;

if(counter > 100){
    counter = 0;
   
if(client.connect(server, 80)){
    String postStr= apiKey;
    postStr += "&field1=";
    postStr += String(Spo);
    postStr += "\r\n\r\n";
    client.print("POST /update HTTP/1.1\n");
    client.print("Host: api.thingspeak.com\n");
    client.print("Connection: close\n");
    client.print("X-THINGSPEAKAPIKEY: "+apiKey+"\n");
    client.print("Content-Type: application/x-www-form-urlencoded\n");
    client.print("Content-Length: ");
    client.print(postStr.length());
    client.print("\n\n");
    client.print(postStr);
    
    Serial.println(Spo);
    Serial.println("%. Send to Thingspeak.");
    
  }

  client.stop();
  Serial.println("Waiting...");
  delay(15000);
}
 
}




e. Gambar Hasilnya






f. VIDEO HASILNYA






 

Monitor dan Kendali Suhu Kompor Listrik Menggunakan Arduino dan Thermocouple Tipe K

 Monitor dan Kendali Suhu Kompor Listrik Menggunakan Arduino dan Thermocouple Tipe K


          Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang dapat memonitor suhu dan mengendalikan suhu agar disuatu range suhu tertentu dengan menggunakan Arduino. untuk sensor yang dipakai yaitu thermocouple tipe K dan pemanas yang digunakan adalah kompor listrik. untuk lebih jelasnya berikut adalah daftar komponen dan programnya.



a. Arduino Uno




b. LCD I2C




c. SSR AC DC




d. Driver Motor IBT2




e. Thermocouple Tipe K + Ampli




f. Program Arduino IDE

#include <max6675.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2);

int soPin = 4;
int thermoCS = 5;
int thermoCLK = 6;

int so1Pin  = 7;
int CS1Pin = 8;
int CLK1Pin= 9;
int buzzer = 12;

int motor1 = 10;
int motor2 = 11;

int bt1 = A0;
int bt2 = A1;
int bt3 = A2;
int bt4 = A3;
int bt5 = 2;

int bt1x;
int bt2x;
int bt3x;
int bt4x;
int bt5x;
int temp1;
int temp2;
int ssr = 3;

int sp = 150;
int waktu = 0;
int counter;
int mode;
int countx;

MAX6675 thermocouple(thermoCLK, thermoCS, soPin);
MAX6675 thermocouple1(CLK1Pin, CS1Pin, so1Pin);

void setup() {
 
  Serial.begin(9600);
  lcd.begin(); 
  lcd.clear();

  pinMode(bt1,INPUT_PULLUP);
  pinMode(bt2,INPUT_PULLUP);
  pinMode(bt3,INPUT_PULLUP);
  pinMode(bt4,INPUT_PULLUP);
  pinMode(bt5,INPUT_PULLUP);
  pinMode(ssr,OUTPUT); 
  pinMode(buzzer,OUTPUT);
  pinMode(motor1,OUTPUT);
  pinMode(motor2,OUTPUT);
  digitalWrite(buzzer,LOW);
}

void loop() {

 analogWrite(motor1,200);
 analogWrite(motor2,0);
  
 temp1 = thermocouple.readCelsius();
 temp2 = thermocouple1.readCelsius();

 bt1x = digitalRead(bt1);
 bt2x = digitalRead(bt2);
 bt3x = digitalRead(bt3);
 bt4x = digitalRead(bt4);
 bt5x = digitalRead(bt5);

 lcd.setCursor(0,0);
 lcd.print("T: "); 
 lcd.print(temp1);
 lcd.print(" / "); 
 lcd.print(temp2);
 lcd.print("     ");

 lcd.setCursor(0,1);
 lcd.print("W: "); 
 lcd.print(waktu);
 lcd.print(" P: "); 
 lcd.print(sp);
 lcd.print("    ");
 
 if(temp1 <= sp){
 digitalWrite(ssr,LOW);
 //digitalWrite(buzzer,LOW);
 }

 if(temp1 > sp){
 digitalWrite(ssr,HIGH);
 //digitalWrite(buzzer,HIGH);
 }

if(bt1x == 0){
 lcd.clear(); 
 waktu = 3000;
 mode = 1; 
 sp = 205;
 countx = 180;
 mulai();
}

if(bt2x == 0){
 lcd.clear();
 waktu = 4500;
 mode = 2; 
 sp = 230;
 countx = 225;
 mulai();
}

if(bt3x == 0){
 lcd.clear(); 
 waktu = 6000;
 mode = 3; 
 sp = 250; 
 countx = 240;
 mulai();
}
     
delay(200);
}

void mulai(){
   
 temp1 = thermocouple.readCelsius();
 temp2 = thermocouple1.readCelsius();

 bt5x = digitalRead(bt5);

 if(temp1 < sp){
 digitalWrite(ssr,LOW);
 digitalWrite(buzzer,LOW);
 }

 if(temp1 > sp){
 digitalWrite(ssr,HIGH);
 digitalWrite(buzzer,HIGH);
 }
  
 lcd.setCursor(0,0);
 lcd.print("T: "); 
 lcd.print(temp1);
 lcd.print(" / "); 
 lcd.print(temp2);
 lcd.print(" ");
 lcd.print(counter);
  
 lcd.setCursor(0,1);
 lcd.print("W: "); 
 lcd.print(waktu);
 lcd.print(" P: "); 
 lcd.print(sp);
 lcd.print("    ");  

if(temp1 >= countx){
counter++;  
}

if(counter > waktu){
  counter = 0;
  waktu = 0;
  sp = 150;
  digitalWrite(ssr,HIGH);
  lcd.clear();
  return;
}

if(bt5x == 0){
  counter = 0;
  waktu = 0;
  sp = 150;
  digitalWrite(ssr,HIGH);
  lcd.clear();
  return;
}

delay(200);  
mulai();  
}




g. VIDEO HASILNYA







Tutorial Setup Blynk untuk Arduino / Nodemcu ESP8266 / Wemos D1

 Tutorial Setup Blynk untuk Arduino / Nodemcu ESP8266 / Wemos D1
 

        Pada kesempatan kali ini saya akan menjelaskan mengenai step by step setup blynk agar terhubung ke arduino melalui internet. caranya sangatlah mudah yang pertama yaitu harus instal terlebih dahulu aplikasi blynknya bisa di playstore atau di Appstore. setelah instal aplikasinya teman-teman bisa ikuti cara lebih jelasnya yang ada di video dibawah ini. untuk koding contohnya bisa saya kasih lihat seperti dibawah ini.  



a. Nodemcu ESP8266 / Wemos D1





b. Contoh Program Arduino 

#include <Wire.h>
#define  BLYNK_PRINT Serial  
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include "MAX30105.h"
#include <LiquidCrystal_I2C.h>
#include "heartRate.h"
#include <Adafruit_MLX90614.h>
LiquidCrystal_I2C lcd(0x27, 16,2);

MAX30105 particleSensor;
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
float TargetC;
const byte RATE_SIZE = 4; //Increase this for more averaging. 4 is good.
byte rates[RATE_SIZE]; //Array of heart rates
byte rateSpot = 0;
long lastBeat = 0; //Time at which the last beat occurred

float beatsPerMinute;
int beatAvg;
int counter;

char auth[] = "hgjhgjTJUIYRgfhjjhrerewiuoiuokjhkjgfh";
char ssid[] = "myHotspot";
char pass[] = "1234567";

SimpleTimer timer;

const int speakerPin = 12;
int ledmerah = 14;
int ledhijau = 2;

void sendSensor()
{
 Blynk.virtualWrite(V5, TargetC);
 Blynk.virtualWrite(V6, beatsPerMinute);
 delay(1000);
}

void setup()
{
  
  lcd.clear();
  lcd.begin();
  lcd.noCursor();
  Serial.begin(115200);
  Serial.println("Initializing...");
   pinMode(ledmerah,OUTPUT);
   pinMode(ledhijau,OUTPUT);
   pinMode(speakerPin, OUTPUT);

   digitalWrite(ledmerah,LOW);
   digitalWrite(ledhijau,LOW);
   
Blynk.begin(auth, ssid, pass);
timer.setInterval(1000L, sendSensor);

}

void loop()
{

    // Initialize sensor
  if (!particleSensor.begin(Wire, I2C_SPEED_FAST)) //Use default I2C port, 400kHz speed
  {
    Serial.println("MAX30105 was not found. Please check wiring/power. ");
    while (1);
  }
  Serial.println("Place your index finger on the sensor with steady pressure.");

  particleSensor.setup(); //Configure sensor with default settings
  particleSensor.setPulseAmplitudeRed(0x0A); //Turn Red LED to low to indicate sensor is running
  particleSensor.setPulseAmplitudeGreen(0); //Turn off Green LED

  long irValue = particleSensor.getIR();

  if (checkForBeat(irValue) == true)
  {
    //We sensed a beat!
    long delta = millis() - lastBeat;
    lastBeat = millis();

    beatsPerMinute = 60 / (delta / 1000.0);

    if (beatsPerMinute < 255 && beatsPerMinute > 20)
    {
      rates[rateSpot++] = (byte)beatsPerMinute; //Store this reading in the array
      rateSpot %= RATE_SIZE; //Wrap variable

      //Take average of readings
      beatAvg = 0;
      for (byte x = 0 ; x < RATE_SIZE ; x++)
        beatAvg += rates[x];
      beatAvg /= RATE_SIZE;
    }
  }

  counter++;

if(counter > 100){
 counter = 0;

 mlx.begin();
 TargetC = mlx.readObjectTempC();

 lcd.setCursor(0,1);
 lcd.print("Temp= ");
 lcd.print(TargetC);
 lcd.println(" 'C     ");

 if (TargetC <=  37.5) {
   digitalWrite(speakerPin, LOW);  
   digitalWrite(ledmerah,LOW);  
   digitalWrite(ledhijau,HIGH);
  }
 if (TargetC > 37.5 ) {
   digitalWrite(speakerPin, HIGH);
   digitalWrite(ledmerah,HIGH);
   digitalWrite(ledhijau,LOW);
   delay (3000);
 }
      
 Blynk.run();
 timer.run();
}

  lcd.setCursor(0,0);
  lcd.print("BPM= ");
  lcd.print(beatsPerMinute);
  lcd.println("       ");
      
  Serial.print("IR=");
  Serial.print(irValue);
  Serial.print(", BPM=");
  Serial.print(beatsPerMinute);
  Serial.print(", Avg BPM=");
  Serial.print(beatAvg);

  if (irValue < 50000)
    Serial.print(" No finger?");

  Serial.println();
}





c. VIDEO TUTORIAL