Skip to content

Latest commit

 

History

29 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Anti-Suicide Smart Fan: IoT-Integrated Safety Ecosystem

Life-Safety Firmware | ESP32-C3 | Cloud-Synchronized Emergency Protocol

Focus: Real-time vertical displacement sensing, fail-safe motor isolation, and remote emergency orchestration.


Engineering Philosophy

Ceiling fans are a high-risk point in institutional and residential safety. This project transforms a standard mechanical fixture into an intelligent sensor node. By utilizing Non-Blocking I/O and a Deterministic State Machine, the system ensures that safety interrupts are processed with microsecond precision, independent of network latency or cloud synchronization.


Technical Challenges & Engineering Solutions

1. High-Precision Displacement Monitoring

  • The Problem: Environmental noise and air turbulence from fan blades can cause "jitter" in ultrasonic readings, potentially triggering false panic states.
  • The Solution: Implemented a Moving Average Filter in the Sensor.cpp logic. The firmware establishes a calibrated baselineDistance upon boot and requires a sustained vertical displacement of >5.0 cm across multiple samples before triggering a lockout.

2. Immediate Mechanical Intervention (NEMA 17 Control)

  • The Problem: Traditional AC motors have significant inertia and are difficult to stop instantly.
  • The Solution: Pivoted to a Stepper-based Drive (NEMA 17) utilizing the A4988 driver. This allows the firmware to execute an instantaneous "Hard Kill" by pulling the Enable pin high and stopping the step pulse train, providing a mechanical lockout the moment a risk is detected.

3. Fail-Safe State Recovery

  • The Problem: If a panic event occurs, the system must not be reset by simply power-cycling the device.
  • The Solution: The system utilizes a Cloud-Stored Lockout State. Upon reboot, the ESP32-C3 fetches its last known status from the Firebase Real-time Database. If the status is "Locked," the hardware remains in a blocking safety loop until an authorized administrator manually clears the flag.

System Architecture

System Architecture - Life-Safety Logic Flow

1. Sensing & Actuation Layer

  • Proximity Monitoring: 1D spatial mapping using HC-SR04 to establish a ceiling-to-fan baseline.
  • Auditory Alerting: High-intensity active buzzer and LED indicators integrated directly into the ESP32-C3 interrupt routine.

2. Cloud Synchronization Layer

  • RESTful Telemetry: Uses HTTP/SSL to push critical Suicide: true flags and real-time telemetry to Firebase.
  • Remote Dashboard: A Vercel-deployed web application providing centralized monitoring and authorized recovery controls.

Prototype

Anti-Suicide Smart Fan Prototype


Hardware Specifications

Component Specification
MCU ESP32-C3 (RISC-V Single-Core)
Sensing HC-SR04 Ultrasonic (2cm - 400cm range)
Drive NEMA 17 Stepper (1.8° step angle)
Connectivity Firebase REST API / HTTP SSL

Repository Structure

Anti_Suicide_Fan/
├── Firmware/                 # Embedded C++ (ESP32-C3)
│   ├── sketch.ino            # Deterministic state machine & safety loops
│   ├── Sensor.cpp / .h       # Noise-filtered proximity logic
│   └── CloudManager.cpp / .h # Firebase orchestration & WiFi recovery
├── Web App/                  # Management Dashboard (HTML/JS)
└── vercel.json               # Deployment configuration

💡 Lessons Learned & Future Iterations

This project was a significant exercise in reliability engineering for life-safety applications:

  • The Pivot: Early prototypes utilized standard PIR motion sensors, which proved insufficient for detecting specific vertical displacement. Transitioning to Ultrasonic 1D Mapping allowed for the creation of a "Digital Fence," providing a far more reliable and deterministic trigger for life-safety intervention.
  • Future Refinement: I am currently designing a Dual-Sensor Fusion model for the next iteration. By integrating Load Cells into the fan mounting bracket, the firmware will be able to cross-reference distance data with physical weight displacement, virtually eliminating the possibility of false positives.

📬 Contact & Proof of Work

Ritul Raj Bhakat
Firmware Developer | Embedded Systems Architect


© 2026 Ritul Raj Bhakat. Engineered for life-safety intervention.

About

Engineered a life-safety IoT ecosystem featuring ESP32-C3 firmware that utilizes high-precision ultrasonic 1D mapping to detect abnormal vertical displacement. The system executes a deterministic mechanical lockout via a NEMA 17 stepper drive and orchestrates real-time SOS protocols through a Firebase-backed dashboard, ensuring fail-safe emergency

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages