Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino UNO-Based Fall Detection and Heart Rate Monitoring System

Image of Arduino UNO-Based Fall Detection and Heart Rate Monitoring System

Circuit Documentation

Summary

This circuit is designed to monitor heart rate and detect falls using an MPU-6050 accelerometer and a heart pulse sensor. It includes an Arduino UNO microcontroller to process sensor data and control outputs such as a buzzer and an LED. The circuit is powered by the Arduino's 5V output and includes a resistor to limit current to the LED.

Component List

Arduino UNO

  • Microcontroller board based on the ATmega328P
  • It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button.

MPU-6050

  • A 6-axis motion tracking device that combines a 3-axis gyroscope and a 3-axis accelerometer.

Heart Pulse Sensor

  • A sensor used to detect the heartbeat rate of an individual.

Buzzer

  • An electromechanical component that can be used to make a beeping or alerting sound.

LED: Two Pin (red)

  • A basic red light-emitting diode used for indication purposes.

Resistor (1000 Ohms)

  • A passive two-terminal electrical component that implements electrical resistance as a circuit element.

Passive Buzzer

  • A type of buzzer that requires a specific frequency to make a sound.

Wiring Details

Arduino UNO

  • 5V connected to Heart Pulse Sensor VCC
  • GND connected to MPU-6050 GND, Heart Pulse Sensor GND, buzzer GND, and LED cathode (through Resistor)
  • A0 connected to Heart Pulse Sensor SIGNAL
  • A4 (SDA) connected to MPU-6050 SDA
  • A5 (SCL) connected to MPU-6050 SCL
  • D10 connected to buzzer PIN
  • D11 connected to LED anode

MPU-6050

  • VCC not connected
  • GND connected to Arduino UNO GND
  • SDA connected to Arduino UNO A4
  • SCL connected to Arduino UNO A5

Heart Pulse Sensor

  • VCC connected to Arduino UNO 5V
  • GND connected to Arduino UNO GND
  • SIGNAL connected to Arduino UNO A0

Buzzer

  • GND connected to Arduino UNO GND
  • PIN connected to Arduino UNO D10

LED: Two Pin (red)

  • anode connected to Arduino UNO D11
  • cathode connected to Arduino UNO GND (through Resistor)

Resistor (1000 Ohms)

  • pin1 not connected
  • pin2 connected to LED cathode

Documented Code

Arduino UNO Code

#include <Wire.h>
#include <MPU6050.h>

MPU6050 mpu;

const float FALL_THRESHOLD = 2.5;     // Fall detection acceleration threshold
const int buzzerPin = 10;             // Buzzer pin
const int ledPin = 11;                // LED pin
const int heartSensorPin = A0;        // Heart rate sensor pin
const int volume = 1;                 // Buzzer volume (PWM value)
const int heartRateThreshold = 60;    // Heart rate threshold (example: 60 BPM)
unsigned long lastFallTime = 0;       // Last fall detection time
const unsigned long debounceTime = 2000; // Debounce time of 2 seconds after fall detection

void setup() {
  Serial.begin(9600);
  Wire.begin();
  mpu.initialize();

  pinMode(buzzerPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  pinMode(heartSensorPin, INPUT);

  if (!mpu.testConnection()) {
    Serial.println("MPU6050 connection failed");
    while (1);
  }
}

void loop() {
  // Read sensor data
  int16_t ax, ay, az;
  mpu.getAcceleration(&ax, &ay, &az);

  // Convert acceleration to m/s² (1g ≈ 9.81m/s²)
  float accelX = ax / 16384.0 * 9.81;
  float accelY = ay / 16384.0 * 9.81;
  float accelZ = az / 16384.0 * 9.81;

  // Current time
  unsigned long currentTime = millis();

  // Fall detection
  if (accelZ < FALL_THRESHOLD && (accelX > 1 || accelY > 1)) {
    if (currentTime - lastFallTime > debounceTime) { // Check debounce time
      Serial.println("Fall detected!");

      // Turn on LED
      digitalWrite(ledPin, HIGH);
      delay(500);                   // Keep LED on for 0.5 seconds
      digitalWrite(ledPin, LOW);    // Turn off LED

      // Turn on buzzer with low sound
      analogWrite(buzzerPin, volume);
      delay(1000);                  // Buzzer on for 1 second
      analogWrite(buzzerPin, 0);    // Turn off buzzer

      lastFallTime = currentTime;   // Update last fall detection time
    }
  }

  // Measure heart rate
  int heartSignal = analogRead(heartSensorPin);
  float heartRate = map(heartSignal, 0, 1023, 0, 200); // Example mapping (may vary with sensor)

  // Print heart rate
  Serial.print("Heart Rate: ");
  Serial.print(heartRate);
  Serial.println(" BPM");

  // Warn if heart rate is below threshold
  if (heartRate < heartRateThreshold) {
    Serial.println("Low heart rate warning!");

    digitalWrite(ledPin, HIGH);        // Turn on LED
    analogWrite(buzzerPin, volume);    // Buzzer on with low sound
    delay(1000);                       // Buzzer on for 1 second
    digitalWrite(ledPin, LOW);         // Turn off LED
    analogWrite(buzzerPin, 0);         // Turn off buzzer
  }

  // Print acceleration values (for debugging)
  Serial.print("Accel X: ");
  Serial.print(accelX);
  Serial.print(" | Accel Y: ");
  Serial.print(accelY);
  Serial.print(" | Accel Z: ");
  Serial.println(accelZ);

  delay(500);  // Check interval (0.5 seconds)
}

MPU-6050 Code

void setup() {
  // Setup code here, to run once:

}

void loop() {
  // Main code here, to run repeatedly:

}

(Note: The MPU-6050 code provided is empty and does not contain any functional code. It is assumed that the MPU-6050 is being controlled by the Arduino UNO via the I2C interface, and its functionality is included in the Arduino UNO's code.)