Translate

Membuat Alat Monitoring Heart Beat / Heart Rate (BPM) Dengan LCD Grafik / Graphic KS0108

Membuat Alat Monitoring Heart Beat / Heart Rate (BPM) Dengan LCD Grafik / Graphic KS0108


              Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat alat menggunakan mikrokontroller yang berfungsi untuk monitor detak jantung pasien / orang, jadi hasil degub jantung akan menghasilkan grafik yang bagus menyerupai alat aslinya,selain itu alat ini menggunakan penyimpanan SD card sehingga data yang telah diperoleh dapat langsung disimpan ke memori eksternal yaitu SD card. Berikut adalah program dan skemanya.

Untuk belajar memasang LCD grafik lihat link ini
Untuk konfigurasi SD card lihat link ini
LINK  



a. Minimum System ATMega32




b. Pulse Sensor Hearbeat / Finger clip




c. LCD Grafik KS0108




d. MMC / SD Card Module




e. Program Bascom AVR

$regfile = "m32def.dat"
$crystal = 11059200

$lib "glcdKS108.LBX "
$lib "ds1307clock.lib"
$include "Config_AVR-DOS32.BAS"
$include "Config_MMC32.bas"


Config Graphlcd = 128 * 64sed , Dataport = Portd , Controlport = Portc , Ce = 7 , Ce2 = 6 , Cd = 3 , Rd = 2 , Enable = 4 , Reset = 5       ' , Mode = 8

Config Adc = Single , Prescaler = Auto , Reference = Avcc


'VARIABEL MMC//////////////////////////////
Dim Ax As Byte
Dim L As String * 10
Dim Ff As Byte
Dim Sx As Long
Dim Diskf As Long
Dim Disks As Long
Dim Nama As String * 20


Ff = Drivereset()
Ff = Driveinit()

$external Waitms



Dim Databpm As Word
Dim A As Integer
A = 0
Dim Jk As Integer
Jk = 0
Dim C As Integer
C = 0
Dim Dk As Eram Integer

Dim Dkk As Integer
Dkk = 0

Dim S(130) As Integer
Dim K As Integer

Dim F As Integer
F = 1

Config Sda = Portb.0
Config Scl = Portb.1
Const Ds1307w = &HD0
Const Ds1307r = &HD1
Config Clock = User
Dim Weekday As Byte
Dim Char As String * 10 , Tanda As String * 1
Dim Jam As String * 10 , Menit As String * 10 , Detik As String * 10
Dim Hari As String * 10 , Bulan As String * 10 , Tahun As String * 10
Dim X As Byte , Y As Byte , Z As Byte
Dim Waktu As String * 10
Dim Tanggal As String * 10

'Date$ = "03-04-16"
'Time$ = "15-07-00"

Cls


'PORTC pins
'Ce--------CSB - portc.7
'Ce2-------CSA - portc.6
'Cd--------D/I - portc.3
'Rd--------R/W - portc.2
'Enable----Enable - portc.4
'Reset ----RST - portc.5
'Portd ---- DB0-DB7 all pins to dataport
'portd.0 - DB0
'portd.1 - DB1
'Ect...
'and connect power


Start Adc

Main:

For F = 0 To 128
S(f) = 7
Next F
F = 0

Do
Dkk = Dk

Do

Databpm = Getadc(0)

If Databpm > 300 And A = 0 Then
Incr Jk
A = 1
End If

If Databpm < 300 And A = 1 Then
A = 0
End If


Dkk = Dk

Setfont Font8x8
Lcdat 1 , 10 , "MONITOR"
Lcdat 1 , 70 , "JANTUNG"
Lcdat 2 , 105 , Dkk
Lcdat 2 , 10 , Jk
Lcdat 2 , 35 , Time$


Lcdat 3 , 1 , "|"
Lcdat 4 , 1 , "|"
Lcdat 5 , 1 , "|"
Lcdat 6 , 1 , "|"
Lcdat 7 , 1 , "|"
Lcdat 8 , 1 , "|_______"

S(f) = Databpm / 200
S(f) = 7 - S(f)

If F > 128 Then

For F = 0 To 128
S(f) = 7
Next F

F = 0

Cls
End If

'Setfont Font8x8
Lcdat S(1) , 1 , "."
Lcdat S(2) , 2 , "."
Lcdat S(3) , 3 , "."
Lcdat S(4) , 4 , "."
Lcdat S(5) , 5 , "."
Lcdat S(6) , 6 , "."
Lcdat S(7) , 7 , "."
Lcdat S(8) , 8 , "."
Lcdat S(9) , 9 , "."
Lcdat S(10) , 10 , "."

Lcdat S(11) , 11 , "."
Lcdat S(12) , 12 , "."
Lcdat S(13) , 13 , "."
Lcdat S(14) , 14 , "."
Lcdat S(15) , 15 , "."
Lcdat S(16) , 16 , "."
Lcdat S(17) , 17 , "."
Lcdat S(18) , 18 , "."
Lcdat S(19) , 19 , "."
Lcdat S(20) , 20 , "."

Lcdat S(21) , 21 , "."
Lcdat S(22) , 22 , "."
Lcdat S(23) , 23 , "."
Lcdat S(24) , 24 , "."
Lcdat S(25) , 25 , "."
Lcdat S(26) , 26 , "."
Lcdat S(27) , 27 , "."
Lcdat S(28) , 28 , "."
Lcdat S(29) , 29 , "."
Lcdat S(30) , 30 , "."

Lcdat S(31) , 31 , "."
Lcdat S(32) , 32 , "."
Lcdat S(33) , 33 , "."
Lcdat S(34) , 34 , "."
Lcdat S(35) , 35 , "."
Lcdat S(36) , 36 , "."
Lcdat S(37) , 37 , "."
Lcdat S(38) , 38 , "."
Lcdat S(39) , 39 , "."
Lcdat S(40) , 40 , "."

Lcdat S(41) , 41 , "."
Lcdat S(42) , 42 , "."
Lcdat S(43) , 43 , "."
Lcdat S(44) , 44 , "."
Lcdat S(45) , 45 , "."
Lcdat S(46) , 46 , "."
Lcdat S(47) , 47 , "."
Lcdat S(48) , 48 , "."
Lcdat S(49) , 49 , "."
Lcdat S(50) , 50 , "."

Lcdat S(51) , 51 , "."
Lcdat S(52) , 52 , "."
Lcdat S(53) , 53 , "."
Lcdat S(54) , 54 , "."
Lcdat S(55) , 55 , "."
Lcdat S(56) , 56 , "."
Lcdat S(57) , 57 , "."
Lcdat S(58) , 58 , "."
Lcdat S(59) , 59 , "."
Lcdat S(60) , 60 , "."

Lcdat S(61) , 61 , "."
Lcdat S(62) , 62 , "."
Lcdat S(63) , 63 , "."
Lcdat S(64) , 64 , "."
Lcdat S(65) , 65 , "."
Lcdat S(66) , 66 , "."
Lcdat S(67) , 67 , "."
Lcdat S(68) , 68 , "."
Lcdat S(69) , 69 , "."
Lcdat S(70) , 70 , "."

Lcdat S(71) , 71 , "."
Lcdat S(72) , 72 , "."
Lcdat S(73) , 73 , "."
Lcdat S(74) , 74 , "."
Lcdat S(75) , 75 , "."
Lcdat S(76) , 76 , "."
Lcdat S(77) , 77 , "."
Lcdat S(78) , 78 , "."
Lcdat S(79) , 79 , "."
Lcdat S(80) , 80 , "."

Lcdat S(81) , 81 , "."
Lcdat S(82) , 82 , "."
Lcdat S(83) , 83 , "."
Lcdat S(84) , 84 , "."
Lcdat S(85) , 85 , "."
Lcdat S(86) , 86 , "."
Lcdat S(87) , 87 , "."
Lcdat S(88) , 88 , "."
Lcdat S(89) , 89 , "."
Lcdat S(90) , 90 , "."

Lcdat S(91) , 91 , "."
Lcdat S(92) , 92 , "."
Lcdat S(93) , 93 , "."
Lcdat S(94) , 94 , "."
Lcdat S(95) , 95 , "."
Lcdat S(96) , 96 , "."
Lcdat S(97) , 97 , "."
Lcdat S(98) , 98 , "."
Lcdat S(99) , 99 , "."
Lcdat S(100) , 100 , "."

Lcdat S(101) , 101 , "."
Lcdat S(102) , 102 , "."
Lcdat S(103) , 103 , "."
Lcdat S(104) , 104 , "."
Lcdat S(105) , 105 , "."
Lcdat S(106) , 106 , "."
Lcdat S(107) , 107 , "."
Lcdat S(108) , 108 , "."
Lcdat S(109) , 109 , "."
Lcdat S(110) , 110 , "."

Lcdat S(111) , 111 , "."
Lcdat S(112) , 112 , "."
Lcdat S(113) , 113 , "."
Lcdat S(114) , 114 , "."
Lcdat S(115) , 115 , "."
Lcdat S(116) , 116 , "."
Lcdat S(117) , 117 , "."
Lcdat S(118) , 118 , "."
Lcdat S(119) , 119 , "."
Lcdat S(120) , 120 , "."

Lcdat S(121) , 121 , "."
Lcdat S(122) , 122 , "."
Lcdat S(123) , 123 , "."
Lcdat S(124) , 124 , "."
Lcdat S(125) , 125 , "."
Lcdat S(126) , 126 , "."
Lcdat S(127) , 127 , "."
Lcdat S(128) , 128 , "."




Waitms 100

Cls

Incr C
Incr F

Loop Until C = 600

Dk = Jk
Jk = Dk
Dkk = Dk

C = 0
Jk = 0
A = 0
F = 0

Goto Simpan

Loop



Getdatetime:
  I2cstart
  I2cwbyte Ds1307w
  I2cwbyte 0
  I2cstart
  I2cwbyte Ds1307r
  I2crbyte _sec , Ack
  I2crbyte _min , Ack
  I2crbyte _hour , Ack
  I2crbyte Weekday , Ack
  I2crbyte _day , Ack
  I2crbyte _month , Ack
  I2crbyte _year , Nack
  I2cstop
  _sec = Makedec(_sec) : _min = Makedec(_min) : _hour = Makedec(_hour)
  _day = Makedec(_day) : _month = Makedec(_month) : _year = Makedec(_year)
Return

Setdate:
  _day = Makebcd(_day) : _month = Makebcd(_month) : _year = Makebcd(_year)
  I2cstart
  I2cwbyte Ds1307w
  I2cwbyte 4
  I2cwbyte _day
  I2cwbyte _month
  I2cwbyte _year
  I2cstop
Return

Settime:
  _sec = Makebcd(_sec) : _min = Makebcd(_min) : _hour = Makebcd(_hour)
  I2cstart
  I2cwbyte Ds1307w
  I2cwbyte 0
  I2cwbyte _sec
  I2cwbyte _min
  I2cwbyte _hour
  I2cstop
Return


$include "font8x8.font"


Simpan:
Cls
Waitms 200

Lcdat 1 , 1 , " PLEASE WAIT !!"
Wait 1

Cls
Do
If Gbdriveerror <> 0 Then                                   'CEK MEMORY CARD ERROR
   Cls

   Lcdat 1 , 1 , "Error Config"
   Lcdat 2 , 1 , "CEK MEMORY"
   Wait 2

End If

Ax = Initfilesystem(1)                                      'init file system
If Ax <> 0 Then
   Cls

   Lcdat 1 , 1 , "Error MEMORY"
   Lcdat 2 , 1 , "CEK MEMORY CARD"
   Wait 2
   Cls
   Goto Main

End If

If Ax = 0 Then
   Cls
   Lcdat 1 , 1 , "MEMORY OK"
   Wait 1
End If


Diskf = Diskfree()
Select Case Diskf                                           'CEK FREESPACE
Sx = Diskf
Sx = Str(sx)

Case Is > 3000 :
                  Lcdat 3 , 1 , " Free > 3MB"
                  Lcdat 4 , 1 , Sx


Case Is > 1000 :
                  Lcdat 3 , 1 , " Free > 1MB"
                  Lcdat 4 , 1 , Sx


Case Else :
             Lcdat 3 , 1 , "!! FREE < 1MB !!"
             Wait 1
             Lcdat 4 , 1 , "GANTI memoryCARD"

End Select

Wait 3

Ff = Freefile()

L = "LOGGER"
Nama = L + ".txt"
Open Nama For Append As #ff                                 'buat file baru (bisa append bisa output)

Print #ff , "             RESULT              "
Print #ff , "#################################"
Print #ff , "         Data Logger BPM         "
Print #ff , "#################################"
Print #ff , "Tanggal = " ; Date$
Print #ff , "Jam     = " ; Time$
Print #ff , "BPM     = " ; Dkk
Print #ff ,
Print #ff ,

Close #ff                                                   'tutup file

Cls

   Lcdat 1 , 1 , "FILE CREATED"
   Wait 2
   Goto Main
   Cls
   Loop
Return



f. Cara Penggunaan Alat

          Cara menggunakan alat ini sangat mudah yaitu hubungkan alat dengan power supply 12v kemudian pastikan semua sensor dan modul sudah terhubung dengan benar, masukkan jari ke finger clip, lalu lihat hasilnya di ld grafik, akan tertera BPM dan hasil grafiknya, setelah satu menit data akan di simpan otomatis ke dalam SD card.











No comments:

Post a Comment