Professional Documents
Culture Documents
Chapter - 1: DDIT-Electrical &computer Engineering Department
Chapter - 1: DDIT-Electrical &computer Engineering Department
Chapter - 1: DDIT-Electrical &computer Engineering Department
2017
CHAPTER -1
INTRODUCTION
1.1 Introduction
In today’s world it is very difficult to carry patients from home to hospitals for regular checkup.
There are a lot of challenges like waiting in the queue, travelling time and patient may be prone
to various infections moving in this polluted environment. So the health care industry is focusing
on in-home health care services where the patient can undergo medical check-ups in the comfort
of his home environment. Health care industry is working together with Information and
communication technology industry to develop models that reduces the time consumption,
increasing accuracy and interoperable on any platform that can be beneficial to both hospitals
and patient.
Typically the patient health monitoring system consists of various sensors that measure
the physiological information from the patient and transfer them to the microcontroller as
electrical signals. The microcontroller processes this physiological data and compare with
predefined value and then take necessary action.
In the existing system the transmission of data received from sensors is intermittent. There is a
drawback in the existing system is that the continuous monitoring of patient health is not
possible. Even though the patient is taken to the hospital in time the doctor may not come
to conclusion with which critical health condition the patient has comeback without further
testing of patient. Hence it is a time consuming process.
This chapter is all about the projects initialization. The chapter tells or discusses on the points of
what problems are initiates to do this project, what are the objectives and goals, scope of project,
beneficiary of the project and finally all about the statement of chapters.
The proposed system is the solution to monitor patient from a remote area which is cost efficient.
We have built a device that will take pulse rate and temperature as inputs of a patient and then it
will send data through GSM module to predefined person. This project is monitoring the patients
remotely with the help of GSM technology. This project will be designed with the
Microcontroller (Arduino Uno), 2x16 LCD, LM 35 Temperature Sensor, Heart beat Sensor,
SIM 900 GSM module and Buzzer. The temperature and heart beat sensor takes the reading from
the human body and stores it in the microcontroller. The microcontroller will compare the two
parameters with the ideal parameters, if some fluctuations are noticed, a SMS indicating
―PATIENT ABNORMAL‖ with the body temperature value and also a call is immediately sent
to the doctor’s mobile phone.
As we know:-
Some person due to naturally, some accident injuries or aging case cannot express what it
fell even if he/she within disease and for other person it is difficult to understand and give
necessary service.
Also for elder person may it difficult to go to the hospital to make some regular checkup.
Another person also may busy with work or other case and they don’t get time for regular
checkup.
In developing country it is not learnt to going for checkup until they sleep on bed so, with
this project they familiar with regular checkup every time and everywhere.
When we fall ill we go to doctors which is very time consuming and also expensive.
Having someone to watch a critically ill person is very expensive and takes a lot of
manpower. These valuable resources can be used elsewhere.
There is also some silence disease so the patient cannot know even if it has within some
disease until it reached some hard case.
The initial goal of this project is to design, develop and construct an operational ―Patient
monitoring system using GSM‖
To develop a cheap prototype of a system that can monitor the body temperature and
heartbeat of a patient at home and in the hospital.
This project is made of cheap materials. A complete system that measures temperature and heart
beat is so far expensive. This system is fully automated system and does not require any human
attention.
Automatic alert system using enabled by microcontroller gives intimation to user. GSM
interfacing provides a feature of remote monitoring of patient parameters. The system determines
the heart beat rate per minute and then sends short message service (SMS) alert to the mobile
phone on top of displaying it on a LCD. It is also cost effective and portable. It is easy to handle
and efficient. It is not as complex as the current systems.
The proposed system work remotely without physical communication, this helps people
who cannot communicate with other.
Any person can use the proposed system everywhere and anywhere.
On the proposed system body temperature and heartbeat rate can be calculated and if any
fault occurs the system send message immediately to predefined phone number and also
buzzer is sound.
The system that was designed should not identify the location of the patient.
In all chapters of this project, all about patient monitoring system using GSM with their Merits
and demerits will be discussed perfectly. In the first chapter of this project the introduction of the
project and problem statement, objectives, scope... is presented. Now, in the next chapter that is
chapter two the Literature review which is about the existing method of patient monitoring
system, some types of patient monitoring system with their draw backs, and finally appreciates
this project that is different from the existing one. In the third chapter all about the Theoretical
analysis of the project will be discussed. Then after the theory of the project is discussed the
design analysis will be done in chapter four which is an Experimental analysis (simulation,
hardware modeling...) and from the experiment , in continued chapter the result of the
experiment analyzed in chapter five and also all the discussions about the result. Finally, in the
last chapter of this work the conclusion, future enhancement and the recommendation of all the
previous discussions will be done and also lastly, Appendixes.
CHAPTER -2
LITERATURE REVIEW
2. Introduction
This chapter presents all the information’s that have been found related to the project work. A
few of them are discussed in brief. This chapter also includes the problems with the method they
adopted and what can be done to overcome the drawbacks. Generally in this chapter we discuss
the existing method and proposed method.
There are some shortcomings present in existing system. Currently there are number of health
monitoring systems available for the ICU patients which can be used only when the patient is on
bed. This system is wired everywhere. The patient is monitored in ICU and the data transferred
to the PC is wired. Such systems become difficult where the distance between System and
PC is more. The available systems are huge in size. Regular monitoring of patient is not
possible once he/she is discharged from hospitals. These systems cannot be used at individual
level. The other problem with these systems is that it is not capable of transmitting data
continuously also range limitations of different wireless technologies used in the systems.
More or less in the developing country the person going to hospital when the disease going to
high level or when person is on the bed. Such like condition sometimes difficult for patient, may
it not properly service due to shortage of time and also the patient reaches on some difficult
situation.in more hospital the number of patient and number nurse or doctors and patient room
are unbalanced so in one room may patient sleep this causes for some another distributed disease.
So to overcome these limitations of systems we have proposed a system. The figure below shows
the existing patient room with the number of given service.
The system which we proposed would not only help in monitoring the patient when he is in the
bed but also when he is not in the bed i.e., when he is mobile. Such a system would constantly
monitor important body parameters like Temperature and heartbeat and would compare it
against a predetermined value set and if these values cross a particular limit it will automatically
alert the doctor and relatives of the patient via a SMS. In such case the patient will get a very
quick medical help and also would save time and energy of the relatives who would not be with
them all the time.
CHAPTER -3
THEORECTICAL ANALYSIS
3. Introduction
This chapter deals with block diagram, circuit diagram and essentials components used to design
Patient monitoring system using GSM. And this chapter also deals with the detail explanation of
each and every material used in this project.
Voltage
Power supply Rectifier
regulator
LCD DISPLAY
LM35
TEMPRATURE GSM
Arduino Uno USB cable modem
SENSOR
HEART BEAT
SENSOR BUZZER SMS
As we seen from above figure block diagram of the proposed system consists of microcontroller,
GSM modem, Temperature sensor, Heart beat sensor, LCD display and Buzzer. The
microcontroller acts as a control function and memory organization. The GSM is for messaging
service. The temperature and heart beat sensor is to sense the temperature and heart beat from the
human body. Their description is discussed below in detail.
The figure below shows the circuit diagram for power supply.
OUTPUT VOLTAGE
The AC voltage, typically 220V rms, is connected to a transformer, which steps that ac voltage
down to the level of the desired DC output. A diode rectifier then provides a full-wave rectified
voltage that is initially filtered by a simple capacitor filter to produce a dc voltage. This resulting
dc voltage usually has some ripples or ac voltage variations. A regulator circuit removes the
ripples and remains the same dc value even if the input dc voltage varies, or the load connected
to the output dc voltage changes.
3.2.2Transformer:
The potential transformer will step down the power supply voltage (0-220V) to (0-6V) level.
3.2.3Bridge rectifier:
When four diodes are connected as shown in the figure 3.2, the circuit is called as bridge
rectifier. The input to the circuit is applied to the diagonally opposite corners of the network, and
the output is taken from the remaining two corners.
Voltage regulators comprise a class of widely used ICs. Regulator IC units contain the
circuitry for reference source, comparator amplifier, control device, and overload protection
all in a single IC.IC units provide regulation of either a fixed positive voltage, a fixed
negative voltage, or an adjustable set voltage. The regulators can be selected for operation with
load currents from hundreds of milli amperes to tens of amperes, corresponding to power ratings
from milli watts to tens of watts.
The Uno is a microcontroller board based on the ATmega328P. It has 14 digital input/output pins
(Of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB
connection, a power jack, an ICSP header and a reset button. It contains everything needed to
support the microcontroller. It is simply connected to the computer using a USB cable or
powered with an AC-to-DC adapter or battery to get it started.
"Uno" means one in Italian and was chosen to mark the release of Arduino Software (IDE) 1.0.
The Uno board and version 1.0 of Arduino Software (IDE) were the reference versions of
Arduino, now evolved to newer releases. The Uno board is the first in a series of USB Arduino
boards, and the reference model for the Arduino platform.
Cheap- Arduino boards are inexpensive when compared to other microcontroller platforms.
Cross-platform- The Arduino Software runs on Windows, Macintosh OSX, and Linux
operating systems. Most microcontroller systems can only run on Windows. Simple, clear
programming environment- The Arduino Software (IDE) is easy-to-use for beginners, yet
flexible enough for advanced users to take advantage of as well.
Open source and extensible software- The Arduino software is published as open source tools,
available for extension by experienced programmers. The language can be expanded through
C++ libraries.
Open source and extensible hardware- The plans of the Arduino boards are published under a
Creative Commons license, so experienced circuit designers can make their own version of the
module, extending it and improving it. Even relatively inexperienced users can build the
breadboard version of the module in order to understand how it works and save money.
Operating Voltage 5V
SRAM 2 KB (ATmega328P)
EEPROM 1 KB (ATmega328P)
Length 68.6 mm
Width 53.4 mm
Weight 25 g
The ATmega328 on the Uno comes preprogrammed with a boot loader that allows one to upload
new code to it without the use of an external hardware programmer. The Uno can be
programmed with the Arduino Software (IDE).
The LM35 series are precision integrated-circuit temperature sensors, whose output voltage
is linearly proportional to the Celsius (Centigrade) temperature. The LM35 thus has an
advantage over linear temperature sensors calibrated in ° Kelvin, as the user is not required to
subtract a large constant voltage from its output to obtain convenient Centigrade scaling. The
LM35 does not require any external calibration or trimming to provide typical accuracies of
±¼°C at room temperature and ±¾°C over a full -55 to +150°C temperature range.. It can
be used with single power supplies, or with plus and minus supplies. As it draws only 60 µA
from its supply, it has very low self-heating, less than 0.1°C in still air. The LM35 is rated to
operate over a -55° to +150°C temperature range. The LM35 series is available packaged in
hermetic TO-46 transistor packages
The Heart Beat Sensor provides a simple way to study the heart's function. This sensor monitors
the flow of blood through Finger. As the heart forces blood through the blood vessels in the
Finger, the amount of blood in the Finger changes with time. The sensor shines a light lobe
(small High Bright LED) through the ear and measures the light that is transmitted to LDR. The
signal is amplified, inverted and filtered, in the Circuit.
The liquid crystal display controller and driver LSI displays alphanumeric, Japanese kana
characters, and symbols. It can be configured to drive a dot-matrix liquid crystal display
under the control of a 4- or 8-bit microprocessor. Since all the functions such as display
RAM, character generator, and liquid crystal driver, required for driving a dot-matrix
liquid crystal display are internally provided on one chip, a minimal system can be
interfaced with this controller/driver. A 2X16 can display up to one 8-character line or two 8-
character lines. Below is a typical LCD display.
Fig3.6LCD display
The LCD will display the body temperature and hear rate.
Global system for mobile communication (GSM) is a globally accepted standard for digital
cellular communication. GSM is the name of a standardization group established in 1982 to
create a common European mobile telephone standard that would system operates at 900 MHz.
This is an international standard for mobile communication which in full is Global System for
Mobile communications. It also referred to as 2G, which is second generation cellular network.
GSM supports outgoing and incoming voice calls, Simple Message System, and data
communication via GPRS among others. The Arduino GSM shield is actually a GSM modem. In
the eyes of a mobile operator, the Arduino GSM shield looks just like a mobile phone while from
Arduino perspective, the Arduino GSM shield looks just like a modem.
The heart of the GSM network includes the following systems to operate wireless services:
GSM is a cellular network, which means that cell phones connect to it by searching for cells in
the immediate vicinity. There are five different cell sizes in a GSM network—macro, micro,
pico, femto, and umbrella cells. The coverage area of each cell varies according to the
implementation environment. Macro cells can be regarded as cells where the base station antenna
is installed on a mast or a building above average rooftop level. Micro cells are cells whose
antenna height is under average rooftop level; they are typically used in urban areas. Picocells
are small cells whose coverage diameter is a few dozen meters; they are mainly used indoors.
Femto cells are cells designed for use in residential or small business environments and connect
to the service provider’s network via a broadband internet connection. Umbrella cells are used to
cover shadowed regions of smaller cells and fill in gaps in coverage between those cells.
Cell horizontal radius varies depending on antenna height, antenna gain, and propagation
conditions from a couple of hundred meters to several tens of kilometers. The longest distance
the GSM specification supports in practical use is 35 kilometers (22 mi). There are also several
implementations of the concept of an extended cell, where the cell radius could be double or
even more, depending on the antenna system, the type of terrain, and the timing advance.
Indoor coverage is also supported by GSM and may be achieved by using an indoor Pico cells
base station, or an indoor repeater with distributed indoor antennas fed through power splitters,
to deliver the radio signals from an antenna outdoors to the separate indoor distributed antenna
system. These are typically deployed when significant call capacity is needed indoors, like in
shopping centers or airports. However, this is not a prerequisite, since indoor coverage is also
provided by in-building penetration of the radio signals from any nearby cell.
GSM networks operate in a number of different carrier frequency ranges (separated into GSM
frequency ranges for 2G and UMTS frequency bands for 3G), with most 2GGSM networks
operating in the 900 MHz or 1800 MHz bands. Where these bands were already allocated, the
850 MHz and 1900 MHz bands were used instead (for example in Canada and the United
States). In rare cases the 400 and 450 MHz frequency bands are assigned in some countries
because they were previously used for first-generation systems.
Most 3Gnetworks in Europe operate in the 2100 MHz frequency band. Regardless of the
frequency selected by an operator, it is divided into time slots for individual phones. This allows
eight full-rate or sixteen half-rate speech channels per radio frequency. These eight radio
timeslots (or burst periods) are grouped into a TDMA frame. Half-rate channels use alternate
frames in the same timeslot. The channel data rate for all 8 channels is 270.833 Kbit/s, and the
frame duration is 4.615 ms.
The transmission power in the handset is limited to a maximum of 2 watts in GSM 850/900and 1
watt in GSM 1800/1900.
One of the key features of GSM is the Subscriber Identity Module, commonly known as a SIM
card. The SIM is a detachable smart card containing the user's subscription information and
phone book. This allows the user to retain his or her information after switching handsets.
Alternatively, the user can also change operators while retaining the handset simply by changing
the SIM. Some operators will block this by allowing the phone to use only a single SIM, or only
a SIM issued by them; this practice is known as SIM locking.
Short message service is a mechanism of delivery of short messages over the mobile networks. It
is a store and forward way of transmitting messages to and from mobiles. The message (text
only) from the sending mobile is stored in a central short message center (SMC) which then
forwards it to the destination mobile. This means that in the case that the recipient is not
available; the short message is stored and can be sent later. Each short message can be no longer
than 160 characters. These characters can be text (alphanumeric) or binary Non-Text Short
messages. An interesting feature of SMS is return receipts. This means that the sender, if wishes,
can get a small message notifying if the short message was delivered to the intended recipient.
Since SMS used signaling channel as opposed to dedicated channels, these messages can be
sent/received simultaneously with the voice/data/fax service over a GSM network. SMS supports
national and international roaming. This means that we can send short messages to any other
GSM mobile user around the world. With the PCS networks based on all the three technologies,
GSM, CDMA and TDMA supporting SMS, SMS is more or less a universal mobile data service.
GSM (Global System for Mobile Communication) is the most popular mobile communication
system around the world dominating over 90% of the total mobile communication market. GSM
service provider offers various types of services, which includes three main services and they are
voice call, short message service (SMS) and internet. GSM services can be gained by using a
mobile phone and GSM modem.
For our project we have used SMS as our remote monitoring feature for a user. In below we have
described the steps how we implemented the GSM network, in our project:
In our project, the microcontroller collects and analyzes the information from the sensors.
Then the microcontroller converts that information into a string of data to form a SMS.
Next the microcontroller sends a destination number to the GSM modem, to set
destination for the SMS.
Then the microcontroller transmits the SMS to the GSM modem.
By using the GSM network’s SMS gateway, GSM modem sends the SMS to the
destination.
The Arduino GSM shield allows an Arduino board to connect to the internet, send and receive
SMS, and make voice calls using the GSM library
The Arduino GSM Shield allows an Arduino board to connect to the internet, make and receive
voice calls and send and receive SMS messages. The shield uses a radio modem M10 by
Quectel. It is possible to communicate with the board using AT commands. The GSM library has
a large number of methods for communication with the shield. The shield uses digital pins 2 and
3 for software serial communication with the M10. Pin 2 is connected to the M10’s TX pin and
pin 3 to its RX pin. The M10 is a Quad-band GSM/GPRS modem that works at frequencies
GSM850MHz, GSM900MHz, DCS1800MHz and PCS1900MHz. It supports TCP/UDP and
HTTP protocols through a GPRS connection. GPRS data downlink and uplink transfer speed
maximum is 85.6 kbps. To interface with the cellular network; the board requires a SIM card
provided by a network operator. A SIM card is inserted into the holder.
To upload sketches to the board, it is connected to my computer with a USB cable and uploads
my sketch with the Arduino IDE. Once the sketch has been uploaded, the board disconnected
from the computer and it is then powered on an external power supply.
This sketch will check the modem's IMEI number. This number is unique to each modem, and is
used to identify valid devices that can connect to a GSM network. Once the number has been
read from the modem, the Arduino will print out the network carrier it is connected to and the
signal strength of the network over the serial port. Various codes are then used to enable the
GSM capabilities such as calls, sms among others.
3.2.11 AT Command
1. AT
According to syntax rule 1every ―AT‖ command should begin with ―AT‖ including the double
quotes. The AT command is used for testing the GSM modem weather it is working or not. This
command is also used for the calling attention of the modem before every other command.
2. AT+CMGF=1
―AT+CMGF=1‖ command is used for configuring the modem into text SMS mode.
3. AT+CMGS=
―AT+CMGS=‖ command is used to set the destination number for the SMS.
CHAPTER-4
DESIGN ANALYSIS
4. Introduction
This chapter states the overall system methodology of the project, flow chart, software design,
system algorithm, circuit diagram with description and hard ware design of the project.
This chapter describes the method which will be used to implement this project. The purpose of
the project is to develop patient monitoring system based Arduino and GSM modem. The
sensors are connected to microcontroller (Arduino). Microcontroller converts the analog input
into digital signal and analyzes, then takes actions to accordance.
To complete this project we divide its content into two main parts which are hardware design and
software design. The project’s systematic flow chart and explanation of work are given below:
START
Buzzer is OFF
IS Body Temp
NO &Heart Beat
exceeds?
YES
Buzzer turns ON
STOP
else
Stop buzzer, display heart beat value and ―your heartbeat is normal‖.
Step 23: Stop
Go to sketch and then by using export compiled binary, load the source code to Proteus
software and test whether the code and circuit diagram is match.
Uploading the written code from Arduino library to the physical Arduino for hardware
design by USB cable.
4.3.1Software requirement component
Proteus 8.1,
Arduino software
Proteus 8.1
Proteus 8.1is software for microprocessor based embedded system design and simulation,
schematic capture and PCB layout design. It is developed by Lab center Electronics Ltd.
England.
Arduino software
Arduino software is software for written the source code for design circuit based Arduino.
4.5Hardware design
Connect the circuit designed on the Proteus software in the project board properly and give
required supply for, then upload the written source code from Arduino library to the physical
Arduino by using USB cable. Then when system gets supply and sensor input it start process.
CHAPTER 5
RESULTS AND DISCUSSIONS
5. Introduction
Results and Discussions show all the outputs of the project done. Therefore; this Chapter states
all the results and also discussions of project. The main points concerned in this chapter are
simulation result, hardware result, and finally all about the results and discussions made in the
experiment of this project.
In the first step, we sense the heart rate and body temperature using respective sensors.
Then, convert the analog data to digital using on chip ADC and compare the sensor values with
the reference value using microcontroller. Next step is to send message through GSM to
mentioned mobile number if the sensed value if found to be abnormal as well as display the
message on LCD.
Circuit of patient monitoring using GSM is shown above, which contains arduino Uno, heart beat
sensor, temperature sensor, GSM module, buzzer and LCD. Arduino controls whole the process
of system like reading pulses from heart beat sensor and body temperature from temperature
sensor, calculating heart rate and body temperature and compare this values with predefined
value and sending this data to LCD and also sending message to authorized person with given
condition.
Temperature sensor input pin is directly connected to pin 15 of Arduino whenever heart beat
sensor input pin is directly connected to pin 10 of Arduino. Buzzer which is output pin is
connected through transistor to pin 13 of Arduino. A 16X2 LCD is connected with Arduino pin
12, GND and 11. And data pin D4-D7 is connected to pin 5, 4, 3, and 2 of Arduino. And GSM
modem is connected to pin 0 and 1 for send sms through AT-command getting from Arduino.
5.2.1Discussion of hardware
Different sensors are connected to the patient’s body at appropriate positions to collect
real time data about his health.
These data are then compared to standard threshold values to check if the patient is in
normal condition.
Accordingly, the information about the patient and standard threshold value comparison
is made by microcontroller (Arduino Uno) and then takes necessary action based written
code.
Continuous monitoring of health parameters of the patient is being achieved by wireless
transmission of sensors output.
In case of any emergency condition, an alarm is also sent to the doctor’s mobile in the
form of a SMS alert, through GSM modem describing that immediate visit is required by
the doctor.
There are different types of health equipment in the market but there is no such device as ours in
country. In developed countries there are few health monitoring devices which are very
expensive. Our purpose is to make a device which is suitable for developing countries. To build
the device we used Arduino Uno, LM35 temperature sensor and GSM module SIM900A. Total
cost will be around 2,000 to 2,500 Ethiopian birr. For our device the cost was nearly 1900 birr.
Table below shows component we used for implement this project and their regarding price.
CHAPTER -6
6.1. Conclusion
Remote patient monitoring system using GSM has a strong appeal because it provides a flexible
monitoring service over any distance.
In this project, Arduino is interfaced with a GSM modem and two sensors (temperature &
heartbeat). Temperature and Heartbeat sensor constantly feed information about the personal
status (body temperature and heartbeat rate) to the microcontroller. Then microcontroller convert
those analog data into digital data with the help of built in ADC module and process them and
show on a LCD display. If a certain level of temperature (37C) and heartbeat per minute (72
BPM) is crossed, microcontroller turns ON the buzzer. Also sends the warning message to a
predefined cell phone number.
The resulting system operates in real time. Especially for disabled person, whose who cannot
express their filing or cannot communicate with other person and for elder person it is an option
less system and also it helps them properly. Also the system operation is cost effective.
“To get rich never risk your health. For it is the truth that health is the wealth of wealth.”
~ Richard Baker
There were various technical limitations that the designing of remote patient monitoring system
using GSM. For the groups that continue this design of remote patient monitoring system using
GSM in future years, the following technical considerations may be implemented:
6.3 Recommendations
The department of Electrical and computer engineering should prepare all the materials
of the projects that were needed for their students on time.
Electrical and Computer engineering department should change the time of selection of
project title from Starting of second semester to first semester of final year.
The department of Electrical and computer engineering should test selected title and
available materials before title is approved.
The department of Electrical and computer engineering should also consider advisor
experience and student knowledge before title is given for both of them.
Project coordinator should more focus on problem solver title with low cost when he/she
select title.
The institute also gives more attention on the technical teaching parameter likes to
provide laboratory class and material needed and more experience lab assistance.
References
[1] www.ti.com―Texas instruments LM35 integrated temperature sensor data sheet‖ 2014.
[3] Wan Seri Bahiyah Binti w Sudin Patient monitoring system using wireless sensor network
[4] Banja Wendy Lauren Akoth Home patient monitoring based on bell alarm.
[5] Purnima, Puneet Singh ―Zigbee and GSM Based Patient Health Monitoring System‖ 2014
Appendixes
Appendix 1:- Final simulation circuit for patient monitoring system using GSM
Appendix 2:‐ Source code for patient monitoring system using GSM
#include<SoftwareSerial.h>
#include<LiquidCrystal.h>
LiquidCrystal lcd(12,11,7,6,5,4);
SoftwareSerial mySerial(2,3);
#define buzzer 13
#define Sensor 15
#define SensorPin 10
float temp_read;
float Sensorvalue=0;
float Temp_val;
float heartrate;
int heartrate_Set=0;
int BodyTemp_Set=0;
int count=9;
int sec=0;
unsigned starttime=0;
void setup()
{
pinMode(Sensor,INPUT);
pinMode(SensorPin,INPUT);
pinMode(buzzer,OUTPUT);
lcd.begin(16,2);
delay(50);
lcd.setCursor(0,0);
lcd.print("WELCOME 2 OUR -");
lcd.setCursor(0,1);
lcd.print("PROPOSED SYSTEM");
delay(500);
lcd.clear();
digitalWrite(buzzer,LOW);
mySerial.begin(9600);
while(buzzer==HIGH)
if(sec < 100)
{
if(buzzer==LOW){buzzer==HIGH;}
else{buzzer==LOW;}
delay(5);
sec++;
}
else if(sec > 200)
{
sec++;
}
else{sec=0;}
}
void loop()
{
if(mySerial.available()>0)
{
Serial.write(mySerial.read());
}
CheckBodyTemp();
CheckHeartBeat();
}
void CheckBodyTemp()
{
lcd.setCursor(0,0);
lcd.print("BODYTEMP Scan-ON");
delay(500);
lcd.clear();
Temp_val=CheckTemp();
if(Temp_val>37)
{
SetAlert();
}
else{
lcd.setCursor(0,0);
lcd.print( Temp_val );
lcd.setCursor(0,1);
lcd.print(" IS NORMAL");
delay(500);
lcd.clear();
}
float CheckTemp()
{
temp_read=analogRead(Sensor);
temp_read=temp_read*5;
temp_read=temp_read/10;
return temp_read;
}
void CheckHeartBeat()
{
lcd.setCursor(0,0);
lcd.print(" heartrate ");
lcd.setCursor(0,1);
lcd.print(" Scan-ON ");
delay(500);
lcd.clear();
heartrate=CheckBPM();
if(heartrate>72)
{
SetAlert2();
}
else{
lcd.setCursor(0,0);
lcd.print( heartrate );
lcd.setCursor(0,1);
lcd.print(" VALUE NORMAL ");
delay(100);
lcd.clear();
}
}
float CheckBPM()
{
starttime=millis();
while(millis()<starttime+10000)
{
Sensorvalue=analogRead(SensorPin);
count++;
heartrate=count*6;
return heartrate;
}
}
void SetAlert()
{
digitalWrite(buzzer,HIGH);
SendTextMessage();
BodyTemp_Set=1;
lcd.setCursor(0,0);
lcd.print(Temp_val );
lcd.setCursor(0,1);
lcd.print(" ABNORMAL ");
delay(700);
lcd.clear();
digitalWrite(buzzer,LOW);
}
void SetAlert2()
{
digitalWrite(buzzer,HIGH);
SendTextMessage1();
heartrate_Set=1;
lcd.setCursor(0,0);
lcd.print(heartrate);
lcd.setCursor(0,1);
lcd.print("ABNORMAL !");
delay(700);
lcd.clear();
digitalWrite(buzzer,LOW);
}
void SendTextMessage()
{
mySerial.begin(9600);
Serial.begin(9600);
mySerial.println("AT+CMGF=1");
delay(100);
mySerial.println("AT+CMGS=\"+251920024393\"");
delay(10);
mySerial.println("MY BODY TEMP EXCED SAFE ME!please ");
delay(1000);
mySerial.println((char)26);
delay(1000);
//SendTextMessage();
}
void SendTextMessage1()
{
mySerial.begin(9600);
Serial.begin(9600);
mySerial.println("AT+CMGF=1");
delay(10);
mySerial.println("AT+CMGS=\"+251920024393\"");
delay(10);
lcd.clear();
mySerial.println("MY HEARTBEAT EXCED! SAFE ME!please");
delay(1000);
mySerial.println((char)26);
delay(1000);
//SendTextMessage();