Group - 16 - Smart Alarm Clock Using IOT
Group - 16 - Smart Alarm Clock Using IOT
Introduction
Alarm clocks have been a staple in households worldwide, serving as
essential tools to wake individuals up at designated times. While traditional
alarm clocks fulfill the basic function of waking people up, they lack the
versatility and interactivity expected in modern devices. With
advancements in IoT technology, there arises an opportunity to enhance
the functionality of alarm clocks by integrating them into the connected
ecosystem of smart devices.
Objective
This project aims to develop a user-friendly and feature-rich smart alarm clock
built around the NodeMCU microcontroller. It will allow users to set and manage
alarms through a web interface, eliminating the need for physical buttons.
Additionally, the clock will display accurate time using a Real-Time Clock (RTC)
module, even during power outages.
Motivation
Traditional alarm clocks can be limiting, offering basic functions like setting
alarms and snoozing. This project seeks to create a smart alternative that
provides:
1. In A Smart Alarm Clock, A Sensor Can Be Placed Under The Mattress Or
Pillows That A Person Is Using. This Sensor Can Measure Your Sleep And Will
Also Be Able To Determine Whether The Person Is Getting Enough Sleep Or
Not.
2. The Alarm Set In A Traditional Clock Will Go Off At The Time Set By The
Person. But In The Case Of Smart Alarm Clock Using IOT, The Clock Will Go
Off By Determining Whether The Person Is Feeling Refreshed Or Not.
3. Sleeping Posture Is The Most Important Part In Having A Sleep That Will
Make A Person Alert And Refreshed On Waking Up. Smart Alarm Clocks Will
Also Be Able To Determine The Correct Posture Of The Person Sleeping So
That He/She Could Have A High Quality Sleep.
4. The Traditional Alarm Clocks Have An Alarm Sound Which Sounds Quite
Irritating Sometimes. But In Case Of Smart Alarm Clock, You Can Set Your
Own Favourite Tunes As An Alarm Tone. It Can Also Turn On The LED Lights
Which Will Keep You Quite Excited And Energized For The Day.
5. The Smart Alarm Clock Using IOT Can Also Change Time Automatically On
The Basis Of Weather Conditions, Traffic Routes And Also On The Basis Of
Whether The Day Is A Weekend Or A Weekday. It Can Also Play Internet Radio
Stations And News Podcasts As Well.
Components Used
1. ESP8266 – NODE MCU
5. LED BULB
6. JUMPER WIRES
Methodology
A) Circuit Design:
Core: NodeMCU (ESP8266) microcontroller – manages communication, web
interface, and alarm logic.
Display: LCD (Liquid Crystal Display) – displays current time, alarm settings, and
other information.
B) Flow/Process Diagram:
5. The NodeMCU continuously monitors the time from the RTC module.
6. When the set alarm time arrives, the NodeMCU activates the buzzer to sound
the alarm.
C) Working Model:
The Person Using The Smart Alarm Clock Can Keep A Sensor Under His Pillow
Which Will Help To Monitor Whether The Person Is Having A Refreshed And
Good Sleep Or Not. Sensors Are Quite A Low Cost In The Field Of The Internet Of
Things. Some Commonly Used Sensors Are Temperature Sensors, Humidity
Sensors, And Pulse Sensors. Actuators Are Nothing But LEDs And Output
Devices That Can Be Used To Turn On And Off The Smart Alarm Clock.
This Smart Alarm Clock Can Also Be Connected To The Internet Using The
ESP8266 Wi-Fi Module So That You Can Keep Track Of Various Things Like
Weather And Traffic Flow With The Help Of A Clock. There Are Some Networking
Products That Are Designed To Create Low-Energy Protocols Such As 6loWPAN
And Zigbee. They Are Quite Helpful In Creating A Personal Wireless Sensor
Network.
Fig: Smart Alarm
Application
Remote Control: With NodeMCU's Wi-Fi capabilities, users can control the alarm
clock remotely using a smartphone app or a web interface. This allows for
convenient management of alarm settings, snooze options, and other features
from anywhere with an internet connection.
Weather Updates : Integrating weather APIs, the smart alarm clock can provide
real-time weather updates and forecasts. This feature can help users plan their
day ahead by knowing what weather conditions to expect upon waking up.
Traffic Updates : Similar to weather updates, the alarm clock can fetch traffic
information from online sources and provide alerts about traffic conditions on
the user's commute route. This information can help users plan their departure
time accordingly.
Smart Home Integration : Integration with smart home devices allows the alarm
clock to control other IoT devices in the home. For example, it could
automatically adjust the thermostat, turn on lights, or start the coffee maker
upon waking up.
Sleep Tracking : Using built-in sensors or external devices, the smart alarm clock
can track sleep patterns and provide insights into the user's sleep quality. This
data can be used to optimize alarm settings and improve overall sleep habits.
Voice Control : Integration with voice assistants like Amazon Alexa or Google
Assistant enables users to control the alarm clock using voice commands. This
hands-free interaction adds convenience and accessibility to the device.
Music Streaming : The smart alarm clock can stream music from online services
like Spotify or play music stored locally on the network. Users can wake up to
their favorite songs or curated playlists.
Emergency Alerts : In addition to traditional alarms, the smart alarm clock can
receive emergency alerts such as severe weather warnings or natural disaster
notifications, ensuring users are informed and safe.
Future Scope
The future scope of smart alarm clocks using NodeMCU for IoT projects is
promising, with advancements likely to focus on seamless integration with
emerging technologies. Anticipated developments include enhanced AI
capabilities for personalized wake-up experiences, expanded smart home
integration with IoT ecosystems, refined sleep tracking algorithms for improved
health insights, and increased connectivity with wearable devices. Additionally,
innovations may involve augmented reality interfaces for intuitive user
interaction and further optimization for energy efficiency and sustainability. As
IoT technology continues to evolve, smart alarm clocks are poised to become
integral components of interconnected smart environments, offering greater
convenience and functionality to users worldwide.
Code
#include <RTClib.h>
#include <ESP8266WiFi.h>
#include "DNSServer.h"
#include <ESP8266WebServer.h>
#include <RtcDS3231.h>
RtcDS3231<TwoWire> Rtc(Wire);
#include <LiquidCrystal_I2C.h>
#define buzzer D8
#define ledPin D7
String new_time;
"<style type=\"text/css\">"
" body{"
"}"
"button{"
"}"
"#buttons{"
"}"
".controllButtons{"
"margin-left: 5px;"
"background-color: white;"
"padding: 10px;"
"cursor: pointer;"
"font-size: 14px;"
"}"
".controllButtons:hover{"
"padding: 10px;"
"border-radius: 10px;"
"cursor: pointer;"
"font-size: 14px;"
"}"
" button{"
"}"
"#buttons{"
"margin-left: 35%;"
"}"
" .controllButtons{"
"margin-left: 5px;"
"background-color: white;"
"padding: 15px;"
"border-radius: 10px;"
"cursor: pointer;"
"font-size: 16px;"
"}"
".controllButtons:hover{"
"padding: 15px;"
"border-radius: 10px;"
"cursor: pointer;"
"font-size: 16px;"
"}"
"}"
"</style>";
String home_screen = "" //Page 1 - Home Screen HTML code
"<!DOCTYPE html><html>"
"<div id=\"login\">"
" </form>"
"</div>"
"</body></html>";
"<!DOCTYPE html><html>"
+ style_detials +
void setup() {
pinMode(buzzer, OUTPUT);
pinMode(ledPin, OUTPUT);
Wire.begin(D2, D1);
lcd.begin();
Rtc.Begin();
webServer.onNotFound([]() {
webServer.sendHeader("Location",
String("http://www.alarmclock.com/home_screen.php"), true);
});
webServer.on("/home_screen.php", []() {
});
webServer.on("/confirmation_screen.php", []() {
if (webServer.args() > 0) {
minut1 = minut.toInt();
});
webServer.begin();
}
void loop() {
dnsServer.processNextRequest();
webServer.handleClient();
alarm();
void alarm() {
lcd.setCursor(0, 0);
lcd.print("Time:");
lcd.print(now.Hour(), DEC);
lcd.print(':');
lcd.print(now.Minute(), DEC);
lcd.print(':');
lcd.print(now.Second(), DEC);
lcd.setCursor(0, 1);
lcd.print("Alarm Time:");
lcd.print(hr1);
lcd.print(':');
lcd.print(minut1);
if (now.Hour() == hr1 && now.Minute() == minut1) //Comparing the
current time with the Alarm time
Buzzer();
Buzzer();
lcd.clear();
lcd.print("Alarm ON");
lcd.setCursor(0, 1);
lcd.print("Alarming");
Buzzer();
Buzzer();
delay(5000);
digitalWrite(ledPin, HIGH);
}
void Buzzer() {
digitalWrite(buzzer, HIGH);
delay(500);
digitalWrite(buzzer, LOW);
delay(500);