Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Iasonas Christoulakis
Published

Smart Hospital Room

The following project is an arduino based system that provides live monitoring on temperature in a hospital room

IntermediateProtip8 hours1,199
Smart Hospital Room

Things used in this project

Story

Read more

Custom parts and enclosures

Function

Schematics

Schematics

Code

Code of Project

C/C++
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F, 16, 2);
int buzzer = 9;
int led=13;
int ledy=8;
int ledg=7;
int button=2;
int val=0;
int old_val=0;
int state=0;
int tmp=0;
int tempPin = 1;
void setup ()

{
  
  Serial.begin(9600);
  
  lcd.init();
  lcd.backlight();
  
  pinMode(buzzer, OUTPUT);
  pinMode(led,OUTPUT);
  pinMode(button,INPUT);

}

void loop()
{

tmp = analogRead(tempPin);
float mv = ( tmp/1024.0)*5000;
float cel = mv/10;

/* Tranformation to Fahrenheit
/*float farh = (cel*9)/5 + 32;*/

Serial.print("TEMPRATURE = ");
Serial.print(cel);
Serial.print("*C");
Serial.println();
delay(100);
lcd.setCursor(2,0);
lcd.print("temp=");
lcd.print(cel);
lcd.print("*C");

/*Serial Port Simulation  */
Serial.print("TEMPRATURE = ");
Serial.print(farh);
Serial.print("*F");
Serial.println();

val=digitalRead(button);

if( (val==HIGH) && (old_val==LOW))
{
  state=1-state;
  
}
   old_val=val;
   
if (state==1)
{ 
  digitalWrite(led, HIGH);
    tone(buzzer, 1100);
 lcd.setCursor(9,1);
 lcd.print("ALARM");
    delay(1000);
  
}
else
{
  digitalWrite (led,LOW);
  noTone(buzzer);
    lcd.setCursor(9,1);
    lcd.print(" ");
  
}
if ((cel<17) || (cel>22)) 
{ 
  digitalWrite(ledy, HIGH);
    tone(buzzer, 1100);
  lcd.setCursor(2,1);
  lcd.print("ALARM "); 
  delay(100);}
else 
{
  digitalWrite (ledy,LOW);
  noTone(buzzer);
   delay(100);
  
}
if ((cel>17) && (cel<22)) 
{
    digitalWrite(ledg, HIGH);
  lcd.setCursor(2,1);
  lcd.println("NORMAL");
    delay(100);
  
}

else 
{
  digitalWrite (ledg,LOW);
lcd.setCursor(2,1);
lcd.println("ALARM ");
  delay(100);
  
}

Credits

Iasonas Christoulakis
9 projects • 31 followers
Biomedical Engineer MedispLab Instructor Former General Manager at IEEE NTUA Student Branch
Contact

Comments

Please log in or sign up to comment.