Translate

Membuat Alat HeartRate / HeartBeat (BPM) , Respiration Rate, dan Suhu Tubuh

Membuat Alat HeartRate / HeartBeat (BPM) , Respiration Rate, dan Suhu Tubuh


         Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat alat untuk monitoring HeartBeat / HeartRate, Respiration Rate dan suhu tubuh, alat ini menggunakan sensor finger clip dan amplifier pendukung untuk heartbeat yang mana outputnya berupa sinyal kotak, untuk respiration rate menggunakan sensor suara dan micondenser yang outputnya berupa tegangan, terakhir yaitu suhu tubuh menggunakan sensor LM35 yang sudah umum digunakan. BPM dan RR digunakan sampling 100 ms selama satu menit. untuk lebih jelasnya berikut program dan skemanya.


a. Minimum System





b. Finger clip






c. Sensor Suara





d. Sensor Suhu LM35





e. Program Bascom AVR

$regfile = "m8535.dat"
$crystal = 12000000

Config Lcdpin = Pin , Rs = Portc.7 , E = Portc.6 , Db4 = Portc.5
Config Lcdpin = Pin , Db5 = Portc.4 , Db6 = Portc.3 , Db7 = Portc.2
Config Lcd = 16 * 2

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

Dim Databpm As Word
Dim Dataadc As Word
Dim Datarr As Word

Dim Suhu As Single

Dim A As Integer
Dim B As Integer
Dim C As Integer

Dim W As Integer
Dim Y As Integer
Dim Z As Integer

Ddrd.5 = 0
Set Portd.5

A = 0
B = 0
C = 0

W = 0
Y = 0
Z = 0

Cls
Cursor Off

Start Adc

Do

If Pind.5 = 0 Then
Cls
Waitms 200

Do
Databpm = Getadc(0)

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

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

Waitms 100

Upperline
Lcd "Detak = " ; B

Incr C

Loop Until C = 600
Cls

Wait 1

Do
Datarr = Getadc(2)

If Datarr < 1000 And Z = 0 Then
Incr Y
Z = 1
End If

If Datarr > 1000 And Z = 1 Then
Z = 0
End If

Waitms 100

Upperline
Lcd "RR = " ; Y

Incr W

Loop Until W = 600
Cls

Dataadc = Getadc(1)

Suhu = Dataadc * 5
Suhu = Suhu / 1023
Suhu = Suhu * 100

Print "BPM = " ; B
Print "SUHU = " ; Fusing(suhu , "#.#")
Print "Respiration Rate = " ; Y
Print ""

Upperline
Lcd "BPM = " ; B ; " RR = " ; Y
Lowerline
Lcd "Suhu = " ; Fusing(suhu , "#.#")

Wait 10

A = 0
B = 0
C = 0

W = 0
Y = 0
Z = 0

Cls

Else

Upperline
Lcd "Tekan START"

End If

Loop





f. Cara Penggunaan Alat

           Pertama hubungkan alat dengan power supply, kemudian pasangkan finger clip ke jari telunjuk dan respiration rate ke hidung, lalu sensor suhu tubuh diletakkan di antara ketiak. setelah semua terpasang, tekan tombol start untuk memulai pengukuran, jika telah selesai pengukuran maka akan ada tampilan hasilnya seperti hasil BPM, RR dan suhunya pada LCD.






Membuat JAM DIGITAL dilengkapi SET ALARM dan STOPWATCH menggunakan ARDUINO

Membuat JAM DIGITAL dilengkapi SET ALARM dan STOPWATCH menggunakan ARDUINO


           Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang memiliki fitur jam digital, setting alarm dan stopwatch, sistem kerjanya yaitu alat ini menggunakan Arduino sebagai kendali atau kontroller yang akan mengakses RTC, buzzer dan tombol. terdapat 5 buah tombol yang akan digunakan sebagai selektor menu dan kendali tampilan, buzzer sebagai output alarmnya dan RTC sebagai pemberi data jam dan tanggal. Untuk tampilan display menggunakan LCD 16x2 dengan backlight warna kuning. untuk lebih jelasnya berikut program dan skema alatnya.



a. Arduino UNO





b. LCD Display 16x2






c. RTC DS1307



*KET :
SCL = PIN A5
SDA = PIN A4




d. PUSH BUTTON






e. BUZZER






f. Program Arduino IDE

#include "Wire.h"
#include <LiquidCrystal.h>

LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

#define DS3231_I2C_ADDRESS 0x68
// 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) );
}

const int buttonPin1 = A0;     // the number of the pushbutton pin
const int buttonPin2 = A1;     // the number of the pushbutton pin
const int buttonPin3 = A2;     // the number of the pushbutton pin
const int buttonPin4 = 9;     // the number of the pushbutton pin
const int buttonPin5 = 10;     // the number of the pushbutton pin

int buttonState1 = 0;       
int buttonState2 = 0;
int buttonState3 = 0;
int buttonState4 = 0;
int buttonState5 = 0;

int a = 0;
int mmz = 0;
int detz = 0;
int menz = 0;
int jamz = 0;

int stm = 0;
int stj = 0;
int savestj = 0;
int savestm = 0;

void setup()
{
  lcd.begin(16, 2);
  lcd.clear();
  lcd.noCursor();
  Wire.begin();
  pinMode(8, OUTPUT);
  pinMode(buttonPin1, INPUT);
  pinMode(buttonPin2, INPUT);
  pinMode(buttonPin3, INPUT);
  pinMode(buttonPin4, INPUT);
  pinMode(buttonPin5, INPUT);
 
 
  //Serial.begin(9600);
  // set the initial time here:
  // DS3231 seconds, minutes, hours, day, date, month, year
  // setDS3231time(0,12,02,2,5,1,16);
}
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()
{
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
  // retrieve data from DS3231
  readDS3231time(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month,
  &year);
  // send it to the serial monitor
  lcd.setCursor(0, 0);
  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);
 
  lcd.setCursor(0, 1);
  lcd.print(dayOfMonth, DEC);
  lcd.print("/");
  lcd.print(month, DEC);
  lcd.print("/");
  lcd.print(year, DEC);

  if ((hour == savestj) && (minute == savestm)) {
  digitalWrite(8, HIGH);
  }

}

void loop()
{
  digitalWrite(8, LOW);

  mmz = 0;
  detz = 0;
  menz = 0;
  jamz = 0;
 
  stj = savestj;
  stm = savestm;
    
  buttonState1 = digitalRead(buttonPin1);
  buttonState2 = digitalRead(buttonPin2);
  buttonState3 = digitalRead(buttonPin3);
  buttonState4 = digitalRead(buttonPin4);
  buttonState5 = digitalRead(buttonPin5);

  if ( buttonState2 == LOW ){
  delay(200);
  a = a + 1;
  
  if ( a > 2 ) {
  a = 0;
  } else if (a < 0) {
  a = 2;
  }
 
  }
 
  else if ( buttonState3 == LOW ) {
  delay(200);
  a = a - 1;
  
  if ( a > 2 ) {
  a = 0;
  } else if (a < 0) {
  a = 2;
  }
 
  }

 
  if ( a == 0 ) {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("PILIH MENU");
  lcd.setCursor(0, 1);
  lcd.print(" JAM ");
  delay(500);
       
  }

  else if ( a == 1 ) {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("PILIH MENU");
  lcd.setCursor(0, 1);
  lcd.print(" SET ALARM ");
  delay(500);
  }

  else if ( a == 2 ) {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("PILIH MENU");
  lcd.setCursor(0, 1);
  lcd.print(" STOPWATCH ");
  delay(500);
  }
  
  if (( buttonState5 == LOW ) && ( a == 0 )) {
  lcd.clear();
 
  while ( buttonState1 == HIGH ) 
  {
    delay(200);
    buttonState1 = digitalRead(buttonPin1);
    displayTime();
      
  }
     
  }
 
 
  if (( buttonState5 == LOW ) && ( a == 1 )) {
  lcd.clear();
 
  while ( buttonState1 == HIGH ) 
  {
   
  buttonState1 = digitalRead(buttonPin1);
  buttonState2 = digitalRead(buttonPin2);
  buttonState3 = digitalRead(buttonPin3);
  buttonState4 = digitalRead(buttonPin4);
  buttonState5 = digitalRead(buttonPin5);

  lcd.setCursor(0, 0);
  lcd.print("Set Jam : ");
  lcd.print(stj);
  lcd.setCursor(0, 1);
  lcd.print("Set Menit : ");
  lcd.print(stm); 
  delay(200);
 
  if ( buttonState3 == LOW ){
  stj = 0;
  stm = 0;
  lcd.clear(); 
  }
  else if ( buttonState4 == LOW ){
  stj = stj + 1;
  lcd.clear(); 
  }
  else if ( buttonState5 == LOW ){
  stm = stm + 1;
  lcd.clear(); 
  }
  else if ( buttonState1 == LOW ){
  savestm = stm;
  savestj = stj;
  }

   }     
  }
 
 
  if (( buttonState5 == LOW ) && ( a == 2 )) {
  lcd.clear();
 
  while ( buttonState1 == HIGH ) 
  {
  buttonState1 = digitalRead(buttonPin1);
  buttonState2 = digitalRead(buttonPin2);
  buttonState3 = digitalRead(buttonPin3);
  buttonState4 = digitalRead(buttonPin4);
  buttonState5 = digitalRead(buttonPin5);
     
  mmz = mmz + 1;
  delay(10);
 
  if (mmz == 100) {
  detz = detz + 1;
  mmz = 0;
  }
  if (detz == 60) {
  menz = menz + 1;
  detz = 0;
  } 
  if (menz == 60) {
  jamz = jamz + 1;
  menz = 0;
  } 
   
  lcd.setCursor(0, 0);
  lcd.print(jamz);
  lcd.print(":");
  lcd.print(menz);
  lcd.print(":");
  lcd.print(detz);
  lcd.print(":");
  lcd.print(mmz);
 
  if ( buttonState4 == LOW ){
  delay(200);
  while (buttonState3 == HIGH)
  { 
  lcd.setCursor(0, 0);
  lcd.print(jamz);
  lcd.print(":");
  lcd.print(menz);
  lcd.print(":");
  lcd.print(detz);
  lcd.print(":");
  lcd.print(mmz);
  delay(1000);
  buttonState3 = digitalRead(buttonPin3);
  buttonState1 = digitalRead(buttonPin1);

 
  }
   
  }
      
  }
       
  } 
}

 


  
g. VIDEO HASILNYA