--> Project I - 12. Aplikasi Nurse Call (Panggilan Perawat) dengan 7-Segment berbasis Arduino | Tutorial arduino lengkap

Wednesday, August 23, 2017

Project I - 12. Aplikasi Nurse Call (Panggilan Perawat) dengan 7-Segment berbasis Arduino

| Wednesday, August 23, 2017
Aplikasi Nurse Call (Panggilan Perawat) dengan 7-Segment


Alat pemanggil perawat dirumah sakit. Sistem kerja alat nya sebagai berikut, tombol push botton sebagai pemicu alarm pada ruang perawat, tombol ditaruh pada setiap kamar pasien. Seven segment menampilkan ruangan dan kamar pasien serta menampilkan jumlah tombol yang ditekan. Pada ruangan perawat terdapat tombol push on (tombol pick up) untuk mematikan alarm dan melanjutkan urutan antrian pasien yang menekan tombol. Pada aplikasi kali ini terdapat 2 Arduino UNO, 1 Arduino digunakan untuk menangani tombol yang ditekan, data dikirim secara serial kepada Arduino yang satunya, selanjutnya datanya ditampilkan pada seven segment.

Kebutuhan Hardware

  • Modul Seven segment 6 digit
  • 16 Tombol push ON untuk kamar pasien
  • 1 Tombol push ON untuk ruang perawat
  • Buzzer
  • 2 Modul Arduino UNO
  • Power supply +5 Volt

7-Segment | Source                   Push Button | Source


Buzzer | Source

Diagram Blok


Schematic

    --> Arduino 1

    -->  Arduino 2





Koneksi Serial Arduino 1 - Arduino 2


Arduino 1 - Tombol




Arduino 2 - 7-Segment



 Arduino 2 - Komponen lain

Source Code --> Arduino 1
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
byte in_serial,str;
boolean tb1,tb2,tb3,tb4,tb5,tb6,tb7,tb8,tb9=true;
boolean tb10,tb11,tb12,tb13,tb14,tb15,tb16=true;
String inString="";
char f;
void setup(){
pinMode(4, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
pinMode(7, INPUT);
pinMode(8, INPUT);
pinMode(9, INPUT);
pinMode(10, INPUT);
pinMode(11, INPUT);
pinMode(12, INPUT);
pinMode(13, INPUT);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
digitalWrite(11, HIGH);
digitalWrite(12, HIGH);
digitalWrite(13, HIGH);
pinMode(A0,INPUT);
pinMode(A1,INPUT);
pinMode(A2,INPUT);
pinMode(A3,INPUT);
pinMode(A4,INPUT);
pinMode(A5,INPUT);
digitalWrite(A0, HIGH);
digitalWrite(A1, HIGH);
digitalWrite(A2, HIGH);
digitalWrite(A3, HIGH);
digitalWrite(A4, HIGH);
digitalWrite(A5, HIGH);
delay(100);
mySerial.begin(9600);
tb1=true;
tb2=true;
tb3=true;
tb4=true;
tb5=true;
tb6=true;
tb7=true;
tb8=true;
tb9=true;
tb10=true;
tb11=true;
tb12=true;
tb13=true;
tb14=true;
tb15=true;
tb16=true;
Serial.begin(9600);
}
void loop() {
if(digitalRead(4)==LOW && tb1==true){
mySerial.println("A01B01");
tb1=false;
delay(500);
}
if(digitalRead(5)==LOW && tb2==true){
mySerial.println("A01B02");
tb2=false;
delay(500);
}
if(digitalRead(6)==LOW && tb3==true){
mySerial.println("A01B03");
tb3=false;
delay(500);
}
if(digitalRead(7)==LOW && tb4==true){
mySerial.println("A01B04");
tb4=false;
delay(500);
}
if(digitalRead(8)==LOW && tb5==true){
mySerial.println("A01B05");
tb5=false;
delay(500);
}
if(digitalRead(9)==LOW&& tb6==true){
mySerial.println("A02B01");
tb6=false;
delay(500);
}
if(digitalRead(10)==LOW && tb7==true){
mySerial.println("A02B02");
tb7=false;
delay(500);
}
if(digitalRead(11)==LOW && tb8==true){
mySerial.println("A02B03");
tb8=false;
delay(500);
}
if(digitalRead(12)==LOW && tb9==true){
mySerial.println("A02B04");
tb9=false;
delay(500);
}
if(digitalRead(13)==LOW && tb10==true){
mySerial.println("A02B05");
tb10=false;
delay(500);
}
if(digitalRead(A0)==LOW && tb11==true){
mySerial.println("A03B01");
tb11=false;
delay(500);
}
if(digitalRead(A1)==LOW && tb12==true){
mySerial.println("A03B02");
tb12=false;
delay(500);
}
if(digitalRead(A2)==LOW && tb13==true){
mySerial.println("A03B03");
tb13=false;
delay(500);
}
if(digitalRead(A3)==LOW && tb14==true){
mySerial.println("A03B04");
tb14=false;
delay(500);
}
if(digitalRead(A4)==LOW && tb15==true){
mySerial.println("A03B05");
tb15=false;
delay(500);
}
if(digitalRead(A5)==LOW && tb16==true){
mySerial.println("A03B06");
tb16=false;
delay(500);
}
if(mySerial.available()){
getSerial();
if (inString=="tb1=true") tb1=true;
else if (inString=="tb2=true")tb2=true;
else if (inString=="tb3=true")tb3=true;
else if (inString=="tb4=true")tb4=true;
else if (inString=="tb5=true")tb5=true;
else if (inString=="tb6=true")tb6=true;
else if (inString=="tb7=true")tb7=true;
else if (inString=="tb8=true")tb8=true;
else if (inString=="tb9=true")tb9=true;
else if (inString=="tb10=true")tb10=true;
else if (inString=="tb11=true")tb11=true;
else if (inString=="tb12=true")tb12=true;
else if (inString=="tb13=true")tb13=true;
else if (inString=="tb14=true")tb14=true;
else if (inString=="tb15=true")tb15=true;
else if (inString=="tb16=true")tb16=true;
Serial.println(inString);
}
}
//----------------
void getSerial(){
f=1;
inString="";
while(f){
if(mySerial.available()){
str=mySerial.read();
switch (str){
case '\r': break;
case '\n':f=0; break;
default:inString+=(char)str;
}
}
}
}


Source Code --> Arduino 2
#include <EEPROM.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
byte in_serial,str;
long lastButton = 0;
long delayAntiBouncing = 50;
byte f_data, addr, addr_tampil, pickUp;
byte bacaRuang, bacaKamar, antrian;
byte lanjut, f_tampilan;
byte simpanRuang, simpanKamar;
char f;
int i, j;
String inString="";
String Stemp="";
byte seven_seg_digits[10][7] = { { 0,0,0,0,0,0,1 }, // = 0
{ 1,0,0,1,1,1,1 }, // = 1
{ 0,0,1,0,0,1,0 }, // = 2
{ 0,0,0,0,1,1,0 }, // = 3
{ 1,0,0,1,1,0,0 }, // = 4
{ 0,1,0,0,1,0,0 }, // = 5
{ 0,1,0,0,0,0,0 }, // = 6
{ 0,0,0,1,1,1,1 }, // = 7
{ 0,0,0,0,0,0,0 }, // = 8
{ 0,0,0,0,1,0,0 }, // = 9
};
void setup(){
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(A0, OUTPUT);
pinMode(A1, OUTPUT);
pinMode(A2, OUTPUT);
pinMode(A3, OUTPUT);
pinMode(A4, OUTPUT);
pinMode(A5, OUTPUT);
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
pinMode(12,INPUT);
digitalWrite(12, HIGH);
mySerial.begin(9600);
}
void loop(){
if(mySerial.available()){
getSerial();
i=inString.indexOf('A');
j=i+3;
Stemp=inString.substring((i+1),j);
simpanRuang=Stemp.toInt();
addr++;
EEPROM.write(addr,simpanRuang);
i=inString.indexOf('B');
j=i+3;
Stemp=inString.substring((i+1),j);
simpanKamar=Stemp.toInt();
addr++;
EEPROM.write(addr,simpanKamar);
f_data++;
}
if (f_data > 0){
if(pickUp==0 && f_tampilan==0){
bacaRuang=EEPROM.read(1);
bacaKamar=EEPROM.read(2);
lanjut++;
f_tampilan=1;
}
else if(pickUp==1){
statusTombol();
lanjut++;
addr_tampil = lanjut*2;
bacaKamar=EEPROM.read(addr_tampil);
addr_tampil = addr_tampil-1;
bacaRuang=EEPROM.read(addr_tampil);
pickUp=0;
f_data--;
}
tampil7Segment();
digitalWrite(13, HIGH);
}
else{
digitalWrite(A0,HIGH); digitalWrite(A1,HIGH);
digitalWrite(A2,HIGH); digitalWrite(A3,HIGH);
digitalWrite(A4,HIGH); digitalWrite(A5,HIGH);
addr=0;
addr_tampil=0;
f_data=0;
pickUp=0;
lanjut=0;
f_tampilan=0;
digitalWrite(13, LOW);
}
if(digitalRead(12)==0){
if ((millis() - lastButton) > delayAntiBouncing){
if(f_data > 0) {
pickUp=1;
}
}
lastButton = millis();
}
}
void tampil7Segment(){
digitalWrite(A0,LOW); digitalWrite(A1,HIGH);
digitalWrite(A2,HIGH); digitalWrite(A3,HIGH);
digitalWrite(A4,HIGH); digitalWrite(A5,HIGH);
sevenSegWrite(bacaRuang / 10);
delay(5);
digitalWrite(A0,HIGH); digitalWrite(A1,LOW);
digitalWrite(A2,HIGH); digitalWrite(A3,HIGH);
digitalWrite(A4,HIGH); digitalWrite(A5,HIGH);
sevenSegWrite(bacaRuang % 10);
delay(5);
digitalWrite(A0,HIGH); digitalWrite(A1,HIGH);
digitalWrite(A2,LOW); digitalWrite(A3,HIGH);
digitalWrite(A4,HIGH); digitalWrite(A5,HIGH);
sevenSegWrite(bacaKamar / 10);
delay(5);
digitalWrite(A0,HIGH); digitalWrite(A1,HIGH);
digitalWrite(A2,HIGH); digitalWrite(A3,LOW);
digitalWrite(A4,HIGH); digitalWrite(A5,HIGH);
sevenSegWrite(bacaKamar % 10);
delay(5);
digitalWrite(A0,HIGH); digitalWrite(A1,HIGH);
digitalWrite(A2,HIGH); digitalWrite(A3,HIGH);
digitalWrite(A4,LOW); digitalWrite(A5,HIGH);
sevenSegWrite(f_data / 10);
delay(5);
digitalWrite(A0,HIGH); digitalWrite(A1,HIGH);
digitalWrite(A2,HIGH); digitalWrite(A3,HIGH);
digitalWrite(A4,HIGH); digitalWrite(A5,LOW);
sevenSegWrite(f_data % 10);
delay(5);
}
void sevenSegWrite(byte segment){
byte pin = 4;
for (byte segCount = 0; segCount < 7; ++segCount) {
digitalWrite(pin, seven_seg_digits[segment][segCount]);
++pin;
}
}
void statusTombol(){
if (bacaRuang==1 && bacaKamar==1){
mySerial.println("tb1=true");
}
else if (bacaRuang==1 && bacaKamar==2){
mySerial.println("tb2=true");
}
else if (bacaRuang==1 && bacaKamar==3){
mySerial.println("tb3=true");
}
else if (bacaRuang==1 && bacaKamar==4){
mySerial.println("tb4=true");
}
else if (bacaRuang==1 && bacaKamar==5){
mySerial.println("tb5=true");
}
else if (bacaRuang==2 && bacaKamar==1){
mySerial.println("tb6=true");
}
else if (bacaRuang==2 && bacaKamar==2){
mySerial.println("tb7=true");
}
else if (bacaRuang==2 && bacaKamar==3){
mySerial.println("tb8=true");
}
else if (bacaRuang==2 && bacaKamar==4){
mySerial.println("tb9=true");
}
else if (bacaRuang==2 && bacaKamar==5){
mySerial.println("tb10=true");
}
else if (bacaRuang==3 && bacaKamar==1){
mySerial.println("tb11=true");
}
else if (bacaRuang==3 && bacaKamar==2){
mySerial.println("tb12=true");
}
else if (bacaRuang==3 && bacaKamar==3){
mySerial.println("tb13=true");
}
else if (bacaRuang==3 && bacaKamar==4){
mySerial.println("tb14=true");
}
else if (bacaRuang==3 && bacaKamar==5){
mySerial.println("tb15=true");
}
else if (bacaRuang==3 && bacaKamar==6){
mySerial.println("tb16=true");
}
}
void getSerial(){
f=1;
inString="";
while(f){
if(mySerial.available()){
str=mySerial.read();
switch (str){
case '\r': break;
case '\n':f=0; break;
default:inString+=(char)str;
}
}
}
}


Jalannya Alat

1. Koneksikan antara sistem Arduino dengan peripheral lain seperti pada rangkaian (skematik).
2. Pasang power supply
3. Upload ke-2 program diatas.

4. Kondisi normal seven segment tidak menampilkan display.


 5. Ketika salah satu tombol ditekan maka akan menampilkan


6. Ketika masih ada antrian, maka pada Arduino 2 atau operator receiver akan membunyikan buzzer
    hingga tombol pick up ditekan.


Video untuk Project I - 12. Aplikasi Nurse Call (Panggilan Perawat) dengan 7-Segment berbasis Arduino




KAMI MELAYANI JASA PEMBUATAN HARDWARE ATAU SOFTWARE BERBASIS ARDUINO

KONTAK KAMI 085743320570 (adi sanjaya)

Related Posts

3 comments:

  1. MANTAP MAS BRO...
    sangat bermanfaat...
    semoga alloh memberi balasan setimpal atas segala kebaikan mas bro yang telah mau berbagi ilmunya.
    ...amin .

    ReplyDelete
  2. trimakasih infonya .
    sangat berguna bagi pembelajaran saya.

    ReplyDelete