A cloud based smart alarm clock using IoT sensors. This system aims to integrate various hardware and software components to provide an efficient and user-friendly alarm clock that leverages cloud connectivity for enhanced functionality.
- Web based application - set alarm from any device
- Alarm rings only when necessary. (If user is on his bed around the scheduled time)
- Smart Weight Tracking
- Sleep Pattern Tracking
- This alarm system is designed to help you stay on top of your meetings.
- You input all your
meetings
into the app, and the hardware detects if you're still in bed before a meeting starts. - If you're in bed
5 minutes
before a scheduled meeting, the alarm will ring continuously until you get up. - The alarm detects your presence by measuring an increase in
weight
reading through a load cell and a decrease indistance
reading using a TOF and ultrasound sensor.
Setting-alarm.mp4
Important
For Demonstration purposes, A 20kg loadcell was used only for the head. However for the actual Project a combination of four 20 kg load cells were placed under the bed to weigh the whole body.
UI.mp4
ESP32
Microcontroller connects to WebApplication Serverwebsocket
, gets alarm data in realTime- During NightTime, User Weight and Movement data from TOF, Ultrasound and HX711 Weight Sensors are sent to
InfluxDB
viaTelegraf
,HiveMQ
. - Live real time monitoring of data and database data are available through the cloud
Grafana
dashboard - Data from
InfluxDB
is read byAWS Sage Maker
for model based data Analytics using Machine Learning Models - All User Alarms and Aggregated Statistics are stored in
MYSQL Database
inAzure
. - NextJS Frontend Server and NodeJS(ExpressJS) Backend Server are passed through a reverse proxy for user Abstraction and Security.
Google OAuth 2.0
withJSON Web Token
is implemented for authenticating users.
Data_flow.mp4
- By leveraging sensors, microcontrollers, communication modules,
MQTT
brokers, andreal-time
data processing, we have developed a cohesive system that offers valuable insights and enhanced user interaction. - The project highlights the potential of IoT technology in everyday applications, transforming a traditional clock into a multifunctional device capable of improving user awareness and decision-making.
- Our system integrates various components seamlessly. The end devices, represented by the
ESP32 microcontroller
, ensure accurate data collection using sensors like theHX711
for weight measurement and theVL53L0X
for distance measurement. - These devices collect essential data, which is then transmitted to the MQTT broker for real-time processing and analytics.
- The
OLED
display and buzzer provide immediate feedback to users, enhancing the interactivity and functionality of the system. - The integration of
WebSocket
communication further enablesreal-time
updates andremote monitoring
capabilities.
- HX711: This sensor is an
analog-to-digital converter
(ADC) which is used forweight sensing
features, switching off the alarm only when weight is removed from the bed. - VL53LOX: VL53L0X is a
Time-of-Flight
(ToF) ranging sensor. It is used for movement recognition, which gives the sleep scores based onuser’s movement
during sleep. - HC-SR04: This sensor provides
2cm - 400cm
non-contact measurement function. It measures distances usingultrasonic waves
. This is used to detect if someone is there, magnitude of change in conjuction with the TOF sensor for double check(since the frequency of waves are different in both).
- OLED Display: An
OLED
(Organic Light Emitting Diodes) display shows time information. OLEDs have a much higher contrast ratio compared to traditional displays, making them visible from all angles and even in low-light situations. - Buzzer: The component that generates the alarm sound. It's the crucial part of the alarm clock, notifying or waking the user at the designated times.
ESP32 Microcontroller: ESP32 is a feature-rich SoC
with integrated Wi-Fi
and Bluetooth
connectivity for a wide-range of IoT
applications. In the given circuit it is connected to the sensors, collects sensor data, transmits it using the WiFi to the Cloud
.
Sage_maker_analytics.mp4
- We have used
AWS Sagemaker
for deploying, training and modelling of several models and datasets. - We have added few attributes such as Start time the user’s sleep, End time of the User’s sleep, sleep quality, time in bed, weight and Distance (Movement of the person).
- We have calculated the User’s time in bed by the start and end time of sleep by the user.
- Weight monitoring is done by the
loadcell
which is placed under the bed. - The tof sensor,
VL53LOX
and Ultrasound sensorHC-SR04
which is placed near the bed measures the distance of the User moving and tracking the percentage of deep sleep he/she is in. - The sleep quality of the user is trained by models to give a precise quality by checking the total time duration of the sleep and the movement the user while sleeping.
- For modelling, we have used,
Preprocessing
,Visualization
,EDA
,Linear regression
,KNN
,Logistic regression
,Decision tree
,Random Forest
andSVM
for better accuracy and got successful results.
Note
We have used our sleep data from 10.4.2024 to 10.5.2024 to train and test the models.
Refer to The Code of Conduct before making a pull request to the repository, posting on the discussions section or involing in any public activity related to this repository.
Refer SECURITY.md for Security Policy.
All code in this repository is Licensed Under MIT License, and is freely available for anyone to use or make changes.