Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shreyasmehta05/fallsafetech
Smart home system designed to detect falls and alert caregivers or emergency contacts using sensors and automated notifications
https://github.com/shreyasmehta05/fallsafetech
Last synced: 28 days ago
JSON representation
Smart home system designed to detect falls and alert caregivers or emergency contacts using sensors and automated notifications
- Host: GitHub
- URL: https://github.com/shreyasmehta05/fallsafetech
- Owner: shreyasMehta05
- Created: 2024-12-07T23:48:44.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-12-08T11:18:09.000Z (about 1 month ago)
- Last Synced: 2024-12-08T12:22:07.437Z (about 1 month ago)
- Language: Python
- Size: 9.31 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Smart Home System with Fall Detection and PIR-based Automatic Lighting π π‘
## Overview
This project involves creating a **smart home system** that utilizes sensors for **fall detection** and **automatic lighting control**. The system is powered by an `ESP32` microcontroller, and the data from the sensors is sent to `ThingSpeak` for real-time analysis.## Features
- **Automatic Lighting** (PIR Sensor) πΆββοΈπ‘
- **Fall Detection** (MPU 6050 Sensor) πββοΈπ₯
- **Data Logging and Visualization** on `ThingSpeak` π
- **Dashboard** for Real-time Monitoring π±## System Components
- **PIR Sensor**: Used for detecting motion and controlling lighting. πΆββοΈ
- **MPU 6050 Sensor**: Used for detecting falls by analyzing acceleration and angular velocity. πββοΈ## Directory Structure ποΈ
The project has the following directory structure:```bash
IoT Project/
βββ data.png
βββ data.txt
βββ Fall/
βββ IoT PPT.pptx
βββ Proposal_8.docx
βββ Proposal_8.pdf
βββ Run/
βββ sample.csv
βββ Smart-lighting-groupProject/
βββ Walk/
βββ Down/
βββ Up/
βββ fallDetection/
βββ latestcodeforbestcodetrying/
```### Subdirectories and their contents:
- **Fall/**: Contains data and code related to fall detection. πββοΈπ₯
- *Currently empty.*- **Run/**: Includes images, data files, and code related to the "running" scenario. πββοΈ
- `runFinal.png` - Final result of the run scenario πΌοΈ
- `run.png` - Initial results/plot for the run scenario πΌοΈ
- `run.py` - Python code for analysis π
- `running final.csv` - Data for the running scenario π
- **Walk/**: Contains images, data files, and code related to the "walking" scenario. πΆββοΈ
- `finalWalk.png` - Final result of the walk scenario πΌοΈ
- `walk.png` - Initial results/plot for the walk scenario πΌοΈ
- `walk.py` - Python code for analysis π
- `Walk_final.csv` - Data for the walking scenario π
- **Down/**: Includes data and code related to the "downward movement" scenario (e.g., descending stairs). β¬οΈ
- `down_final.png` - Final result of the down scenario πΌοΈ
- `down.png` - Initial results/plot for the down scenario πΌοΈ
- `down.py` - Python code for analysis π
- `stair_down final.csv` - Data for the downward movement scenario π
- **Up/**: Contains data and code related to the "upward movement" scenario (e.g., ascending stairs). β¬οΈ
- `up_final.png` - Final result of the up scenario πΌοΈ
- `up.png` - Initial results/plot for the up scenario πΌοΈ
- `up.py` - Python code for analysis π
- `stir_up final.csv` - Data for the upward movement scenario π
- **fallDetection/**: Contains the main `fallDetection.ino` file for the fall detection logic. β οΈ
- `fallDetection.ino` - Code for fall detection based on `MPU 6050` sensor data. π§- **latestcodeforbestcodetrying/**: Contains an `ino` file for testing and refining the fall detection code. π§
- `latestcodeforbestcodetrying.ino` - Refined fall detection code for better performance. βοΈ- **Smart-lighting-groupProject/**: This directory might contain collaborative documents or code for the lighting system. π‘
## Calibration and Implementation π§
### PIR Sensor (Automatic Lighting) π‘
1. **Calibration**:
- The `PIR sensor` was calibrated under different scenarios to determine the ideal cool-down time. A `2-second cool-down` was deemed ideal. β³
- Issues with false data due to external lighting were resolved by installing side plates on the sensor to prevent interference. π2. **Data Collection**:
- Data from the `PIR sensor` was initially collected and analyzed on `ThingSpeak`, adjusting the cool-down time accordingly.
- Once calibrated, the sensor readings were replaced by `LED status data`, sent to `ThingSpeak` for display. π‘π### Fall Detection (MPU 6050) πββοΈπ₯
1. **Sensor Setup**:
- The `MPU 6050` measures acceleration and angular velocity.
- Four different scenarios were defined to identify when a fall should **not** be considered:
- **State 0**: No heavy activity (idle, acceleration is almost null). ποΈ
- **State 1**: Heavy activity (e.g., walking, running). πββοΈ
- **State 2**: Ascending/descending stairs. π’
- **State 3**: Turning or bending over. π€ΈββοΈ2. **Data Collection**:
- Data from different scenarios were used to calculate the jerk value and thresholds. π
- `20,000 readings` were captured with the `ESP32` to set the threshold values for fall detection. π§
3. **Logic**:
- Based on the sensor data, thresholds for jerk, acceleration, and angular velocity were set. π
- The system uses a **state machine** that transitions between states based on sensor data, detecting falls if certain thresholds are exceeded. β οΈ## Research Papers π
As part of our research process, we **read relevant research papers** to understand fall detection and sensor calibration techniques. We then implemented one of these methodologies into our code base and further refined it based on our specific requirements and test results. π## Issues and Challenges β οΈ
1. **Hardcoding Thresholds**: The system uses fixed thresholds, which require manual updates whenever new data is collected. π§
2. **Cool-down Time**: The system has a `1-second delay`, which can miss falls occurring within that time. β±οΈ
3. **Scalability**: The number of scenarios is finite, and handling infinite variations in activity makes the system non-scalable. π
4. **Fall Detection Limitations**: A fall while sitting is not detected by the current system. ποΈ## Future Improvements π
1. **Feedback System**: A feedback mechanism will be implemented to improve detection accuracy. π£οΈ
2. **Mobile Integration**: `Blynk` will be used to create a mobile app for remote monitoring and control. π±
3. **Dashboard Enhancements**: Additional features will be added to the `ThingSpeak` dashboard. π## Course Information π
This project was a part of our **IoT course** at **IIIT Hyderabad**, where we explored various IoT concepts and implemented this system as part of our learning process. π₯οΈHere's the updated README with a **Results** section that includes all relevant PNG files rendered directly:
---
# Results ππ
This section showcases the results from different scenarios and sensors, highlighting the processed data and visualizations generated during the project.
---
### 1. **Fall Detection Results** πββοΈπ₯
The following images depict the results for different scenarios processed using the **MPU 6050 sensor** for fall detection:
#### a. **Running Scenario** πββοΈ
- **Run Plot**: This plot illustrates the acceleration and angular velocity data collected during the running scenario.
![Run Data](./IoT%20Project/Run/run.png)
---
#### b. **Walking Scenario** πΆββοΈ
- **Walk Plot**: Visualizing the sensor data during a walking scenario.
![Walk Data](./IoT%20Project/Walk/walk.png)
---
#### c. **Upward Movement (Stairs Up)** β¬οΈ
- **Up Plot**: The sensor readings captured while ascending stairs.
![Up Data](./IoT%20Project/Up/up.png)
---
#### d. **Downward Movement (Stairs Down)** β¬οΈ
- **Down Plot**: The processed data during the descent of stairs.
![Down Data](./IoT%20Project/Down/down.png)
---
### 2. **Final Processed Results for Scenarios** β
Below are the **final processed results** after refining the data for each scenario.
- **Final Walk Plot**:
![Final Walk Data](./IoT%20Project/Walk/finalWalk.png)
- **Final Run Plot**:
![Final Run Data](./IoT%20Project/Run/runFinal.png)
- **Final Down Plot**:
![Final Down Data](./IoT%20Project/Down/down_final.png)
- **Final Up Plot**:
![Final Up Data](./IoT%20Project/Up/up_final.png)
---
This **Results** section provides a comprehensive overview of the sensor data processing and analysis conducted for both **fall detection** and **PIR-based automatic lighting**. Each visualization highlights how sensor data was used to achieve the project goals effectively.
![Data](./IoT%20Project/data.png)
## Contribution Table π€
- **Sanyam**: Contributed to the overall design and development of the system. π οΈ
- **Kushal**: Implemented the logic in both code and hardware, played a significant role in data collection, and worked on the `ThingSpeak` integration for fall detection. π₯οΈπ§
- **Shreyas**: Created the dashboard, defined the scenarios, wrote Python scripts for data analysis, and was instrumental in data collection and `ThingSpeak` integration for `PIR`. ππ»
- **Inesh**: Worked on `PIR hardware`, wrote scripts, tested the entire system, and contributed to the `ThingSpeak` integration for the `PIR` sensor. ππ₯οΈ