Translate

Membuat Alat Monitor Heart Beat / Heart Rate / Detak Jantung dan Suhu Tubuh Manusia ( ARDUINO PULSE SENSOR DS18B20 / DS1820 )

Membuat Alat Monitor Heart Beat / Heart Rate / Detak Jantung dan Suhu Tubuh Manusia ( ARDUINO PULSE SENSOR DS18B20 / DS1820 )


             Pada pagi hari ini saya akan menjelaskan mengenai bagaimana cara untuk membuat alat yang biasa digunakan untuk mengecek detak jantung / hear beat dan suhu tubuh manusia. Alat ini sebenarnya bertujuan untuk pasien monitor portabel, jadi si penderita bisa check up dimana saja dan kapan saja dia berada. Alat ini menggunakan 2 buah sensor yaitu sensor suhu DS18B20 dan Pulse sensor. Selain itu juga terdapat interface VB 6 + Database pada komputer guna melihat hasilnya. untuk lebih jelasnya berikut adalah skema dan penjelasannya.




a. Arduino UNO




 b. LCD 16x2




c. Sensor Suhu DS18B20




d. Sensor Pulse / Heart Beat Sensor





e. Program Arduino IDE

#include <Wire.h>
#include <OneWire.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

OneWire  ds(10);  //output ds18b20 ke pin 10 arduino

int n = 0;
int bpm = 0;
int x = 0;
int suhux = 0;
int bpmx = 0;

void setup() {
  lcd.begin(16, 2);
  lcd.clear();
  lcd.noCursor();
  pinMode(13, OUTPUT);
  Serial.begin(9600);

  lcd.setCursor(0, 0);
  lcd.print("WELLCOME");
  delay(20000);
  lcd.clear();

}

void loop() {
   
  n = n + 1;
 
  int dataadc1 = analogRead(A0);          

  lcd.setCursor(0, 0);
  lcd.print("n = ");
  lcd.print(n);
   
  lcd.setCursor(0, 1);
  lcd.print("BPM = ");
  lcd.print(bpm);

  if ((dataadc1 > 512) && (x > 1)) {  
  digitalWrite(13, HIGH);
  x = 0;
  bpm = bpm + 1;
  }

  else if ((dataadc1 < 512) && (x < 1)) {
  x = 2;
  digitalWrite(13, LOW);

  }

  delay(200);

  if ( n > 300 ) {
  lcd.clear();
  datatampil();
  }


}


void datatampil() {

  byte i;
  byte present = 0;
  byte type_s;
  byte data[12];
  byte addr[8];
  int celsius, fahrenheit;

  if ( !ds.search(addr)) {
    ds.reset_search();
    delay(250);
    return;
  }


  ds.reset();
  ds.select(addr);
  ds.write(0x44, 1);        // start conversion, with parasite power on at the end

  delay(1000);     // maybe 750ms is enough, maybe not

  present = ds.reset();
  ds.select(addr);  
  ds.write(0xBE);      

  for ( i = 0; i < 9; i++) {           // we need 9 bytes
    data[i] = ds.read();

  }

  int16_t raw = (data[1] << 8) | data[0];
  if (type_s) {
    raw = raw << 3; // 9 bit resolution default
    if (data[7] == 0x10) {
      // "count remain" gives full 12 bit resolution
      raw = (raw & 0xFFF0) + 12 - data[6];
    }
  } else {
    byte cfg = (data[4] & 0x60);
    // at lower res, the low bits are undefined, so let's zero them
    if (cfg == 0x00) raw = raw & ~7;  // 9 bit resolution, 93.75 ms
    else if (cfg == 0x20) raw = raw & ~3; // 10 bit res, 187.5 ms
    else if (cfg == 0x40) raw = raw & ~1; // 11 bit res, 375 ms
    //// default is 12 bit resolution, 750 ms conversion time
  }
  celsius = (float)raw / 16.0;


  lcd.setCursor(0, 0);
  lcd.print("Temp= ");
  lcd.print(celsius);
  lcd.print(" C");

  lcd.setCursor(0, 1);
  lcd.print("BPM = ");
  lcd.print(bpm);

  delay(3000);
 
  Serial.println(bpm);
  Serial.println(celsius);
 

  n = 0;
  bpm = 0;
  lcd.clear();
 
}





f. Program VB 6 + Database MS Access 2007

Download tutorial pembuatannya di link berikut
DOWLOAD




Option Explicit
Dim arrdata()
Dim TotalBaca As Integer
Dim BMI As Single
Dim Keterangan As String
Const MAKSBACA = 10

Dim Conn1 As ADODB.Connection
Dim Cmd1 As ADODB.Command
Dim Param1 As ADODB.Parameter
Dim Rs1 As ADODB.Recordset



Private Sub Adodc1_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)

End Sub

Private Sub berhenti_Click()
  start.Enabled = True
    berhenti.Enabled = False
    TimerBaca.Enabled = False
End Sub


Private Sub Command1_Click()
Open "C:\Users\yanuar\Desktop\april\bpm\VB Interface SErial ARRAY 3" & "\PRINTOUT.txt" For Output As #1
Print #1, "======================"
Print #1, "   HASIL PENGUJIAN    "
Print #1, "======================"
Print #1, "Nama = "; tbnama.Text
Print #1, "Umur = "; Text4.Text
Print #1, "Gender = "; gender.Text
Print #1, "Detak Jantung = "; Text2(0).Text
Print #1, "Suhu Tubuh = "; Text2(1).Text
Print #1, "Kategori Detak Jantung = "; lbljantung.Caption
Print #1, "Kategori Suhu Tubuh = "; Label4.Caption
Print #1,
Close #1
End Sub

Private Sub Command2_Click()
Unload Me
End Sub



Private Sub Form_Load()
Dim I As Byte
For I = 1 To 16
    ComboCOM.AddItem (I)
Next I
End Sub



Private Sub MSComm2_OnComm()
Dim buffer As String
Dim temp As String
Dim pisah() As String
Dim I As Integer

If MSComm2.CommEvent = comEvReceive Then
    buffer = MSComm2.Input
    pisah = Split(buffer, Chr$(13))
On Error Resume Next
If buffer <> " " Then
With Text1
    .SelStart = Len(.Text)
    .SelText = buffer
End With
For I = 0 To 3
    If 0 < 4 Then
        Text2(I).Text = CStr(pisah(I))
        End If
        Next I
    Else
    buffer = " "
    End If
End If
End Sub

Private Sub Option1_Click()
gender.Text = "PRIA"
End Sub

Private Sub Option2_Click()
gender.Text = "WANITA"
End Sub

Private Sub start_Click()
Dim u As Integer
    Timer1.Enabled = True
    Timer2.Enabled = True
   
    On Error GoTo ada_eror
   
    MSComm2.CommPort = ComboCOM.Text
    MSComm2.Settings = "9600,N,8,1"
    MSComm2.RThreshold = 15
    MSComm2.InputLen = 15
    MSComm2.InputMode = comInputModeText
    MSComm2.PortOpen = True ' buka port
   
    ReDim arrdata(1 To MAKSBACA + 1)
    For u = 1 To MAKSBACA
        arrdata(u) = 0
    Next
    TotalBaca = 0
    start.Enabled = False
    berhenti.Enabled = True
    TimerBaca.Enabled = True
ada_eror:
 If ComboCOM.ListIndex < 1 Then
    MsgBox "COM berada di Nomor : " & Err.Number & vbCrLf & Err.Description, vbCritical + vbOKOnly, "ERROR"
    start.Enabled = True
    berhenti.Enabled = True
    ComboCOM.Text = "Pilih COM"
End If
End Sub

Private Sub Timer1_Timer()
Dim SQl As String
   
   Call dbConnect
   
    SQl = "INSERT INTO tbsimpan VALUES('" & tbnama.Text & "','" & Text4.Text & "','" & gender.Text & "','" & Text2(0).Text & "','" & Text2(1).Text & "','" & lbljantung.Caption & "','" & Label4.Caption & "')"
   
    Dim Rs As Recordset
    Set Rs = New ADODB.Recordset
    Rs.Open SQl, Conn, adOpenDynamic
   

End Sub

Private Sub Timer2_Timer()
Dim konversisuhu As Integer
Dim konversijantung As Integer
Dim konvumur As Integer
konversisuhu = Val(Text2(0).Text)
konversijantung = Val(Text2(1).Text)
konvumur = Val(Text4.Text)

 Adodc1.Refresh

 If konversisuhu >= 36 And konversisuhu <= 37 Then
 Label4.Caption = "SUHU NORMAL"
 End If

 If konversisuhu > 37 Then
 Label4.Caption = "SUHU TINGGI"
 End If

 If konversisuhu < 36 Then
 Label4.Caption = "SUHU RENDAH"
 End If

 If konvumur >= 20 And konvumur <= 29 And konversijantung < 60 And gender.Text = "PRIA" Then
 lbljantung.Caption = "Sangat Baik"
 End If

 If konvumur >= 30 And konvumur <= 39 And konversijantung < 64 And gender.Text = "PRIA" Then
 lbljantung.Caption = "Sangat Baik"
 End If

 If konvumur >= 40 And konvumur <= 49 And konversijantung < 66 And gender.Text = "PRIA" Then
 lbljantung.Caption = "Sangat Baik"
 End If

 If konvumur >= 50 And konversijantung < 68 And gender.Text = "PRIA" Then
 lbljantung.Caption = "Sangat Baik"
 End If

'===========================================================================================

 If konvumur >= 20 And konvumur <= 29 And konversijantung >= 60 And konversijantung <= 69 And gender.Text = "PRIA" Then
 lbljantung.Caption = "Baik"
 End If

 If konvumur >= 30 And konvumur <= 39 And konversijantung >= 65 And konversijantung <= 71 And gender.Text = "PRIA" Then
 lbljantung.Caption = "Baik"
 End If

 If konvumur >= 40 And konvumur <= 49 And konversijantung >= 66 And konversijantung <= 73 And gender.Text = "PRIA" Then
 lbljantung.Caption = "Baik"
 End If

 If konvumur >= 50 And konversijantung >= 68 And konversijantung <= 75 And gender.Text = "PRIA" Then
 lbljantung.Caption = "Baik"
 End If

'==========================================================================================

 If konvumur >= 20 And konvumur <= 29 And konversijantung >= 70 And konversijantung <= 75 And gender.Text = "PRIA" Then
 lbljantung.Caption = "Cukup"
 End If

 If konvumur >= 30 And konvumur <= 39 And konversijantung >= 72 And konversijantung <= 87 And gender.Text = "PRIA" Then
 lbljantung.Caption = "Cukup"
 End If

 If konvumur >= 40 And konvumur <= 49 And konversijantung >= 74 And konversijantung <= 89 And gender.Text = "PRIA" Then
 lbljantung.Caption = "Cukup"
 End If

 If konvumur >= 50 And konversijantung >= 79 And konversijantung <= 91 And gender.Text = "PRIA" Then
 lbljantung.Caption = "Cukup"
 End If
 
'===========================================================================================

 If konvumur >= 20 And konvumur <= 29 And konversijantung > 75 And gender.Text = "PRIA" Then
 lbljantung.Caption = "kurang"
 End If

 If konvumur >= 30 And konvumur <= 39 And konversijantung > 87 And gender.Text = "PRIA" Then
 lbljantung.Caption = "kurang"
 End If

 If konvumur >= 40 And konvumur <= 49 And konversijantung > 89 And gender.Text = "PRIA" Then
 lbljantung.Caption = "kurang"
 End If

 If konvumur >= 50 And konversijantung > 91 And gender.Text = "PRIA" Then
 lbljantung.Caption = "kurang"
 End If
 




 If konvumur >= 20 And konvumur <= 29 And konversijantung < 70 And gender.Text = "WANITA" Then
 lbljantung.Caption = "Sangat Baik"
 End If

 If konvumur >= 30 And konvumur <= 39 And konversijantung < 72 And gender.Text = "WANITA" Then
 lbljantung.Caption = "Sangat Baik"
 End If

 If konvumur >= 40 And konvumur <= 49 And konversijantung < 74 And gender.Text = "WANITA" Then
 lbljantung.Caption = "Sangat Baik"
 End If

 If konvumur >= 50 And konversijantung < 76 And gender.Text = "WANITA" Then
 lbljantung.Caption = "Sangat Baik"
 End If

'===========================================================================================

 If konvumur >= 20 And konvumur <= 29 And konversijantung >= 70 And konversijantung <= 77 And gender.Text = "WANITA" Then
 lbljantung.Caption = "Baik"
 End If

 If konvumur >= 30 And konvumur <= 39 And konversijantung >= 72 And konversijantung <= 79 And gender.Text = "WANITA" Then
 lbljantung.Caption = "Baik"
 End If

 If konvumur >= 40 And konvumur <= 49 And konversijantung >= 74 And konversijantung <= 81 And gender.Text = "WANITA" Then
 lbljantung.Caption = "Baik"
 End If

 If konvumur >= 50 And konversijantung >= 76 And konversijantung <= 83 And gender.Text = "WANITA" Then
 lbljantung.Caption = "Baik"
 End If

'==========================================================================================

 If konvumur >= 20 And konvumur <= 29 And konversijantung >= 78 And konversijantung <= 94 And gender.Text = "WANITA" Then
 lbljantung.Caption = "Cukup"
 End If

 If konvumur >= 30 And konvumur <= 39 And konversijantung >= 80 And konversijantung <= 96 And gender.Text = "WANITA" Then
 lbljantung.Caption = "Cukup"
 End If

 If konvumur >= 40 And konvumur <= 49 And konversijantung >= 82 And konversijantung <= 98 And gender.Text = "WANITA" Then
 lbljantung.Caption = "Cukup"
 End If

 If konvumur >= 50 And konversijantung >= 84 And konversijantung <= 100 And gender.Text = "WANITA" Then
 lbljantung.Caption = "Cukup"
 End If
 
'===========================================================================================

 If konvumur >= 20 And konvumur <= 29 And konversijantung > 94 And gender.Text = "WANITA" Then
 lbljantung.Caption = "kurang"
 End If

 If konvumur >= 30 And konvumur <= 39 And konversijantung > 96 And gender.Text = "WANITA" Then
 lbljantung.Caption = "kurang"
 End If

 If konvumur >= 40 And konvumur <= 49 And konversijantung > 98 And gender.Text = "WANITA" Then
 lbljantung.Caption = "kurang"
 End If

 If konvumur >= 50 And konversijantung > 100 And gender.Text = "WANITA" Then
 lbljantung.Caption = "kurang"
 End If
 


End Sub

Private Sub TimerBaca_Timer()
Dim strInput As String
Dim strPotong As String
Dim singleInput As Single
Dim u As Integer


    strInput = MSComm2.Input
        strPotong = strInput
        'Text1.Text = Text1.Text + strPotong + vbCrLf
        'singleInput = Val(strPotong)
        'Label1.Caption = singleInput
        If TotalBaca >= MAKSBACA Then
            TimerBaca.Enabled = False
            If MSComm2.PortOpen = True Then MSComm2.PortOpen = False
            Call berhenti_Click
        End If
 
End Sub





 
g. Cara Penggunaan Alat

         Pertama yaitu hubungkan Arduino ke PC atau laptop sehingga LCD 16x2 nyala dan sensor detak jantung serta sensor suhu tubuh juga nyala. setelah semua sudah ready maka aktifkan software interface VB 6 dan tekan tombol mulai. jika berhasil maka akan tampil data suhu dan detak jantung pada interface vb 6. pengiriman dari Arduino ke PC berjarak satu menit, kemudian record ke database berjarak 1,5 menit .








1 comment: