Project Arduino Semi Final DOCSS

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

PROJECT: “HEARTBEAT AND BODY TEMPERATURE MONITORING USING

ARDUINO”
INTRODUCTION
According to World Health Organization (WHO), cardiovascular diseases (CVDs) are
the leading cause of death globally. CVDs killed roughly 17.9 million people in 2019,
accounting for 32% of all global deaths. Heart attacks and stroke accounted for 85% of these
deaths. Low- and middle-income nations account for more than 75% of CVD mortality. CVDs
were responsible for 38% of the 17 million premature deaths (under 70 years old) caused by
noncommunicable diseases in 2019. CVDs can be avoided by addressing behavioral risk
factors such as tobacco use, poor diet and obesity, inactivity, and excessive alcohol intake.
On the other hand, finding a way for individuals to monitor their heart rate would be
beneficial, as currently there is a problem with not having a solution for this issue. The
project aims to address this problem and find a solution. Heart rate is defined as the number
of heartbeats per unit of time, typically measured in beats per minute (bpm). The heart beats
to pump oxygen-rich blood to the muscles and carry cell waste products away from the
tissues. Medical professionals and athletes alike use heart rate monitors to monitor physical
conditions and training effectiveness. Body temperature is also an essential indicator of
health and is the measurement of the body's ability to regulate heat. The human body
maintains a safe temperature range despite external temperature variations. The “Heartbeat
and Body Temperature Monitoring” with Arduino project involves building a gadget that uses
sensors attached to an Arduino microcontroller board to measure a person's heart rate and
body temperature. The project is both useful and educational for students as it entails
creating a gadget that can measure a person's heart rate and body temperature by
connecting sensors to an Arduino microcontroller board. Understanding the various sensors
and components required to create the circuit and program the Arduino board is necessary
for this project. The project's sensors are critical in learning how to measure vital signs. The
project also involves experimenting with different ways to display the data collected by the
sensors, such as using an LCD screen or sending the data wirelessly to a computer.
Moreover, the project involved building a prototype heart rate and body temperature
monitoring system using Arduino. The prototype was designed to demonstrate the concept
and feasibility of the system. They utilized an Arduino microcontroller board and sensors to
measure heart rate and body temperature. The prototype could collect heart rate and body
temperature data, which was then displayed on an LCD screen. Although the prototype was
not a final product, it provided an excellent starting point for further development and
improvement. Overall, the prototype demonstrated the potential of using Arduino to build a
heart rate and body temperature monitoring system. It showed that with the right
components and programming, such a system could be developed and used for monitoring
vital signs.

OBJECTIVES
The objectives of the "Heartbeat and Body Temperature Monitoring Using Arduino"
project are to address the need for people to monitor their heart rate and body temperature,
to demonstrate the feasibility of building a monitoring system using Arduino, and to provide
an opportunity to showcase what the student have learned about sensors, circuits, and
programming.
 Develop a heart rate monitoring system using Arduino microcontroller board and
sensors.
 Measure heart rate and body temperature of a person using sensors attached to the
Arduino board.
 Display the collected data on an LCD screen.
 Experiment with different sensors and components required to create the circuit and
program the Arduino board.
 Understand the importance of monitoring vital signs for maintaining good health.
 Demonstrate the concept and feasibility of the heart rate and body temperature
monitoring system using a prototype built with Arduino.
 Provide a starting point for further development and improvement of the monitoring
system.

MATERIALS
Arduino UNO
Jumper Wire
16x2 LCD I2C
LM-35 Temperature
Pulse Sensor

PROCEDURES
A. Circuits/Diagram
B. Pictures

Testing and Building Project


Unboxing the Materials Prototype

Building the Project

The Project Output


C. Documentation

April 10-14, 2023


The group is still brainstorming on what will be their project title and output they will
be creating. They ordered the materials for the project and waiting for it to arrive to
start the construction of the project. The group decided that their project title will be
“Heartbeat and Body Temperature Monitor”

April 17-21, 2023


The materials of the project the group ordered last week does arrived and the
construction of the project began. They make sure that all the components were
working properly. They soldered some 16 header pins to the LCD to make it work.
The group followed the circuit prototype version of the project to test the components.
All the components were working.

April 24-28, 2023


The group faced a problem after the Arduino Uno board was not working properly
since it cannot be detected by any computers/laptops. Luckily, the leader sorted out
the issue and the construction of the project were done. They also created a box that
will serve as the house of the project to hide the connection and the Arduino Uno
board. The group also now working on the documentation/manuscript and
PowerPoint presentation.

D. Codes
1. #include <Wire.h>
2. #include <LiquidCrystal_I2C.h>
3.
4. LiquidCrystal_I2C lcd(0x27, 16, 2);
5. // Variables
6. int pulsePin = 0; // Pulse Sensor purple wire connected to analog pin 0
7. int blinkPin = 13; // pin to blink led at each beat
8. int fadePin = 8; // pin to do fancy classy fading blink at each beat
9. int fadeRate = 0; // used to fade LED on with PWM on fadePin
10. const int sensor = A1; // Assigning analog pin A1 to variable ‘sensor’
11. float tempc; //variable to store temperature in degree Celsius
12. float tempf; //variable to store temperature in Fahreinheit
13. float vout; //temporary variable to hold sensor reading
14. volatile int BPM; // int that holds raw Analog in 0. updated every 2mS
15. volatile int Signal; // holds the incoming raw data
16. volatile int IBI = 600; // int that holds the time interval between beats! Mustbe seeded!
17. volatile boolean Pulse = false; // “True” when User’s live heartbeat is detected. “False” when not a
“live beat”.
18. volatile boolean QS = false; // becomes true when Arduoino finds a beat.
19. // Regards Serial OutPut — Set This Up to your needs
20. static boolean serialVisual = true; // Set to ‘false’ by Default. Re-set to ‘true’ to see Arduino Serial
Monitor ASCII Visual Pulse
21. volatile int rate[10]; // array to hold last ten IBI values
22. volatile unsigned long sampleCounter = 0; // used to determine pulse timing
23. volatile unsigned long lastBeatTime = 0; // used to find IBI
24. volatile int P = 250; // used to find peak in pulse wave, seeded
25. volatile int T = 250; // used to find trough in pulse wave, seeded
26. volatile int thresh = 250; // used to find instant moment of heart beat, seeded
27. volatile int amp = 50; // used to hold amplitude of pulse waveform, seeded
28. volatile boolean firstBeat = true; // used to seed rate array so we startup with reasonable BPM
29. volatile boolean secondBeat = false; // used to seed rate array so we startup with reasonable BPM
30. void setup()
31. {
32. pinMode(blinkPin, OUTPUT); // pin that will blink to your heartbeat!
33. pinMode(fadePin, OUTPUT); // pin that will fade to your heartbeat!
34. Serial.begin(115200); // we agree to talk fast!
35. interruptSetup(); // sets up to read Pulse Sensor signal every 2mS
36. // IF YOU ARE POWERING The Pulse Sensor AT VOLTAGE LESS THAN THE BOARD
VOLTAGE
37. // UN-COMMENT THE NEXT LINE AND APPLY THAT VOLTAGE TO THE A-REF PIN
38. // analogReference(EXTERNAL);
39. pinMode(sensor, INPUT); // Configuring pin A1 as input
40. Serial.begin(9600);
41. }
42. // Where the Magic Happens
43.
44. void loop()
45. {
46. serialOutput();
47. if (QS == true) // A Heartbeat Was Found
48. {
49. // BPM and IBI have been Determined
50. // Quantified Self “QS” true when arduino finds a heartbeat
51. fadeRate = 255; // Makes the LED Fade Effect Happen, Set ‘fadeRate’ Variable to 255 to fade LED
with pulse
52. serialOutputWhenBeatHappens(); // A Beat Happened, Output that to serial.
53. QS = false; // reset the Quantified Self flag for next time
54. vout = analogRead(sensor);
55. vout = (vout * 500) / 1023;
56. tempc = vout; // Storing value in Degree Celsius
57. tempf = (vout * 1.8) + 32; // Converting to Fahrenheit
58. Serial.print("in DegreeC=");
59. Serial.print("\t");
60. Serial.print(tempc);
61. Serial.println();
62. Serial.print("in Fahrenheit=");
63. Serial.print("\t");
64. Serial.print(tempf);
65. Serial.println();
66. lcd.begin();
67. lcd.backlight();
68. lcd.print("temp in c:");
69. lcd.print(tempc);
70. delay(2000); //Delay of 1 second for ease of viewing
71. }
72. ledFadeToBeat(); // Makes the LED Fade Effect Happen
73. delay(20); // take a break
74. }
75.
76. void ledFadeToBeat()
77. {
78. fadeRate -= 15; // set LED fade value
79. fadeRate = constrain(fadeRate, 0, 255); // keep LED fade value from going into negative numbers!
80. analogWrite(fadePin, fadeRate); // fade LED
81. }
82.
83. void interruptSetup()
84. {
85. // Initializes Timer2 to throw an interrupt every 2mS.
86. TCCR2A = 0x02; // DISABLE PWM ON DIGITAL PINS 3 AND 11, AND GO INTO CTC MODE
87. TCCR2B = 0x06; // DON’T FORCE COMPARE, 256 PRESCALER
88. OCR2A = 0X7C; // SET THE TOP OF THE COUNT TO 124 FOR 500Hz SAMPLE RATE
89. TIMSK2 = 0x02; // ENABLE INTERRUPT ON MATCH BETWEEN TIMER2 AND OCR2A
90. sei(); // MAKE SURE GLOBAL INTERRUPTS ARE ENABLED
91. }
92.
93. void serialOutput()
94. { // Decide How To Output Serial.
95. if (serialVisual == true)
96. {
97. arduinoSerialMonitorVisual('-', Signal); // goes to function that makes Serial Monitor Visualizer
98. }
99. else {
100.
101.sendDataToSerial('S', Signal); // goes to sendDataToSerial function
102.}
103.}
104.
105.void serialOutputWhenBeatHappens()
106.{
107.if (serialVisual == true) // Code to Make the Serial Monitor Visualizer Work
108.{
109.Serial.print("*** Heart-Beat Happened ***"); //ASCII Art Madness
110.Serial.print("BPM: ");
111.Serial.println(BPM);
112.lcd.clear();
113.lcd.begin();
114.lcd.backlight();
115.lcd.print("BPM: ");
116.lcd.print(BPM);
117.}
118.else
119.{
120.sendDataToSerial('B', BPM); // send heart rate with a ‘B’ prefix
121.sendDataToSerial('Q', IBI); // send time between beats with a ‘Q’ prefix
122.}
123.}
124.
125.void arduinoSerialMonitorVisual(char symbol, int data)
126.{
127.const int sensorMin = 0; // sensor minimum, discovered through experiment
128.const int sensorMax = 1024; // sensor maximum, discovered through experiment
129.int sensorReading = data; // map the sensor range to a range of 12 options:
130.int range = map(sensorReading, sensorMin, sensorMax, 0, 11);
131.// do something different depending on the
132.// range value:
133.
134.switch (range)
135.{
136.case 0:
137.Serial.println(""); /////ASCII Art Madnessbreak;
138.case 1:
139.Serial.println(" — -");
140.break;
141.case 2:
142.Serial.println(" — — — ");
143.break;
144.case 3:
145.Serial.println(" — — — — -");
146.break;
147.case 4:
148.Serial.println(" — — — — — — ");
149.break;
150.case 5:
151.Serial.println(" — — — — — — — |-");
152.break;
153.case 6:
154.Serial.println(" — — — — — — — | — -");
155.break;
156.case 7:
157.Serial.println(" — — — — — — — | — — — -");
158.break;
159.case 8:
160.Serial.println(" — — — — — — — | — — — — — ");
161.break;
162.case 9:
163.Serial.println(" — — — — — — — | — — — — — — — — ");
164.break;
165.case 10:
166.Serial.println(" — — — — — — — | — — — — — — — — — -");
167.break;
168.case 11:
169.Serial.println(" — — — — — — — | — — — — — — — — — — — -");
170.break;
171.}
172.}
173.
174.void sendDataToSerial(char symbol, int data)
175.{
176.Serial.print(symbol);
177.Serial.println(data);
178.}
179.
180.ISR(TIMER2_COMPA_vect) //triggered when Timer2 counts to 124
181.{
182.cli(); // disable interrupts while we do this
183.Signal = analogRead(pulsePin); // read the Pulse Sensor
184.sampleCounter += 2; // keep track of the time in mS with this variable
185.
186.int N = sampleCounter - lastBeatTime; // monitor the time since the last beat to avoid noise
187.// find the peak and trough of the pulse wave
188.if (Signal < thresh && N > (IBI / 5) * 3) // avoid dichrotic noise by waiting 3/5 of last IBI
189.{
190.if (Signal < T) // T is the trough
191.{
192.T = Signal; // keep track of lowest point in pulse wave
193.}
194.}
195.
196.if (Signal > thresh && Signal > P)
197.{ // thresh condition helps avoid noise
198.P = Signal; // P is the peak
199.} // keep track of highest point in pulse wave
200.
201.// NOW IT’S TIME TO LOOK FOR THE HEARTBEAT
202.// signal surges up in value every time there is a pulse
203.
204.if (N > 250)
205.{ // avoid high frequency noise
206.if ((Signal > thresh) && (Pulse == false) && (N > (IBI / 5) * 3))
207.{
208.Pulse = true; // set the Pulse flag when we think there is a pulse
209.digitalWrite(blinkPin, HIGH); // turn on pin 13 LED
210.IBI = sampleCounter - lastBeatTime; // measure time between beats in mS
211.lastBeatTime = sampleCounter; // keep track of time for next pulse
212.
213.if (secondBeat)
214.{ // if this is the second beat, if secondBeat == TRUE
215.secondBeat = false; // clear secondBeat flag
216.for (int i = 0; i <= 9; i++) // seed the running total to get a realisitic BPM at startup
217.{
218.rate[i] = IBI;
219.}
220.}
221.
222.if (firstBeat) // if it’s the first time we found a beat, if firstBeat == TRUE
223.{
224.firstBeat = false; // clear firstBeat flagsecondBeat = true; // set the second beat flag
225.sei(); // enable interrupts again
226.return; // IBI value is unreliable so discard it
227.}
228.// keep a running total of the last 10 IBI values
229.
230.word runningTotal = 0; // clear the runningTotal variable
231.
232.for (int i = 0; i <= 8; i++)
233.{ // shift data in the rate array
234.rate[i] = rate[i + 1]; // and drop the oldest IBI value
235.runningTotal += rate[i]; // add up the 9 oldest IBI values
236.}
237.
238.rate[9] = IBI; // add the latest IBI to the rate array
239.runningTotal += rate[9]; // add the latest IBI to runningTotal
240.runningTotal /= 10; // average the last 10 IBI values
241.BPM = 60000 / runningTotal; // how many beats can fit into a minute? that’s BPM!
242.QS = true; // set Quantified Self flag
243.// QS FLAG IS NOT CLEARED INSIDE THIS ISR
244.}
245.}
246.
247.if (Signal < thresh && Pulse == true)
248.{ // when the values are going down, the beat is over
249.digitalWrite(blinkPin, LOW); // turn off pin 13 LED
250.Pulse = false; // reset the Pulse flag so we can do it again
251.amp = P - T; // get amplitude of the pulse wave
252.thresh = amp / 2 + T; // set thresh at 50% of the amplitude
253.P = thresh; // reset these for next time
254.T = thresh;
255.}
256.
257.if (N > 2500)
258.{ // if 2.5 seconds go by without a beat
259.thresh = 250; // set thresh default
260.P = 250; // set P default
261.T = 250; // set T default
262.lastBeatTime = sampleCounter; // bring the lastBeatTime up to date
263.firstBeat = true; // set these to avoid noise
264.secondBeat = false; // when we get the heartbeat back
265.}
266.sei(); // enable interrupts when youre done!
267.} // end is

EXPECTED OUTPUT
The expected output for the "Heartbeat and Body Temperature Monitoring Using
Arduino" project includes a functional monitoring system that can measure a person's heart
rate and body temperature using sensors connected to an Arduino board. The collected data
will be displayed in real-time on an LCD screen, allowing for easy monitoring and analysis.
The project will involve experimenting with different sensors and components required to
create the circuit and program the Arduino board and will provide an opportunity to
showcase the student's understanding of sensors, circuits, and programming. The project
will also increase understanding of the importance of monitoring vital signs for maintaining
good health. The prototype built with Arduino will demonstrate the concept and feasibility of
the heart rate and body temperature monitoring system, providing a starting point for further
development and improvement.

LIMITATIONS OF THE PROJECT


There may be various limitations to the "Heartbeat and Body Temperature Monitoring
Using Arduino" project, including:
1. Measurement accuracy: While the project's sensors are designed to measure
heart rate and body temperature, they may not produce entirely accurate data. This could be
due to variables such as sensor placement, signal interference, or sensor technological
limits.
2. Flexibility: The Arduino-based monitoring system may be limited in terms of the
number of individuals it can track at the same time. This could be an issue in circumstances
where large groups of people must be watched at the same time, such as healthcare or
research studies.
3. Connectivity: Because the Arduino board used in the project may lack built-in
wireless connectivity, the capacity to communicate data to other devices or systems may be
limited. If real-time data monitoring or remote data analysis is necessary, this could be an
issue.
4. Effectiveness: The monitoring system may experience hardware failures or
software mistakes, which may reduce its overall reliability over time. Regular maintenance
and testing may be required to ensure the system's proper operation.
5. User-friendliness: Users with no technical expertise may find it challenging to
operate or understand the monitoring system. This may limit its utility in situations where it
must be used by a diverse group of people.
LITERATURE CITED
Chawla, M. (2018, September 7). Heartbeat and Body Temperature Monitoring using
Arduino. Medium. https://medium.com/@chawlamahima76/heartbeat-and-body-temperature-
monitoring-using-arduino-cf0a339b50f
EngineersGarage. (n.d.). Arduino based heartbeat and body temperature monitoring
IoT device. Retrieved April 30, 2023, from https://www.engineersgarage.com/arduino-based-
heartbeat-and-body-temperature-monitoring-iot-device/

BUDGET IMPLEMENTATION
QTY UNIT DESCRIPTION COST TOTAL COST
1 pc Arduino Uno 649 699
40 pc Jumper Wire 65 65
1 pc 16x2 LCD 149 207
1 pc LM-35 Temperature 249 249
1 pc Pulse Sensor 187 187
Grand Total: Php1551.00

PERSONNEL REQUIREMENT
NAME PERCENT TIME DEVOTED RESPONSIBILITIES
TO THE PROJECT

→ Ordered the
components of the
project
→ Collected fund for the
Nino, Avryl Alexis 100% project
→ Started working on the
project and finished it
→ Created the PowerPoint
presentation
→ Unboxed the materials
→ Helped in doing the
Peralta, Kelvin 100% project
→ Created the manuscript
part of the project
→ Helped in doing the
Rullamas, Kristian
95% project
Andrei → Tested the components
→ Helped in doing the
project
Sanchez, Joshua Given 95% → Build the prototype of
the project

You might also like