Circuit Health
Circuit Health
Abstract........................................................................................................................................................ 3
Acknowledgement ....................................................................................................................................... 4
Chapter 1 ..................................................................................................................................................... 5
Introduction ............................................................................................................................................. 5
Objective .................................................................................................................................................. 6
Motivation ............................................................................................................................................. 6
Project Outline ...................................................................................................................................... 7
Chapter-2 ..................................................................................................................................................... 8
Literature Review ....................................................................................................................................... 8
2.1 Concept .............................................................................................................................................. 8
Block Diagram......................................................................................................................................... 9
2.2 Related Works ................................................................................................................................... 9
2.3 Thesis Contribution ........................................................................................................................ 10
Chapter-3 ................................................................................................................................................... 11
Methodology and Implementation .......................................................................................................... 11
3.1 Hardware ......................................................................................................................................... 11
Arduino Micro Controller ................................................................................................................... 11
Temperature and Humidity Sensor ..................................................................................................... 12
Pulse Sensor ........................................................................................................................................ 12
Wi-Fi Module...................................................................................................................................... 13
3.2 Circuit Connection .......................................................................................................................... 14
3.2.1 Wi-Fi Module............................................................................................................................. 14
3.2.2 Pulse Sensor ............................................................................................................................... 15
3.2.3 Temperature and Humidity Sensor ...........................................................................................15
Complete Block Diagram ......................................................................................................................... 17
3.3 Data Collection .............................................................................................................................18
3.4 Data Storage .................................................................................................................................... 18
3.5 ThinkSpeak...................................................................................................................................... 19
3.6 Steps of Implementation ................................................................................................................. 19
3.7 Implementation ............................................................................................................................... 20
1
3.7.1 Individual data collection ........................................................................................................... 20
3.7.2. Sending data to Thinkspeak ...................................................................................................... 21
Basic Codes of Esp-8266 ....................................................................................................................... 22
Modified pseudo code for temperature sensor .................................................................................... 22
Modified pseudo code for pulse sensor ............................................................................................... 23
Use Case Diagram ..................................................................................................................................... 25
Actors ..................................................................................................................................................... 25
Use cases................................................................................................................................................. 25
Data Retrieval............................................................................................................................................ 26
Chapter-4 ................................................................................................................................................... 27
Result and Discussion ............................................................................................................................... 27
Result Display ........................................................................................................................................ 27
Temperature graph .............................................................................................................................. 28
Pulse Rate Graph................................................................................................................................. 28
Panic button ........................................................................................................................................ 29
Google Sheet Database .......................................................................................................................29
Serial Monitor Output .........................................................................................................................30
Reaction display .................................................................................................................................... 31
Cost Analysis ......................................................................................................................................... 34
Chapter-5 ................................................................................................................................................... 35
Conclusion ................................................................................................................................................. 35
5.1 Challenges ........................................................................................................................................ 35
ESP-8266 WiFi Module ......................................................................................................................35
Pulse Sensor ........................................................................................................................................35
Data Analysis and React .....................................................................................................................35
5.2 Future works ................................................................................................................................... 35
Complete Code of Project......................................................................................................................... 36
References .................................................................................................................................................. 44
2
Table of Figures
3
Abstract
With an improvement in technology and miniaturization of sensors, there have been attempts to
utilize the new technology in various areas to improve the quality of human life. One main area
of research that has seen an adoption of the technology is the healthcare sector. The people in
need of healthcare services find it very expensive this is particularly true in developing countries.
As a result, this project is an attempt to solve a healthcare problem currently society is facing.
The main objective of the project was to design a remote healthcare system. It’s comprised of
three main parts. The first part being, detection of patient’s vitals using sensors, second for
sending data to cloud storage and the last part was providing the detected data for remote
viewing. Remote viewing of the data enables a doctor or guardian to monitor a patient’s health
progress away from hospital premises.
The Internet of Things (IoT) concepts have been widely used to interconnect the available
medical resources and offer smart, reliable, and effective healthcare service to the patients.
Health monitoring for active and assisted living is one of the paradigms that can use the IoT
advantages to improve the patient’s lifestyle. In this project, I have presented an IoT architecture
customized for healthcare applications. The aim of the project was to come up with a Remote
Health Monitoring System that can be made with locally available sensors with a view to making
it affordable if it were to be mass produced.
Hence the proposed architecture collects the sensor data through Arduino microcontroller and
relays it to the cloud where it is processed and analyzed for remote viewing. Feedback actions
based on the analyzed data can be sent back to the doctor or guardian through Email and/or SMS
alerts in case of any emergencies.
4
Acknowledgement
Firstly, we would like to thank the Almighty for giving us the opportunity, perseverance,
determination and intellect to complete this project.
A big and warm gratitude goes to our supervisor Mr.Romil Rawat for helping us all the way to
complete our task successfully in time. He always pushed us to the edge, gave us healthy
challenges and helped us through our thick and thins. It was a pleasure working under his
guidance and supervision.
Finally, we would like to thank all the faculty members of the Department of Computer Science
and Engineering of Shri Vaishnav Vidyapeeth Vishwavidyalaya from whom we have gained
knowledge and assistance to complete our thesis work.
5
Chapter 1
Introduction
In the introduction part we will discuss what is Internet of things all about. How important
Health Monitoring is in modern era of health care. And more importantly, why IOT should be
integrated to health monitoring to improve the quality of service in health care sector? In the later
parts we will discuss how we implemented the system.
Introduction
The term “Internet of Things” is considered to be first coined in the starting of this century when
work was done on MIT Auto-ID Center to make a smart identification technology which will
help to reduce the error rate subsequently increasing efficiency and to automate. But since then,
the concept of IOT has evolved rapidly in various ways, as now with the help of this huge
number small networks which can remain connected to each other and can directly send data to
the main network without any human interaction.
Quality of service in healthcare has always been under constant criticism in the modern era, as it
is a very touchy subject. Health monitoring specially for elderly people is a concern and as most
people in the modern times are job holders and have so hectic life. It is difficult to manage to
keep a constant watch on the elderly of the house. Keeping a nurse or housekeeper is also a very
costly issue nowadays. In this situation, remote health monitoring based on IOT can help to solve
the problem.
IOT is providing the means by which it is possible to collect and analyze data remotely without
any human interaction. So, this indicates that it is possible to detect and prevent any future
hazard with precision and possible to aware the concerning authority like the family member or
the physician if there is any alarming situation. The basic two reasons IOT is important for this
project is firstly it is automated, so no human interaction is needed. And secondly, because of
automation the process have less chance of having errors i.e. having a more efficient system
indicating a better quality in service.
In this paper we would describe how we collected and analyzed data using Thinkspeak server.
Also how it was possible to monitor all the collected data from Thinkspeak server. Lastly, how
we made reaction panel to cope if any alarming situation is looming in future so it can be
preventable.
6
Objective
Making an automated system which will help to monitor host remotely is our
primary objective
Making an alarm or reaction system which will react whenever there is an
alarming situation.
Providing a way to remotely monitor the temperature, pulse, counting the bowel
discharge in a day and also the mount of sleep of the patient via Thinkspeak.
Sending alarming messages via e-mail to the concerning authority or people if any
abnormality is detected.
Contributing in the field of IOT to pave a way for future project in the
technological development.
Motivation
The core to our motivation was to think ahead of our time and to make a contribution on
the sector Internet of Things (IOT) which is undoubtedly the next big thing on the
technological market. And IOT has proven itself to be a very handy possession. The idea
of this project came to us by observing how easy it is to connect or integrate the normal
home appliances with the internet. This led us to the secluded health sector which is still
lagging behind from other industries in terms of technology. We observed many case
even from our daily lives that in the hectic world we are living right now, it is difficult to
keep a watch over everything. Specially, to keep an eye on the elderly people is difficult
and costly as well. These real life situations gave us the ideas and motivation to integrate
the two sectors so that it helps in developing such a project which will create an
economic and efficient health monitoring system and will pave the way for future work
on the field of IOT.
7
Project Outline
Chapter-1: In this chapter we gave the introduction to our ideas for this project, the
motivation we got from and our objectives with this project.
Chapter-2: This chapter describes the literature review for this project. It discusses the
concept of this project, related and similar works done (if any) and how we differ from
them.
Chapter-4: This chapter gives a through view on the result that is obtained after the
analysis from the data.
Chapter-5: The conclusion is given in this chapter. Chapter-6: The references are given
in this chapter.
8
Chapter-2
Literature Review
This chapter discusses about the concept of the project we are trying to implement, what kind of
work has already been done on before and how we are different and more improved than those
projects.
2.1 Concept
The basic things that will be tried to be monitored in this research are pulse rate,
temperature, Humidity and panic button. The sensors used in the research will work in
following steps:
1. The sensors will send the data collected from the host in a regular basis after definite
span of time.
2. The data thus collected will undergo a comparison with the given threshold value to
the system.
3. If the data set concurs with the threshold value then the situation will be considered to
be normal thus the system will not take any further action
9
4. The data set thus retrieved if contains any abnormities, will then go for further
analysis to predict how serious the condition of the person is. And also send a
alarming message to concerning authoritie
Block Diagram
Some related findings used specific models for the health monitoring aspect. Like the
abstraction of Model Driven Tree Reference Model (MDTRM) , where they explained the
necessity of this model in the health field as well as identifying the complexities of the models.
They also benched marked the models which came really handy for the initial phase of this
research.
Some other related model we found are General Domain Model Architecture (GDMA),
the health monitoring and sensing with cloud processing was also a helpful source behind the
research, as it was useful for generating ideas to get raw data’s from wearable devices which are
10
compatible and capable of measuring many physical value which we can use to obtain
meaningful results.
Though, it is true that health monitoring and the prediction from anomalies as well as
giving a useful feedback to the use is neither a very easy process nor the framework a very easy
to set foot to. But, this research will take the health monitoring which now one of the most
exciting topics (related to IoT) to a very different level. The useful information gathered from the
research conducted has provided very handy to carry out and provide a workable model which
will be discussed in the next segment of the paper. Workable data is something which we had to
toil to obtain but the data’s were managed properly to continue the research.
Thus, most the related works done related to our project was highlighted in this segment
and how our research differs from those works were also explained thoroughly. Some of those
researches conducted really helped us understanding the importance of this sector and inspired to
go the extra-mile on this field. The platform monitoring the daily activities of the host will be
useful for the physician attending the host. The daily activities monitoring conducted by the
system will help the physician to develop a conclusion and prediction to diagnose the host in a
swift manner.
11
Chapter-3
Methodology and Implementation
This chapter discusses the hardware required for the project implementation, discusses with
figure the circuit connections and pseudo codes for the implementation.
3.1 Hardware
To conduct this project we need sensors so that we can monitor the health condition of the
elderly people. In order to do so, we chose four different criteria’s to monitor the elderly people.
The following criteria’s we chose are body temperature, humidity, pulse rate of the host.
12
Temperature and Humidity Sensor
Figure 3: DHT11
DHT11 Temperature & Humidity Sensor features a temperature & humidity sensor complex
with a calibrated digital signal output. By using the exclusive digital-signal-acquisition technique
and temperature & humidity sensing technology, it ensures high reliability and excellent long-
term stability. This sensor includes a resistive-type humidity measurement component and an
NTC temperature measurement component, and connects to a high performance 8-bit
microcontroller, offering excellent quality, fast response, anti-interference ability and cost-
effectiveness.
DHT11’s power supply is 3-5.5V DC. When power is supplied to the sensor, do not send any
instruction to the sensor in within one second in order to pass the unstable status. One capacitor
valued 100nF can be added between VDD and GND for power filtering.
13
Pulse Sensor
14
Wi-Fi Module
Figure 5: ESP8266
For the purpose of this project, we chose ESP-8266. The ESP8266 Wi-Fi Module is a
selfcontained SOC with integrated TCP/IP protocol stack that can give any
microcontroller for our case the Arduino access to Wi-Fi network. The ESP8266 is
capable of either hosting an application or offloading all Wi-Fi networking functions
from another application processor. Each ESP8266 module is pre-programmed with an
AT command set firmware, meaning, it can be simply connected with the Arduino device
and get about as much Wi-Fi-ability as a Wi-Fi Shield offers! The ESP8266 module is an
extremely cost effective board. The module helps to transmit the sensor data to
Thinkspeak cloud storage. It remains connected with the Arduino and connects with the
server via internet and sends the data to that server.
15
3.2 Circuit Connection
3.2.1 Wi-Fi Module
The ESP-8266 has eight ports, one of them is the power port which is used to supply
power to the module and this was connected with the Arduino’s 3.3v. ESP-8266 is very
sensitive to high power so it was not connected to the 5v power besides it works better at
3.3v. Another port of the ESP-8266 is the ground port which is connected with the
Arduino’s ground. ESP-8266 sends and receives data with 2 different ports these ports
are called TX and RX ports. ESP-8266’s TX port was connected with Arduino’s digital
port number 2 and ESP-8266’s Rx port was connected with Arduino’s digital port 3.
There is a reset port on the ESP-8266 which was not used as we did not need it, there is a
port called ch-pd on ESP-8266 which is connected to the Arduino’s 3.3v port. There are 2
GPIO ports on the ESP-8266, the GPIO1 is connected with the Arduino’s 3.3v and the
other port, GPIO0 is left unused.
16
3.2.2 Pulse Sensor
The pulse sensor has three pins; one of them is the VCC pin to power the pulse sensor as
usual. This pin is connected with Arduino’s 5v power supply.
There is also a ground pin in the pulse sensor which is connected with the Arduino’s
ground port. The other pin of the pulse sensor is the data pin. This pin sends analog data
to the Arduino so we had to attach this pin with the Arduino’s analog pin 0. This way the
Arduino will be converting the analog data to digital and we can avoid using an extra
analog to digital converter.
17
3.2.3 Temperature and Humidity Sensor
The DHT11 detects water vapor by measuring the electrical resistance between two
electrodes. The humidity sensing component is a moisture holding substrate with
electrodes applied to the surface. When water vapor is absorbed by the substrate, ions are
released by the substrate which increases the conductivity between the electrodes. The
change in resistance between the two electrodes is proportional to the relative humidity.
Higher relative humidity decreases the resistance between the electrodes, while lower
relative humidity increases the resistance between the electrodes.
18
Complete Block Diagram
Below are the connections:
Signal pin of pulse sensor A0 of arduino
Vcc pin of pulse sensor 5V of arduino
GND pin of pulse sensor GND of arduino
Vout of LM35 A1 of Arduino
Tx of ESP8266 pin 10 of arduino
Rx of ESP8266 pin 11 of arduino
CH_PD and Vcc of ESP8266 3.3 V of arduino
GND of ESP8266 GND of arduino
Push button digital pin 8 of Arduino
19
3.3 Data Collection
After we are done connecting all the hardware and the Arduino, we can collect data from
the sensors through the Arduino.
The temperature sensor is a small semi-circle hardware, to measure temperature the host
just has to put their finger on the temperature sensor and the sensor will gradually adapt
with the hosts temperature and take that data in the Arduino. The data that this sensor
collects is in Celsius format so we have to convert it to Fahrenheit format.
The pulse sensor is a small round, disc shaped hardware, it has a green light in middle of
the sensor, when the sensor receives power from the Arduino this green light will be lit.
To measure the pulse of the host, they simply have to put their finger on the green light
and the sensor will automatically send the pulse per minute data to the Arduino.
The pressure pad will be used to measure the sleep duration of the host. The pressure pad
will be kept under the pillow of the host, so whenever the host lie down on the pillow the
two separate part of the pressure pad would be connected so a high voltage will be
counted on the Arduino and the duration of this high voltage is considered as the duration
the host slept.
The sonar sensor was used to keep track of the host’s toilet schedule. It is very important
to measure if a person is having regular number of times that they need to visit the toilet.
The sonar sensor will be placed inside the toilet room so that whenever the host is using
the toilet the sonar sensor will detect his presence and count that to measure the number
of times they visit the toilet in a day to determine their health situation.
The data that were collected from the sensors through the Arduino should be stored
somewhere to analysis on those data. For that purpose Thinkspeak, a website that allows
storing data and analysis them is used in this thesis. The ESP-8266 is used for connecting
the Arduino with the internet and stores that necessary data’s to Thinkspeak server. The
ESP-8266 will receive data’s from the Arduino and with the help of a Wi-Fi connection,
the ESP-8266 will send the acquired data’s to Thinkspeak server.
For different data’s different types of channels are created in Thinkspeak. The
temperature of the host can be continuously uploaded to Thinkspeak with the ESP-
20
8266. From the temperature sensor, the temperature of the host will be saved at one
channel and also the highest temperature measured will be stored too. This way we can
alert the responsible person in terms of constant high temperature on the host.
Same goes for pulse sensor data’s, pressure pad’s data and the data collected from the
sonar sensor. All of these are being stored in the Thingspeak server to analyze.
3.5 ThinkSpeak
Thinkspeak is an open source IoT application and API. It helps to store and retrieve data
from things using the HTTP protocol all over the internet or from the local area network
(LAN). ioBridge launched Thinkspeak in 2010 to support IoT based application. It allows
its users to use MATLAB which they integrated to analyze and visualize the uploaded
data without purchasing the license. Thinkspeak was written in ruby, has a Cross-
Platform operating system and stores its data in cloud.
A user can have a free sign in Thinkspeak and after signing can open up unlimited
channel under that account. Each channel has different fields and in those fields data’s
are displayed in graphical forms. User can analyze the data according to the need using
the MATLAB. This manipulation of data is one of the most fascinating features of
Thinkspeak.
Another important feature of Thinkspeak is it provides a react option to its users. The
react option helps to give an instant reaction to the concerning authority whenever a
definite condition is fulfilled via social networking site Twitter and even e-mail as well.
This is one of the most unique features of Thinkspeak which helped us along the way to
complete the project.
5. Display the data’s to Doctors and concerning people for relative host.
21
6. Alarm the necessary person for abnormal health situation.
3.7 Implementation
After all the detail discussion about the hardware connections and introduction to
Thinkspeak, in this segment we are going to follow the above methodology to complete
the implementation of this thesis
The data collection from each node is done through simple Arduino codes. The
temperature sensor can measure the temperature of the surrounding. At first, the
temperature sensor gives only the room temperature. When the host directly touches the
sensor, it will gradually adjust with the host’s body temperature and that data is taken to
the Arduino. For temperature sensor the data obtained is in Celsius scale. We have
connected the pin 5 with arduino which shows the data. So, in the void loop section
retrieve that data into a variable “temperature” and then we print that variable in order to
see the temperature in the serial monitor .
In case of pulse sensor, there are 4 different tabs; the main tab we named is
PulseSensorAmpedArduino_1.5.0, All serial handling, Interrupt and Timer Interrupt
notes. In the main tab we collect the data from the analog zero or A0 pin. Whenever a
heartbeat is discovered in the loop of the first tab, then in the Serial handling tab, beats
per minute (BPM) and inter beat interval (IBI) is calculated. Then the print in the serial
monitor is done for all the three different values. The visual serial plotting is then done on
the second tab and we can see three different graphs for in the serial plotter . The
interrupt handles all the interrupt related issues which differs in different arduino board.
We selected the calculation necessary for Arduino Uno. Timer notes give the detail idea
of how interrupt works in arduino.
In case of sonar sensor, there are two speakers on the sonar sensors, these two speakers’
works individually. One of the speakers send ultrasonic sound wave directly forward
whenever the TRIG pin of the sensor receives data to send sound wave. This sound wave
will be reflected by any obstacle in front and return back to the sensor, now the sensor
will receive this wave with the second speaker. This wave data is put in an equation to
determine the distance between the sonar sensor and the obstacle.
In case of pressure pad we take the data from pin 7 and we have kept a count where
whenever we get a push in the pad will generate a 1 and no pressure will be indicated as
22
0. In the loop section, we gave the above condition to check for a continuous amount of
period.
23
Basic Codes of Esp-8266
Setup Method
Initialize Serial Baud //preferable 115200
If
Returns ok
Loop method
Sensor port request for Temperature data
If connected
Print ok
Return true
Else
Return false
24
Update Temperature method
Check connection.
Return error
Resend.
Initialize pins
Initialize SSID and Password
Initialize IP for connecting desired website.
Initialize the API key
Declare Variable
Setup Method
Initialize Serial Baud
If
Returns ok
Loop method
Use update beat method.
Print done
If connected
Print ok
Return true
25
Else
Return False
Return error
Resend.
Calculate IBI
Calculate BPM
Reset variables
26
Use Case Diagram
Actors:
The Actors of the system are Patient, Guardian and Doctor
Use cases:
I have identified a set of use cases based on the functionalities and goals of the
application.
• Login- This use case denotes a set of actions required for Subject to login into the application.
• Call Service- This use case denotes a set of actions required by doctor to call a guardian or
patient in case medical emergencies.
27
• Messaging Service- This use case denotes a set of actions required by Doctor to send a message
to subject’s guardian in case of emergencies.
Data Retrieval
We can retrieve raw data from Thinkspeak using an option provided in it called the
Export/Import Data. The updated data of the entire field in the corresponding channel can be
downloaded. The data which we can retrieve are provided in the .CSV format.
28
Chapter-4
Result and Discussion
In this segment after implementing the code we will discuss how it is displayed in the
Thinkspeak account of a user and how reaction or feedback is sent on the email and twitter.
The data’s we obtained after transmitting is saved in the cloud of Thinkspeak server and from
there with the help the features provided from Thinkspeak we are able to display data and
send alarming message.
Result Display
In the Thinkspeak server it takes 15 second delays for each data entry. The data entered
in the storage is then graphically portrayed in the display. The data entered in the storage
is channel and field specific. That means it will go the specific field of that channel that is
given by the user. For, convenience of the doctor of the elderly we opened a separate
channel for them. The patient who is under observation of that doctor is then placed on
different fields of that doctor’s channel. The following figure shows it:
29
the display is absolutely privacy protected. That is, the user can keep the channel open for
public viewing or it can be made private viewing for convenience.
After selecting the specified channel the user can see the following field of the host’s daily
updated graphs for monitoring.
Temperature graph
As we can that temperature of a random is shown below. Here the peak value which was
taken at an approximate time 2:40-2:50 PM GMT+6. The value shown here is seen to be
slowly getting saturated with the body temperature and showing the peak value at about 98
degree Fahrenheit.
30
Panic button
31
Serial Monitor Output
32
Reaction display
The reactions are displayed through the e-mail and social networking site Twitter. In
Thinkspeak we have a privilege of using react and ThinkHTTP option. The react
option works on channel and field specific. It requires the reference data of the host,
whenever the reference data is crossed a tweet or message on e-mail will be sent.
Tweet sending is relatively easy with react option of Thinkspeak but in order to send
an e-mail a third party website Push Inbox is used for out project. ThinkHTTP helps
to connect the react panel with the Push Inbox site. And then the message is then sent
to the desired e-mail address through Push Inbox site.
33
Figure 19 : React for Panic_SMS
34
Figure 21 : ThingHTTP for Panic_mail
35
Figure 23 : ThingHTTP for Google SpreadSheet
Cost Analysis
The only cost that was needed for our project was the hardware cost, on the other had
any other project that was conducted was needed more costly hardware with more
limited features, like the Masimo Radical-7 and Free Scale Home Health Hub
reference platform. So, it is safe to say that our project is more cost effective, with
more features.
36
Chapter-5
Conclusion
Our main objective in this project was to successfully monitor the basic four criteria’s namely
temperature, pulse, using of toilet and sleep and react during emergency situation without any
human interaction. We wanted to make a mark on the field of IoT with the health sector. With
the rise of IoT, the era of technology is moving towards a far superior dimension. In order to
keep pace with the new technologies, this project can sure make way for the advancement in this
sector. Though our model is tested and implemented, it will be difficult to continue the project
without superior quality hardware support along with a lot of new integration. The real benefit of
this work can only be fully realized when it can be implemented in full scale.
5.1 Challenges
There are three basic challenges we face during the project implementation.
Pulse Sensor
The data that is retrieved from the pulse sensor can give some error reading sometimes. Due to
unavailability of better pulse sensor in our country we had to order it from USA. And the data
comparison of the local and foreign sensor was noticeable. This delayed our implementation of
the project in some ways as pulse sensor is an integral part of this project.
Our project can be considered as platform to develop in the field of IoT on the health sector. In
developing countries like ours, this kind of innovative and cost effective project can improve the
37
future of technology. So, we are looking forward to implement the project in order to make an
impact in the new era of technology.
#include "dht.h"
#include <SoftwareSerial.h>
#include "Timer.h"
Timer t;
PulseSensorPlayground pulseSensor;
dht DHT;
SoftwareSerial esp8266(10,11);
38
//set pin numbers
const int PulseWire = A0; // PulseSensor PURPLE WIRE connected to ANALOG PIN 0
const int LED13 = 13; // The on-board Arduino LED, close to PIN 13.
float myTemp;
int myBPM;
String BPM;
String temp;
String humud;
int error;
int panic;
int raw_myTemp;
float Voltage;
float tempC;
float hum ;
float temper;
void setup()
Serial.begin(9600);
39
pinMode(buttonPin, INPUT); //initialize the pushbutton pin as an output
esp8266.begin(115200);
pulseSensor.analogInput(PulseWire);
pulseSensor.setThreshold(Threshold);
DHT.read11(dht_apin);
// Double-check the "pulseSensor" object was created and "began" seeing a signal.
if (pulseSensor.begin()) {
Serial.println("We created a pulseSensor Object !"); //This prints one time at Arduino power-
up, or on Arduino reset.
Serial.println("AT");
esp8266.println("AT");
delay(3000);
if(esp8266.find("OK"))
connectWiFi();
40
}
t.every(10000, updateInfo);
void loop()
panic_button();
start: //label
error=0;
t.update();
if (error==1)
delay(4000);
void updateInfo()
cmd += IP;
cmd += "\",80";
Serial.println(cmd);
41
esp8266.println(cmd);
delay(2000);
if(esp8266.find("Error"))
return;
cmd = msg ;
cmd += BPM;
cmd += temp;
cmd += "\r\n";
Serial.print("AT+CIPSEND=");
esp8266.print("AT+CIPSEND=");
Serial.println(cmd.length());
esp8266.println(cmd.length());
if(esp8266.find(">"))
Serial.print(cmd);
esp8266.print(cmd);
else
Serial.println("AT+CIPCLOSE");
esp8266.println("AT+CIPCLOSE");
42
//Resend...
error=1;
boolean connectWiFi()
Serial.println("AT+CWMODE=1");
esp8266.println("AT+CWMODE=1");
delay(2000);
String cmd="AT+CWJAP=\"";
cmd+=SSID;
cmd+="\",\"";
cmd+=PASS;
cmd+="\"";
Serial.println(cmd);
esp8266.println(cmd);
delay(5000);
if(esp8266.find("OK"))
return true;
else
return false;
43
}
void getReadings(){
Serial.print("temperature = ");
Serial.print(myTemp);
Serial.println(" F");
Serial.print("Humidity = ");
Serial.print(hum);
Serial.println(" %");
delay(20);
char buffer1[10];
char buffer2[10];
void panic_button(){
44
if (buttonState == HIGH) { //check if the pushbutton is pressed
else {
45
References
● “Arduino Architecture”
https://www.engineersgarage.com/what-is-gsm-gprs-module
● Alert services
https://ifttt.com/discover
46