Translate

Monitor Suhu Sensor DS18b20 Interface 7segment

Monitor Suhu Sensor DS18b20 Interface 7segment


         Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang dapat mengukur suhu suatu benda atau ruangan sekitar dengan menggunakan sensor ds18b20 water proof. alat ini dilengkapi dengan interface 7segment sehingga memudahkan user melihat nilai yang dideteksi oleh sensor. untuk lebih jelasnya berikut adalah program dan komponennya.



a. Arduino Uno




b. Sensor Suhu DS18B20




c. Interface 7Segment






d. Program Arduino IDE

#include <Wire.h>
#include <OneWire.h>
OneWire  ds(10);  //output ds18b20 ke pin 10 arduino

byte i;
byte present = 0;
byte type_s;
byte data[12];
byte addr[8];
int celsius, fahrenheit;
 
byte zero  = B00000011;
byte one   = B10011111;
byte two   = B00100101;
byte three = B00001101;
byte four  = B10011001;
byte five  = B01001001;
byte six   = B01000001;
byte seven = B00011111;
byte eight = B00000001;
byte nine  = B00001001;

int latchPin = 4;  //Pin connected to STR(pin 1) of HEF4094
int clockPin = 3; //Pin connected to CLK(pin 3) of HEF4094
int dataPin = 2;  //Pin connected to D(pin 2) of HEF4094
int oe = 5;  //Pin connected to OE(pin 2) of HEF4094

int temp;
int x = 5;
int y;
int sensorValue;

void setup(){
 Serial.begin(9600);
 pinMode(latchPin, OUTPUT);
 pinMode(clockPin, OUTPUT);
 pinMode(dataPin, OUTPUT);
 pinMode(oe, OUTPUT);
 digitalWrite(oe,HIGH);
}

void loop(){
           
 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;
 
  temp = celsius;
  int ribuan = temp / 1000;
  temp = temp % 1000;
  int ratusan = temp / 100;
  temp = temp % 100;
  int puluhan = temp / 10;
  int satuan = temp % 10;

 switch(ratusan){
   case 0:
   ratusan = zero;
   break;
   case 1:
   ratusan = one;
   break;
   case 2:
   ratusan = two;
   break;
   case 3:
   ratusan = three;
   break;
   case 4:
   ratusan = four;
   break;
   case 5:
   ratusan = five;
   break;
   case 6:
   ratusan = six;
   break;
   case 7:
   ratusan = seven;
   break;
   case 8:
   ratusan = eight;
   break;
   case 9:
   ratusan = nine;
   break;  
 }
  
 switch(puluhan){
   case 0:
   puluhan = zero;
   break;
   case 1:
   puluhan = one;
   break;
   case 2:
   puluhan = two;
   break;
   case 3:
   puluhan = three;
   break;
   case 4:
   puluhan = four;
   break;
   case 5:
   puluhan = five;
   break;
   case 6:
   puluhan = six;
   break;
   case 7:
   puluhan = seven;
   break;
   case 8:
   puluhan = eight;
   break;
   case 9:
   puluhan = nine;
   break;  
 }

 switch(satuan){
   case 0:
   satuan = zero;
   break;
   case 1:
   satuan = one;
   break;
   case 2:
   satuan = two;
   break;
   case 3:
   satuan = three;
   break;
   case 4:
   satuan = four;
   break;
   case 5:
   satuan = five;
   break;
   case 6:
   satuan = six;
   break;
   case 7:
   satuan = seven;
   break;
   case 8:
   satuan = eight;
   break;
   case 9:
   satuan = nine;
   break; 
 }

  digitalWrite(latchPin, HIGH); //Pull latch HIGH to send data
  shiftOut(dataPin, clockPin, LSBFIRST, satuan);
  shiftOut(dataPin, clockPin, LSBFIRST, puluhan);
  shiftOut(dataPin, clockPin, LSBFIRST, ratusan);
  digitalWrite(latchPin, LOW); //Pull latch HIGH to send data
  delay(1000);
  
 }




e. VIDEO HASILNYA





NRF24L01 Multiple Data Wireless Transmitter Receiver Suhu BPM SPO2 Sensor MAX30100 dan LM35

 NRF24L01 Multiple Data Wireless Transmitter Receiver Suhu BPM SPO2 Sensor MAX30100 dan LM35
 

             Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang dapat mengirimkan data secara wireless dengan menggunakan modul NRF24L01, data yang dikirim adalah data suhu, bpm, spo2 dari sensor LM35 dan max30100. jadi ada alat yang diposisikan sebagai transmitter dan ada alat yang sebagai receiver. untuk lebih jelasnya berikut adalah skema dan programnya.
 
 
 
a. Pin NRF24L01
 

 
 
b. Skema Transmitter
 

 
 
c. Skema Receiver
 

 
 
d. Program Arduino IDE Transmitter
 
#include <Wire.h>
#include <MAX30100_PulseOximeter.h>
#include <LiquidCrystal_I2C.h>
#include  <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"

LiquidCrystal_I2C lcd(0x27,16,2); //library lcd

MAX30100* pulseOxymeter;   //library

float sensorValue;
float tegangan;
int bpmku;
int counter;
float spo;
float bpm;
byte i;
byte present = 0;
byte type_s;
byte data[12];
byte addr[8];
float celsius, fahrenheit;
int cacah;
float b,s,t;
 
PulseOximeter pox;

uint32_t tsLastReport = 0;
String hrData = "";

void onBeatDetected()
{
//    Serial.println("Beat!");
}

RF24 radio(9, 10); // CE, CSN

const uint64_t pipe = 0xE8E8F0F0E1LL;

void setup(void) {
lcd.begin();
lcd.clear();
lcd.noCursor();

Serial.begin(9600);
radio.begin();
radio.openWritingPipe(pipe);

pulseOxymeter = new MAX30100();
 
if (!pox.begin()) {
 //Serial.println("FAILED");
  for(;;);
 } else {
 //Serial.println("SUCCESS");
}
 
  pox.setIRLedCurrent(MAX30100_LED_CURR_11MA);
  pox.setOnBeatDetectedCallback(onBeatDetected);

}

void loop(void){

sensorValue = analogRead(A0);
tegangan = sensorValue * (5.0 / 1023.0);
celsius = tegangan * 100.0 ;
t = celsius;
 
pox.update();    
b = pox.getHeartRate();
s = pox.getSpO2();

radio.write(&t, sizeof(t));
radio.write(&b, sizeof(b));
radio.write(&s, sizeof(s));
 
}




e. Program Arduino IDE Receiver

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2); //library lcd

int msg[1];
float b,s,t;

RF24 radio(9,10);

const uint64_t pipe = 0xE8E8F0F0E1LL;

void setup(void){
 
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(1,pipe);
radio.startListening();

lcd.begin();
lcd.clear();
lcd.noCursor();

}

 void loop(void){

  if (radio.available()) {  

    radio.read(&t, sizeof(t));
    lcd.setCursor(0,0);
    lcd.print("T:");
    lcd.print(t,1);
    lcd.print("  ");
     
    radio.read(&b, sizeof(b));
    lcd.setCursor(0,1);
    lcd.print("B/S:");
    lcd.print(b,1);
        
    radio.read(&s, sizeof(s));
    lcd.print("/");
    lcd.print(s,1);
    lcd.print("  ");
 
    //Serial.println(t);
    //Serial.println(b);
    //Serial.println(s);
    
  }

}

 

 
f. VIDEO HASILNYA



 
 
 

Monitor Suhu Tubuh, BPM, TENSIMETER ONLINE BLYNK + Fitur Suara DF PLAYER Mini

 Monitor Suhu Tubuh, BPM, TENSIMETER ONLINE BLYNK + Fitur Suara DF PLAYER Mini
 

          Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang dapat digunakan untuk monitor suhu tubuh, bpm dan tensi secara online dengan menggunakan Blynk, selain itu terdapat fitur suara yang dihasilkan oleh modul DF Player Mini. untuk lebih jelasnya berikut adalah koding dan daftar komponennya.
 
 
 
a. Arduino Uno
 

 
 
b. LCD 16x2
 

 
 
c. MPX5050GP
 

 
 
d. Modul DF Player Mini
 

 
 
e. Max30100
 

 
 
f. MLX90614
 

 
 
g. Nodemcu ESP8266
 

 

h. Setting File MP3 Format FAT32





 
 
i. Program Arduino IDE
 
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Adafruit_MLX90614.h>  
#include <MAX30100_PulseOximeter.h>
#include <SoftwareSerial.h>
#include <DFPlayer_Mini_Mp3.h>
#define REPORTING_PERIOD_MS 5000
#include "MAX30100.h" //library sensor

SoftwareSerial mySerial(10, 11); // RX, TX

LiquidCrystal_I2C lcd(0x27,16,2); //library lcd

MAX30100* pulseOxymeter;   //library

int cacah; //membuat variabel
int spo;
float bpm;
Adafruit_MLX90614 mlx = Adafruit_MLX90614();

int btreset = 12;
float TargetC;
int motor = 8;
int solenoid = 9;
int dataadc;
int tombolx;
int hitung;
float vol;
float mmhg;
float mmhgx;
int sistole;
int diastole;
int sistolex;
int diastolex;
int mark = 0;
int bttensi = 3;
int suhunya;
int bpmku;

PulseOximeter pox;

uint32_t tsLastReport = 0;
String hrData = "";
void onBeatDetected()
{
//    Serial.println("Beat!");
}

void setup() {

  Serial.begin (9600);
  mySerial.begin (9600);
  mp3_set_serial (mySerial);  //set softwareSerial for DFPlayer-mini mp3 module
  delay(1);  //wait 1ms for mp3 module to set volume
  mp3_set_volume (30);  //volume 0-30
 
  Wire.begin();
  mlx.begin();
//  Serial.begin(9600);
  lcd.begin();
  lcd.clear();
  pinMode(4,OUTPUT);
  pinMode(5,OUTPUT);
  pinMode(6,OUTPUT);
  pinMode(7,OUTPUT);
  digitalWrite(4,HIGH);
  digitalWrite(5,HIGH);
  digitalWrite(6,HIGH);
  digitalWrite(7,HIGH);
  pinMode(motor,OUTPUT);
  pinMode(solenoid,OUTPUT);
  pinMode(bttensi,INPUT_PULLUP);

  digitalWrite(motor,LOW);
  digitalWrite(solenoid,LOW);

   //Serial.print("Initializing pulse oximeter..");
 
    if (!pox.begin()) {
        //Serial.println("FAILED");
        for(;;);
    } else {
        //Serial.println("SUCCESS");
    }
 
   pox.setIRLedCurrent(MAX30100_LED_CURR_11MA);
   pox.setOnBeatDetectedCallback(onBeatDetected);
 
}
   
void loop(){
pox.update();
           
       bpm = pox.getHeartRate();
       spo = pox.getSpO2();
       //bpmku = bpm;

       if(bpm > 0){
         bpmku = bpm;  
       }

       lcd.setCursor(0,1);
       lcd.print("Bpm: ");
       lcd.print(bpmku);
       lcd.print("     ");

mlx.begin();
TargetC = mlx.readObjectTempC();
suhunya = TargetC;

int bttensix = digitalRead(bttensi);

if(bttensix == 0){
 lcd.clear();
 delay(3000);
 mulai();
}

lcd.setCursor(0,0);
lcd.print("S=");
lcd.print(suhunya);
lcd.print("/");
lcd.print(sistole);
lcd.print("/");
lcd.print(diastole);
lcd.print("   ");
lcd.setCursor(0,1);
lcd.print("Bpm: ");
lcd.print(bpmku);
lcd.print("     ");

if((suhunya > 0)&&(suhunya < 38)&&(bpmku > 60)&&(bpmku < 100)&&(sistole > 0)&&(diastole > 0)){
delay(3000);
kirimblynk();
lcd.clear();
delay(1000);
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
lcd.setCursor(0,0);
lcd.print("play music 1");
mp3_play (1);   //play music file 0001.mp3
delay(20000);
mp3_stop ();
lcd.clear();
delay(1000);
bpmku = 0;
pinMode(btreset,OUTPUT);
digitalWrite(btreset,LOW);
}

if((suhunya >= 38)&&(bpmku > 60)&&(bpmku < 100)&&(sistole > 0)&&(diastole > 0)){
delay(3000);
kirimblynk();
lcd.clear();
delay(1000);
digitalWrite(4,HIGH);
digitalWrite(5,LOW);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
lcd.setCursor(0,0);
lcd.print("play music 2");
mp3_play (2);  //play music file 0002.mp3
delay(20000);
mp3_stop ();
lcd.clear();
delay(1000);
bpmku = 0;
pinMode(btreset,OUTPUT);
digitalWrite(btreset,LOW);
}

delay(1);

cacah++;

if(cacah >= 10){
cacah = 0;
 
//internet blynk
Serial.print("*");
Serial.print(suhunya);
Serial.print(",");
Serial.print(bpmku);
Serial.print(",");
Serial.print(sistole);
Serial.print(",");
Serial.print(diastole);
Serial.println("#");

/*
//bluetooth
Serial.print("Suhu= ");
Serial.println(suhunya);
Serial.print("Bpm= ");
Serial.println(bpm);
Serial.print("Sistole= ");
Serial.println(sistole);
Serial.print("Diastole= ");
Serial.println(diastole);
*/

}

}

void mulai(){ 
 dataadc = analogRead(A0);
 mmhg = (dataadc - 46.222) / 3.2;

if((mmhg >= mmhgx + 10)&&(mmhg > 100)&&(mark == 0)){
//digitalWrite(motor,LOW); 
Serial.println("SISTOLE"); 
sistole = mmhg;
mark = 2; 
digitalWrite(motor,LOW);
}

if((mmhg >= mmhgx + 5)&&(mmhg > 50)&&(mmhg < 90)&&(mark == 2)){
//digitalWrite(motor,LOW); 
Serial.println("DIASTOLE"); 
diastole = mmhg;
mark = 3;
}

 lcd.setCursor(0,1);
 lcd.print("S= ");
 lcd.print(mmhg);
 lcd.print("     ");

if(mmhg >= 150)
{
 digitalWrite(motor,LOW);   
}

mmhgx = mmhg;

Serial.println(mmhg);

if((mark == 3)&&(mmhg < 50)){
lcd.clear();
delay(1000);
mark = 0;
sistolex = sistole;
diastolex = diastole;
digitalWrite(solenoid,LOW);
return;  
}

delay(1);   
mulai();  
}

void kirimblynk(){
 
//internet blynk
Serial.print("*");
Serial.print(suhunya);
Serial.print(",");
Serial.print(bpmku);
Serial.print(",");
Serial.print(sistole);
Serial.print(",");
Serial.print(diastole);
Serial.println("#");
 
}
 
 
 
j. Program Nodemcu ESP8266
 
#define BLYNK_PRINT Serial   
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>

int temp;
int x = 5;
int y;

int value1;
int value2;
int value3;
int value4;

int suhuku;
int bpmku;
int sistole;
int diastole;

float datain1;
float datain2;
float datain3;
float datain4;

String dataIn;
String dt[10];
int i;
boolean parsing=false;

char auth[] = "hgjhg768ghbjhhgd424gfhghgh98iuhgjhhvq";
char ssid[] = "Hotspot Wifiku";
char pass[] = "123456789";

SimpleTimer timer;

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means

// that you define how often to send data to Blynk App.
void sendSensor()
{

 Blynk.virtualWrite(V4, suhuku);
 Blynk.virtualWrite(V5, bpmku);
 Blynk.virtualWrite(V6, sistole);
 Blynk.virtualWrite(V7, diastole);
 delay(1000);

}

void setup()
{
 
  dataIn="";
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  timer.setInterval(1000L, sendSensor);
}

void loop()
{

while(Serial.available()>0) {
//  dataIn="";
    char inChar = (char)Serial.read();
    dataIn += inChar;
    if (inChar == '\n') {
    parsing = true;
  }
}

if(parsing){
  parsingData();
   
  Blynk.run();
  timer.run();
}

}

void parsingData(){
int j=0;

//kirim data yang telah diterima sebelumnya
//Serial.print("data masuk : ");
//Serial.print(dataIn);
//Serial.print("\n");

//inisialisasi variabel, (reset isi variabel)
dt[j]="";
//proses parsing data
for(i=1;i<dataIn.length();i++){
//pengecekan tiap karakter dengan karakter (#) dan (,)
if ((dataIn[i] == '#') || (dataIn[i] == ','))
{
//increment variabel j, digunakan untuk merubah index array penampung
j++;
dt[j]="";       //inisialisasi variabel array dt[j]
}
else
{
//proses tampung data saat pengecekan karakter selesai.
dt[j] = dt[j] + dataIn[i];
}
}

datain1 = dt[0].toInt();
datain2 = dt[1].toInt();
datain3 = dt[2].toInt();
datain4 = dt[3].toInt();

//kirim data hasil parsing
Serial.print("data 1 : ");
Serial.print(datain1);
Serial.print("\n");
Serial.print("data 2 : ");
Serial.print(datain2);
Serial.print("\n");
Serial.print("data 3 : ");
Serial.print(datain3);
Serial.print("\n");
Serial.print("data 4 : ");
Serial.print(datain4);
Serial.print("\n");

suhuku = datain1 / 1;
bpmku = datain2 / 1;
sistole = datain3 / 1;
diastole = datain4 / 1;

}

 
 
 
k. VIDEO HASILNYA
 

 
 
 
 
 

Monitor Suhu Tubuh + BPM + TENSIMETER via Bluetooth Android Sensor MAX30100 dan MLX90614


 Monitor Suhu Tubuh + BPM + TENSIMETER via Bluetooth Android Sensor MAX30100 dan MLX90614
 

             Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang dapat memonitor suhu tubuh, bpm dan tensi via bluetooth android. alat ini memang sangat cocok untuk digunakan sebagai alat pengecekan karena mudah dibawa dan juga terdapat fitur bluetooth sehingga bisa dimonitor melalui HP Android. untuk lebih jelasnya berikut adalah daftar komponen dan programnya. 

 
 
a. Arduino Uno




b. MAX30100




c. MLX90614




d. Driver Pompa dan Solenoid




e. Bluetooth HC-05




f. LCD I2C




g. MPX5050GP


h. Koding Android

 


 

I. Program Arduino IDE

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Adafruit_MLX90614.h>  
#include <MAX30100_PulseOximeter.h>
#define REPORTING_PERIOD_MS 5000
#include "MAX30100.h" //library sensor

LiquidCrystal_I2C lcd(0x27,16,2); //library lcd

MAX30100* pulseOxymeter;   //library

int cacah; //membuat variabel
int spo;
float bpm;
Adafruit_MLX90614 mlx = Adafruit_MLX90614();

float TargetC;
int motor = 8;
int solenoid = 9;
int dataadc;
//int tombol = D4;
int tombolx;
int hitung;
float vol;
float mmhg;
float mmhgx;
int sistole;
int diastole;
int sistolex;
int diastolex;
int mark = 0;
int bttensi = 10;
int suhunya;
int bpmku;

PulseOximeter pox;

uint32_t tsLastReport = 0;
String hrData = "";
void onBeatDetected()
{
//    Serial.println("Beat!");
}

void setup() {
  Wire.begin();
  mlx.begin();
  Serial.begin(9600);
  lcd.begin();
  lcd.clear();
  pinMode(4,OUTPUT);
  pinMode(5,OUTPUT);
  pinMode(6,OUTPUT);
  pinMode(7,OUTPUT);
  digitalWrite(4,HIGH);
  digitalWrite(5,HIGH);
  digitalWrite(6,HIGH);
  digitalWrite(7,HIGH);
  pinMode(motor,OUTPUT);
  pinMode(solenoid,OUTPUT);
  pinMode(bttensi,INPUT_PULLUP);

  digitalWrite(motor,LOW);
  digitalWrite(solenoid,LOW);

   //Serial.print("Initializing pulse oximeter..");
 
    if (!pox.begin()) {
        //Serial.println("FAILED");
        for(;;);
    } else {
        //Serial.println("SUCCESS");
    }
 
   pox.setIRLedCurrent(MAX30100_LED_CURR_11MA);
   pox.setOnBeatDetectedCallback(onBeatDetected);
 
}
   
void loop(){
 
   pox.update();
    
   if (millis() - tsLastReport > REPORTING_PERIOD_MS) {

       bpm = pox.getHeartRate();
       spo = pox.getSpO2();
       bpmku = bpm;
       
       lcd.setCursor(0,1);
       lcd.print("Bpm: ");
       lcd.print(pox.getHeartRate());
       lcd.print("     ");
       
    tsLastReport = millis();
}

mlx.begin();
TargetC = mlx.readObjectTempC();
suhunya = TargetC;

lcd.setCursor(0,0);
lcd.print("S=");
lcd.print(suhunya);
lcd.print("/");
lcd.print(sistole);
lcd.print("/");
lcd.print(diastole);
lcd.print("   ");

int bttensix = digitalRead(bttensi);

if(bttensix == 0){
 lcd.clear();
 delay(3000);
 mulai();
}

delay(1);

cacah++;

if(cacah >= 10){
cacah = 0;
 
/*
Serial.print("*");
Serial.print(suhunya);
Serial.print(",");
Serial.print(bpmku);
Serial.print(",");
Serial.print(sistole);
Serial.print(",");
Serial.print(diastole);
Serial.println("#");
*/

Serial.print("Suhu= ");
Serial.println(suhunya);
Serial.print("Bpm= ");
Serial.println(bpm);
Serial.print("Sistole= ");
Serial.println(sistole);
Serial.print("Diastole= ");
Serial.println(diastole);

}

}
 
void mulai(){ 
 dataadc = analogRead(A0);
 mmhg = (dataadc - 46.222) / 3.2;

if((mmhg >= mmhgx + 10)&&(mmhg > 100)&&(mark == 0)){
//digitalWrite(motor,LOW); 
Serial.println("SISTOLE"); 
sistole = mmhg;
mark = 2; 
digitalWrite(motor,LOW);
}

if((mmhg >= mmhgx + 5)&&(mmhg > 50)&&(mmhg < 90)&&(mark == 2)){
//digitalWrite(motor,LOW); 
Serial.println("DIASTOLE"); 
diastole = mmhg;
mark = 3;
}

 lcd.setCursor(0,1);
 lcd.print("S= ");
 lcd.print(mmhg);
 lcd.print("     ");

if(mmhg >= 150)
{
 digitalWrite(motor,LOW);   
}

mmhgx = mmhg;

Serial.println(mmhg);

if((mark == 3)&&(mmhg < 50)){
lcd.clear();
delay(1000);
mark = 0;
sistolex = sistole;
diastolex = diastole;
digitalWrite(solenoid,LOW);
return;  
}

delay(1);   
mulai();  
}


 
 
 j. VIDEO HASILNYA



 

Monitor Suhu Tubuh + BPM + TENSIMETER via Bluetooth Android Sensor MAX30102 dan MLX90614

Monitor Suhu Tubuh + BPM + TENSIMETER via Bluetooth Android Sensor MAX30102 dan MLX90614
 
      
         Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang dapat memonitor suhu tubuh, bpm dan tensi via bluetooth android. alat ini memang sangat cocok untuk digunakan sebagai alat pengecekan karena mudah dibawa dan juga terdapat fitur bluetooth sehingga bisa dimonitor melalui HP Android. untuk lebih jelasnya berikut adalah daftar komponen dan programnya.  



a. Arduino Uno




b. MAX30102




c. MLX90614




d. Driver Pompa dan Solenoid




e. Bluetooth HC-05




f. LCD I2C




g. MPX5050GP


h. Koding Android

 


i. Program Arduino IDE

#include <Wire.h>
#include <SPI.h>
#include <LiquidCrystal_I2C.h>
#include <Adafruit_MLX90614.h>  
#include "MAX30105.h"
#include "heartRate.h"

LiquidCrystal_I2C lcd(0x27,16,2); //library lcd

int cacah; //membuat variabel
int spo;
float bpm;
Adafruit_MLX90614 mlx = Adafruit_MLX90614();

float TargetC;
int motor = 8;
int solenoid = 9;
int dataadc;
//int tombol = D4;
int tombolx;
int hitung;
float vol;
float mmhg;
float mmhgx;
int sistole;
int diastole;
int sistolex;
int diastolex;
int mark = 0;
int bttensi = 10;
int suhunya;
int bpmku;

MAX30105 particleSensor;

const byte RATE_SIZE = 4; //Increase this for more averaging. 4 is good.
byte rates[RATE_SIZE]; //Array of heart rates
byte rateSpot = 0;
long lastBeat = 0; //Time at which the last beat occurred

float beatsPerMinute;
int beatAvg;
int counter;

void setup() {
  Wire.begin();
  mlx.begin();
  Serial.begin(9600);
  lcd.begin();
  lcd.clear();
  pinMode(4,OUTPUT);
  pinMode(5,OUTPUT);
  pinMode(6,OUTPUT);
  pinMode(7,OUTPUT);
  digitalWrite(4,HIGH);
  digitalWrite(5,HIGH);
  digitalWrite(6,HIGH);
  digitalWrite(7,HIGH);
  pinMode(motor,OUTPUT);
  pinMode(solenoid,OUTPUT);
  pinMode(bttensi,INPUT_PULLUP);

  digitalWrite(motor,LOW);
  digitalWrite(solenoid,LOW);

  //Serial.println("Initializing...");

  // Initialize sensor
  if (!particleSensor.begin(Wire, I2C_SPEED_FAST)) //Use default I2C port, 400kHz speed
  {
    //Serial.println("MAX30105 was not found. Please check wiring/power. ");
    while (1);
  }
    //Serial.println("Place your index finger on the sensor with steady pressure.");

  particleSensor.setup(); //Configure sensor with default settings
  particleSensor.setPulseAmplitudeRed(0x0A); //Turn Red LED to low to indicate sensor is running
  particleSensor.setPulseAmplitudeGreen(0); //Turn off Green LED

}
   
void loop(){
 
long irValue = particleSensor.getIR();

  if (checkForBeat(irValue) == true)
  {
    //We sensed a beat!
    long delta = millis() - lastBeat;
    lastBeat = millis();

    beatsPerMinute = 60 / (delta / 1000.0);

    if (beatsPerMinute < 255 && beatsPerMinute > 20)
    {
      rates[rateSpot++] = (byte)beatsPerMinute; //Store this reading in the array
      rateSpot %= RATE_SIZE; //Wrap variable

      //Take average of readings
      beatAvg = 0;
      for (byte x = 0 ; x < RATE_SIZE ; x++)
        beatAvg += rates[x];
      beatAvg /= RATE_SIZE;
    }
  }

mlx.begin();
TargetC = mlx.readObjectTempC();
suhunya = TargetC;

lcd.setCursor(0,0);
lcd.print("S=");
lcd.print(suhunya);
lcd.print("/");
lcd.print(sistole);
lcd.print("/");
lcd.print(diastole);
lcd.print("   ");

lcd.setCursor(0,1);
lcd.print("Bpm= ");
lcd.print(beatsPerMinute);
lcd.print("    ");
//lcd.print(cacah);

//delay(10);

int bttensix = digitalRead(bttensi);

if(bttensix == 0){
 lcd.clear();
 delay(3000);
 mulai();
}

delay(1);

cacah++;

if(cacah >= 10){
cacah = 0;
 
/*
Serial.print("*");
Serial.print(suhunya);
Serial.print(",");
Serial.print(bpmku);
Serial.print(",");
Serial.print(sistole);
Serial.print(",");
Serial.print(diastole);
Serial.println("#");
*/

Serial.print("Suhu= ");
Serial.println(suhunya);
Serial.print("Bpm= ");
Serial.println(beatsPerMinute);
Serial.print("Sistole= ");
Serial.println(sistole);
Serial.print("Diastole= ");
Serial.println(diastole);
}

}
 

void mulai(){ 

 dataadc = analogRead(A0);
 mmhg = (dataadc - 46.222) / 3.2;

if((mmhg >= mmhgx + 10)&&(mmhg > 100)&&(mark == 0)){
//digitalWrite(motor,LOW); 
Serial.println("SISTOLE"); 
sistole = mmhg;
mark = 2; 
digitalWrite(motor,LOW);
}

if((mmhg >= mmhgx + 5)&&(mmhg > 50)&&(mmhg < 90)&&(mark == 2)){
//digitalWrite(motor,LOW); 
Serial.println("DIASTOLE"); 
diastole = mmhg;
mark = 3;
}

 lcd.setCursor(0,1);
 lcd.print("S= ");
 lcd.print(mmhg);
 lcd.print("     ");

if(mmhg >= 150)
{
 digitalWrite(motor,LOW);   
}

mmhgx = mmhg;

Serial.println(mmhg);

if((mark == 3)&&(mmhg < 50)){
lcd.clear();
delay(1000);
mark = 0;
sistolex = sistole;
diastolex = diastole;
digitalWrite(solenoid,LOW);
return;  
}

delay(1);   
mulai();  
}




j. VIDEO HASILNYA
 




Alat Kendali Servo dan Monitor Jarak HC-SRF04 + SMS Gateway

 Alat Kendali Servo dan Monitor Jarak HC-SRF04 + SMS Gateway
 

            Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang dapat mengendalikan posisi servo dan monitor jarak serta alat ini juga bisa melakukan sms jika jarak kurang dari 10 cm. untuk lebih jelasnya berikut adalah program dan daftar komponennya.  


a. Arduino Uno




b. Motor Servo
 

 
 
c. Sensor Jarak HC-SRF04
 

 
 
d. Modul SMS SIM900A



e. Program Arduino IDE

#include "SIM900.h"
#include <SoftwareSerial.h>
#include <Wire.h>
#include <Servo.h>

#define trigPin1 6
#define echoPin1 7

#include "sms.h"
SMSGSM sms;

long duration1, distance1;
Servo myservo1;
int relay1 = 4;
int relay2 = 5;
int buzzer = 10;

int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];

void setup() {
Serial.begin(9600);

     Serial.println("GSM Shield testing.");
     //Start configuration of shield with baudrate.
     //For http uses is raccomanded to use 4800 or slower.
     if (gsm.begin(2400)) {
          Serial.println("\nstatus=READY");
          started=true;
     } else Serial.println("\nstatus=IDLE");

     if(started) {
          //Enable this two lines if you want to send an SMS.
          if (sms.SendSMS("085733400808", "Alat Ready"))
          Serial.println("\nSMS sent OK");
     }

pinMode(trigPin1, OUTPUT);
pinMode(echoPin1, INPUT);
myservo1.attach(9);
myservo1.write(100);
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
digitalWrite(relay1,HIGH);
digitalWrite(relay2,HIGH);
pinMode(buzzer,OUTPUT);
digitalWrite(buzzer,HIGH);
}

void loop() {
    
//goreng krupuk
myservo1.write(100);
delay(3000);
digitalWrite(relay1,LOW);
delay(20000);

//angkat krupuk
digitalWrite(relay1,HIGH);
delay(1000);
myservo1.write(150);
delay(3000);

digitalWrite(trigPin1, LOW);  // Added this line
delayMicroseconds(2); // Added this line
digitalWrite(trigPin1, HIGH);
delayMicroseconds(10); // Added this line
digitalWrite(trigPin1, LOW);
duration1 = pulseIn(echoPin1, HIGH);
distance1 = (duration1/2) / 29.1;

Serial.println(distance1);  

if(distance1 < 10){
if (sms.SendSMS("085733400808", "Tempat Krupuk Penuh"))
Serial.println("\nSMS sent OK");
digitalWrite(buzzer,LOW);
berhenti();
}

if(distance1 > 10){
digitalWrite(buzzer,HIGH);
}

}

void berhenti(){

digitalWrite(trigPin1, LOW);  // Added this line
delayMicroseconds(2); // Added this line
digitalWrite(trigPin1, HIGH);
delayMicroseconds(10); // Added this line
digitalWrite(trigPin1, LOW);
duration1 = pulseIn(echoPin1, HIGH);
distance1 = (duration1/2) / 29.1;

Serial.println(distance1);  

myservo1.write(100);
digitalWrite(relay1,HIGH);

if(distance1 > 10){
  return;
}

berhenti();  
}




f. VIDEO HASILNYA




 
 

Monitor Water Flow dan Pressure Menggunakan SMS Gateway

 Monitor Water Flow dan Pressure Menggunakan SMS Gateway
 

             Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang dapat memonitor flow air dan tekanan udara atau air secara bersamaan dengan menggunakan SMS gateway. alat ini menggunakan 2 buah sensor dan satu arduino serta modul sim900A. untuk lebih jelasnya berikut adalah proram dan daftar komponennya.

 

a. Arduino Uno




b. Sensor Water Flow
 

 
 
c. Sensor Pressure




d. LCD 16x2




e. Sim900A



f. Program Arduino IDE

#include "SIM900.h"
#include <SoftwareSerial.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16,2);

int dataadc;
int x;
float v;
float kpa;

#include "sms.h"
SMSGSM sms;

byte sensorInterrupt = 0;  // 0 = digital pin 2
byte sensorPin       = 2;

float calibrationFactor = 4.5;

volatile byte pulseCount;

unsigned int frac;
float flowRate;
unsigned int flowMilliLitres;
float totalMilliLitres;

unsigned long oldTime;
float pressure_pascal;
float pressure_bar;

char string[160];
int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];
int presure;
char presstr[20];

void setup() {

Serial.begin(9600);

lcd.begin();
lcd.clear();
lcd.noCursor();

     Serial.println("GSM Shield testing.");
     if (gsm.begin(2400)) {
          Serial.println("\nstatus=READY");
          started=true;
     } else Serial.println("\nstatus=IDLE");

     if(started) {
         // if (sms.SendSMS("085456789999", "Alat Ready"))
         // Serial.println("\nSMS sent OK");
     }
 
  pinMode(sensorPin, INPUT);
  digitalWrite(sensorPin, HIGH);

  pulseCount        = 0;
  flowRate          = 0.0;
  flowMilliLitres   = 0;
  totalMilliLitres  = 0;
  oldTime           = 0;

  attachInterrupt(sensorInterrupt, pulseCounter, FALLING);

}

void loop() {

  if((millis() - oldTime) > 1000)
  {

    detachInterrupt(sensorInterrupt);
    flowRate = ((1000.0 / (millis() - oldTime)) * pulseCount) / calibrationFactor;
    oldTime = millis();
    flowMilliLitres = (flowRate / 60) * 1000;
    totalMilliLitres += flowMilliLitres;

    pulseCount = 0;
   
    attachInterrupt(sensorInterrupt, pulseCounter, FALLING);
  }
 
  x = analogRead(A0);
  v = x*(5.0/1023.0);

  pressure_pascal = (3.0*(v-0.47))*1000000.0;
  pressure_bar = pressure_pascal/10e5;
  presure = pressure_bar;
 
  lcd.setCursor(0, 0);
  lcd.print("Bar= ");
  lcd.print(pressure_bar);
  lcd.print("   ");
      
  lcd.setCursor(0, 1);
  lcd.print("ml/s= ");
  lcd.print(flowMilliLitres);
  lcd.print("   ");
 
  delay(200);

 dtostrf(pressure_bar,5,2,presstr);
 sprintf(string,"Flow: %d  Pressure: %s", flowMilliLitres, presstr);
 
 int pos=0;
 
  pos=sms.IsSMSPresent(SMS_ALL);
  if(pos){
    sms.GetSMS(pos,n,smsbuffer,100);
 
    if(!strcmp(smsbuffer,"monitor")){
      sms.SendSMS(n,string);
    }
    if(!strcmp(smsbuffer,"Monitor")){
      sms.SendSMS(n,string);
    }

    delsms();
  }
 
  delay(100);

}

void pulseCounter()
{
  pulseCount++;
}

void delsms()
{
  for (int i=0; i<10; i++)
  {
      int pos=sms.IsSMSPresent(SMS_ALL);
      if (pos!=0)
      {
        if (sms.DeleteSMS(pos)==1){}else{}
      }
  }
}


g. VIDEO HASILNYA




 

Monitor Water Flow dan Pressure

 Monitor Water Flow dan Pressure 

           Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang dapat memonitor flow air dan tekanan udara atau air secara bersamaan dengan menggunakan lcd. alat ini menggunakan 2 buah sensor dan satu arduino. untuk lebih jelasnya berikut adalah proram dan daftar komponennya.


a. Arduino Uno
 



b. Sensor Water Flow




c. Sensor Pressure




d. LCD 16x2



e. Program Arduino IDE

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16,2);

int dataadc;
int x;
float v;
float kpa;

byte sensorInterrupt = 0;  // 0 = digital pin 2
byte sensorPin       = 2;

float calibrationFactor = 4.5;

volatile byte pulseCount;

unsigned int frac;
float flowRate;
unsigned int flowMilliLitres;
float totalMilliLitres;

unsigned long oldTime;
float pressure_pascal;
float pressure_bar;


void setup() {
  lcd.begin();
  lcd.clear();
  lcd.noCursor();
 
  pinMode(sensorPin, INPUT);
  digitalWrite(sensorPin, HIGH);

  pulseCount        = 0;
  flowRate          = 0.0;
  flowMilliLitres   = 0;
  totalMilliLitres  = 0;
  oldTime           = 0;

  attachInterrupt(sensorInterrupt, pulseCounter, FALLING);

}

void loop() {

  if((millis() - oldTime) > 1000)
  {

    detachInterrupt(sensorInterrupt);
    flowRate = ((1000.0 / (millis() - oldTime)) * pulseCount) / calibrationFactor;
    oldTime = millis();
    flowMilliLitres = (flowRate / 60) * 1000;
    totalMilliLitres += flowMilliLitres;

    pulseCount = 0;
   
    attachInterrupt(sensorInterrupt, pulseCounter, FALLING);
  }
 
  x = analogRead(A0);
  v = x*(5.0/1023.0);

  pressure_pascal = (3.0*(v-0.47))*1000000.0;
  pressure_bar = pressure_pascal/10e5;
 
  lcd.setCursor(0, 0);
  lcd.print("Bar= ");
  lcd.print(pressure_bar);
  lcd.print("   ");
      
  lcd.setCursor(0, 1);
  lcd.print("ml/s= ");
  lcd.print(flowMilliLitres);
  lcd.print("   ");
 
  delay(200);
}


void pulseCounter()
{
  pulseCount++;
}



f. VIDEO HASILNYA