Practical 14
Practical 14
Objective:
Students will design and simulate a heart rate monitoring system using a simulated sensor to detect the
heart rate. When the heart rate exceeds a predefined threshold, an alert will be triggered (simulated
with an LED or buzzer). This exercise introduces students to health monitoring systems and alert
mechanisms.
Requirements:
Step-by-Step Instructions:
Drag and drop the following components into the simulation workspace:
o Arduino Uno
o Connect the Heart Rate Sensor (simulated with a potentiometer) to an analog input pin
(e.g., pin A0).
o Connect the LED to a digital output pin (e.g., pin 9) and ground, with a resistor (220Ω) to
limit current.
o Connect the Buzzer to a digital pin (e.g., pin 10) and ground (optional).
cpp
CopyEdit
#define HEART_RATE_SENSOR_PIN A0 // Pin connected to the heart rate sensor (simulated with
potentiometer)
void setup() {
void loop() {
// Read the heart rate value from the sensor (simulated with potentiometer)
heartRateValue = analogRead(HEART_RATE_SENSOR_PIN);
int heartRate = map(heartRateValue, 0, 1023, 60, 150); // Mapping sensor value to heart rate range (60-
150 bpm)
// Print the heart rate value to the serial monitor for debugging
Serial.println(heartRate);
// Check if the heart rate exceeds the threshold and trigger an alert
} else {
The Heart Rate Sensor (simulated with a potentiometer) is used to read values that represent
heart rate fluctuations.
The value from the potentiometer is mapped to a range of heart rate values (e.g., 60–150 bpm).
If the heart rate exceeds the predefined threshold (e.g., 100 bpm), the system triggers an alert
by turning on an LED and activating a buzzer.
The Serial Monitor prints the current heart rate value for debugging.
Adjust the potentiometer to simulate changes in heart rate (e.g., slowly increase or decrease the
potentiometer value).
Observe the LED turning on and the buzzer sounding when the heart rate exceeds the threshold.
Verify that the system deactivates the alert when the heart rate goes back below the threshold.
Real-Time Monitoring:
Discuss how this system simulates a real-time health monitoring process. Real-world systems like
heart rate monitors or fitness trackers often use similar principles to measure and alert users
about potential health risks, such as tachycardia (rapid heart rate).
Threshold Adjustment:
Discuss how heart rate thresholds should be personalized depending on the individual’s health
status, age, or fitness level. For example, a threshold of 100 bpm may be high for some
individuals but normal for others.
Extensions:
Suggest possible extensions to the system:
o Use a real heart rate sensor (e.g., pulse sensor) instead of the potentiometer to read
actual heart rate values.
o Implement multiple thresholds for different alert levels (e.g., yellow alert for mild
elevation, red alert for dangerous heart rates).
o Implement an IoT solution where heart rate data can be sent to a smartphone or a web
application for real-time monitoring.
This exercise introduces students to health monitoring systems and teaches them how to handle real-
time sensor data. It can be further extended to simulate more complex medical devices or systems,
making it highly relevant for applications in health and fitness technology.