Skip to content

IoT-based sleep quality enhancement system using ESP32 with real-time web dashboard.

Notifications You must be signed in to change notification settings

TejasvaCodes/SQuiE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQuiE – Sleep Quality Enhancer 😴⚙️

SQuiE (Sleep Quality Enhancer) is an ESP32-based IoT system that monitors and actively improves sleep conditions using environmental sensing, automation, and a real-time web dashboard.

It is designed as a low-cost, modular, and extensible smart sleep engineering platform suitable for smart homes, hostels, and research prototypes.


✨ Features

  • Sleep Quality Index (SQI) computation (0–100)
  • Touch-based Sleep Mode control
  • Automatic ventilation with 3-level servo control (LOW / MED / HIGH)
  • Smart lighting control (auto OFF during sleep)
  • Continuous white-noise generation using buzzer
  • Movement detection using Ultrasonic + IR sensor (sensor fusion)
  • Temperature & humidity monitoring (DHT11)
  • Light intensity monitoring (LDR)
  • Real-time Wi-Fi web dashboard
  • Fully offline local network operation

🧠 System Concept

SQuiE works as a closed-loop automation system:

Environment → Sensors → ESP32 → Decision Logic → Actuators → Improved Environment

It continuously senses the sleep environment, calculates a Sleep Quality Index, and adjusts ventilation, lighting, and sound to optimize sleep conditions.


🧰 Hardware Used

  • ESP32 Development Board
  • DHT11 Temperature & Humidity Sensor
  • LDR (Light Sensor Module)
  • Ultrasonic Sensor (HC-SR04)
  • IR Obstacle Sensor
  • Touch Sensor Module
  • SG90 Servo Motor
  • Active Buzzer
  • LED
  • Resistors, breadboard, jumper wires

🧩 Pin Mapping

Component ESP32 GPIO
DHT11 Data GPIO 4
LDR Analog GPIO 34
Ultrasonic TRIG GPIO 26
Ultrasonic ECHO GPIO 27
IR Sensor OUT GPIO 14
Touch Sensor OUT GPIO 12
Servo Signal GPIO 13
LED GPIO 5
Buzzer GPIO 33

🌐 Web Dashboard

The ESP32 hosts a local web server.

Features shown:

  • SQI score
  • Temperature
  • Humidity
  • Light level
  • Movement status
  • Sleep mode status
  • LED status

Access using:

http://<ESP32-IP-address>

(Phone/Laptop must be on the same Wi-Fi network.)


⚙️ Setup Instructions

1. Hardware Setup

  • Connect sensors and actuators according to the pin mapping table.
  • Ensure common ground for all modules.

2. Software Setup

Install the following Arduino libraries:

  • DHT sensor library (Adafruit)
  • Adafruit Unified Sensor
  • ESP32Servo

Install ESP32 board support using Arduino Boards Manager.

3. Configure Wi-Fi

Edit in the firmware:

#define WIFI_SSID "YOUR_WIFI_NAME"
#define WIFI_PASS "YOUR_WIFI_PASSWORD"

4. Upload Firmware

  • Select board: ESP32 Dev Module
  • Select correct COM port
  • Upload the code

5. Open Dashboard

Check Serial Monitor for IP address and open it in a browser.


🧪 System Behavior

Condition Action
Sleep Mode ON LED OFF, Buzzer ON (white noise)
Sleep Mode OFF LED ON, Buzzer OFF
Temp < 20°C Servo LOW
Temp 20–24°C Servo MED
Temp > 24°C Servo HIGH
Movement detected SQI decreases

🚀 Applications

  • Smart homes
  • Hostels / PG rooms
  • Hospitals
  • Hotels
  • Elder care systems
  • Sleep research labs

🔮 Future Improvements

  • Mobile app control
  • Cloud data logging
  • Machine learning sleep classification
  • CO₂ and noise sensors
  • RGB mood lighting
  • Multi-room support
  • Secure login for dashboard

Long‑term Vision (Conceptual Enhancements)

The following ideas are part of the future roadmap and are not implemented in the current version.

  • SQuiE Baby – Baby Sleep Monitoring System
    Extension of SQuiE for infant safety and monitoring, including:

    • Cry detection using microphone/sound sensor
    • Breathing & motion safety alerts
    • Over‑temperature risk detection
    • Parent notification system (mobile / cloud)
    • Dedicated “Baby Mode” with stricter safety thresholds
  • Advanced Human Sleep Monitoring System
    Enhanced version for detailed sleep analysis, including:

    • Sleep stage estimation (light / deep / REM)
    • Long‑term sleep quality trends
    • Wearable integration
    • Personalized sleep optimization using ML models

These enhancements position SQuiE as a scalable sleep‑engineering platform rather than a single‑purpose device.


📸 Demo

(Add images here)

  • Hardware setup photo
  • Dashboard screenshot
  • Servo operation

👨‍💻 Author

Tejasva Chaudhary
Engineering Student | Embedded Systems & IoT


📜 License

This project is licensed under the MIT License – free to use, modify, and distribute.


⭐ Acknowledgements

  • Arduino Community
  • Espressif Systems
  • Adafruit Libraries

SQuiE – Because good sleep should be engineered. 💤

About

IoT-based sleep quality enhancement system using ESP32 with real-time web dashboard.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages