Pada malam hari yang cerah dan sangat capek kali ini saya akan menjelaskan mengenai bagaimana cara membuat alat monitoring suhu dan detak jantung dengan interface Android. jadi data yang didapat oleh Arduino akan dikirimkan ke Android menggunakan media bluetooth, untuk sensor suhu dipakai LM35 dan detak jantung menggunakan sensor pulse. untuk lebih jelasnya berikut adalah skema rangkaian dan programnya.
a. Arduino Uno + LCD 2 x 16
b. Sensor Suhu LM35
c. Sensor Detak Jantung ( Pulse Sensor )
e. Program Arduino
#include <Wire.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
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);
}
void loop() {
n = n + 1;
int dataadc1 = analogRead(A1);
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() {
int dataadc = analogRead(A0);
float volt = dataadc * (5.0 / 1023.0 );
float suhu = volt *100;
lcd.setCursor(0, 0);
lcd.print("Suhu = ");
lcd.print(suhu);
lcd.print(" c");
lcd.setCursor(0, 1);
lcd.print("BPM = ");
lcd.print(bpm);
Serial.print("suhu = ");
Serial.print(suhu);
Serial.println(" c");
Serial.print("BPM = ");
Serial.println(bpm);
delay(3000);
n = 0;
bpm = 0;
suhu = 0;
lcd.clear();
}
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
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);
}
void loop() {
n = n + 1;
int dataadc1 = analogRead(A1);
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() {
int dataadc = analogRead(A0);
float volt = dataadc * (5.0 / 1023.0 );
float suhu = volt *100;
lcd.setCursor(0, 0);
lcd.print("Suhu = ");
lcd.print(suhu);
lcd.print(" c");
lcd.setCursor(0, 1);
lcd.print("BPM = ");
lcd.print(bpm);
Serial.print("suhu = ");
Serial.print(suhu);
Serial.println(" c");
Serial.print("BPM = ");
Serial.println(bpm);
delay(3000);
n = 0;
bpm = 0;
suhu = 0;
lcd.clear();
}
f. Program Android ( APP INVENTOR )
g. VIDEO HASILNYA
No comments:
Post a Comment