Membuat Pasien Monitor Dengan Arduino - Android dan Sensor Suhu DS18B20, Kelembaban 808H5V6, Pulse Sensor Detak Jantung, GSR
Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat alat untuk pasien monitor, jadi alat ini bisa mengukur detak jantung, suhu tubuh dan kelembaban, kelenjar keringat (GSR). Sensor yang dipakai adalah sensor suhu DS18B20, sensor detak jantung pulse sensor, sensor kelembaban 808H5V6, sensor GSR. untuk interface menggunakan android dan LCD Display 16x2. untuk lebih jelasnya berikut program dan skemanya.
a. Arduino UNO + LCD 16x2
b. Sensor Suhu DS18B20
c. Pulse Sensor Detak Jantung
d. Bluetooth HC-05
e. Sensor Kelembaban 808H5V6
f. Sensor GSR ( Kelenjar Keringat )
g. Program Arduino IDE
//library OneWire DS18B20 bisa didownload disini
#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(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() {
byte i;
byte present = 0;
byte type_s;
byte data[12];
byte addr[8];
float 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;
int datalembab = analogRead(A3);
float voltlembab = datalembab * (5.0 / 1023.0 );
float persen = (32.86 * voltlembab) + 0.025 ;
int datagsr = analogRead(A0);
float voltgsr = datagsr * (5.0 / 1023.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);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Lembab= ");
lcd.print(persen);
lcd.print(" %");
lcd.setCursor(0, 1);
lcd.print("GSR= ");
lcd.print(voltgsr);
lcd.print(" v");
delay(3000);
lcd.clear();
if ( bpm >= 100 ) {
lcd.setCursor(0, 0);
lcd.print("istirahat");
}
else if ( bpm < 60 ) {
lcd.setCursor(0, 0);
lcd.print("ke dokter");
}
if ( celsius >= 37.5 ) {
lcd.setCursor(0, 1);
lcd.print("kompres badan");
}
else if ( celsius < 34.0 ) {
lcd.setCursor(0, 1);
lcd.print("olah raga");
}
delay(3000);
lcd.clear();
if ( voltgsr >= 4 ) {
lcd.setCursor(0, 0);
lcd.print("hibur diri");
}
if ( persen < 38 ) {
lcd.setCursor(0, 1);
lcd.print("minum vitamin");
}
delay(3000);
lcd.clear();
Serial.print("suhu = ");
Serial.print(celsius);
Serial.println(" c");
Serial.print("BPM = ");
Serial.println(bpm);
Serial.print("Lembab = ");
Serial.print(persen);
Serial.println(" %");
Serial.print("GSR = ");
Serial.print(voltgsr);
Serial.println(" v");
Serial.println(" ");
if ( bpm >= 100 ) {
Serial.println("perbanyak istirahat dan ");
}
else if ( bpm < 60 ) {
Serial.println("segera hubungi dokter ");
}
if ( celsius >= 37.5 ) {
Serial.println("kompres dengan air dingin");
}
else if ( celsius < 34.0 ) {
Serial.println("perbanyak aktifitas ");
}
if ( voltgsr >= 4 ) {
Serial.println("Perbanyak menghibur diri");
}
if ( persen < 38 ) {
Serial.println("konsumsi vitamin kulit");
}
if (( bpm > 100 ) && ( celsius > 37.5 ) && ( persen < 38 ) && ( voltgsr > 4 )) {
Serial.println("Terdeteksi STRESS");
Serial.println("hibur diri dan konsul ke psikiater");
}
n = 0;
bpm = 0;
lcd.clear();
}
g. Program Android
#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(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() {
byte i;
byte present = 0;
byte type_s;
byte data[12];
byte addr[8];
float 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;
int datalembab = analogRead(A3);
float voltlembab = datalembab * (5.0 / 1023.0 );
float persen = (32.86 * voltlembab) + 0.025 ;
int datagsr = analogRead(A0);
float voltgsr = datagsr * (5.0 / 1023.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);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Lembab= ");
lcd.print(persen);
lcd.print(" %");
lcd.setCursor(0, 1);
lcd.print("GSR= ");
lcd.print(voltgsr);
lcd.print(" v");
delay(3000);
lcd.clear();
if ( bpm >= 100 ) {
lcd.setCursor(0, 0);
lcd.print("istirahat");
}
else if ( bpm < 60 ) {
lcd.setCursor(0, 0);
lcd.print("ke dokter");
}
if ( celsius >= 37.5 ) {
lcd.setCursor(0, 1);
lcd.print("kompres badan");
}
else if ( celsius < 34.0 ) {
lcd.setCursor(0, 1);
lcd.print("olah raga");
}
delay(3000);
lcd.clear();
if ( voltgsr >= 4 ) {
lcd.setCursor(0, 0);
lcd.print("hibur diri");
}
if ( persen < 38 ) {
lcd.setCursor(0, 1);
lcd.print("minum vitamin");
}
delay(3000);
lcd.clear();
Serial.print("suhu = ");
Serial.print(celsius);
Serial.println(" c");
Serial.print("BPM = ");
Serial.println(bpm);
Serial.print("Lembab = ");
Serial.print(persen);
Serial.println(" %");
Serial.print("GSR = ");
Serial.print(voltgsr);
Serial.println(" v");
Serial.println(" ");
if ( bpm >= 100 ) {
Serial.println("perbanyak istirahat dan ");
}
else if ( bpm < 60 ) {
Serial.println("segera hubungi dokter ");
}
if ( celsius >= 37.5 ) {
Serial.println("kompres dengan air dingin");
}
else if ( celsius < 34.0 ) {
Serial.println("perbanyak aktifitas ");
}
if ( voltgsr >= 4 ) {
Serial.println("Perbanyak menghibur diri");
}
if ( persen < 38 ) {
Serial.println("konsumsi vitamin kulit");
}
if (( bpm > 100 ) && ( celsius > 37.5 ) && ( persen < 38 ) && ( voltgsr > 4 )) {
Serial.println("Terdeteksi STRESS");
Serial.println("hibur diri dan konsul ke psikiater");
}
n = 0;
bpm = 0;
lcd.clear();
}
g. Program Android
h. VIDEO HASILNYA
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :