0% found this document useful (0 votes)
522 views17 pages

Group - 16 - Smart Alarm Clock Using IOT

Report on smart alarm clock

Uploaded by

Shradha Swarup
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
522 views17 pages

Group - 16 - Smart Alarm Clock Using IOT

Report on smart alarm clock

Uploaded by

Shradha Swarup
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

PROJECT REPORT

SMART ALARM CLOCK USING IOT


SUBMITTED BY : Group 16
22053901 : Subhankar Mohapatra

22054042 : Gaurab Thakur

22054100 : Shuvashish Barman

22054148 : Raman Kumar

22054426 : Atharv Singh


Smart Alarm Clock Using NodeMCU

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.

The objective of this project is to develop a smart alarm clock that


leverages IoT principles to offer a more intuitive, customizable, and
interactive wake-up experience. By utilizing components such as the
ESP8266 microcontroller, DS3231 real-time clock module, and LCD display,
we aim to create a device that not only displays time but also allows users
to set alarms remotely, customize alarm tones, and integrate with other
smart devices seamlessly.

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

2. DS3231 – RTC MODULE

3. LCD I2C MODULE

4. 16*2 LCD DISPLAY

5. LED BULB

6. JUMPER WIRES

Methodology
A) Circuit Design:
Core: NodeMCU (ESP8266) microcontroller – manages communication, web
interface, and alarm logic.

Timekeeping: DS3231 RTC module – provides accurate timekeeping with battery


backup during power outages.

Display: LCD (Liquid Crystal Display) – displays current time, alarm settings, and
other information.

Output: Buzzer – generates the alarm sound.

Optional: Buttons or rotary encoder – can be incorporated for basic controls


like snoozing or navigating the web interface displayed on a connected device.

Fig: Circuit design

B) Flow/Process Diagram:

1. NodeMCU connects to a Wi-Fi network (optional, for potential future


features).

2. User accesses the web interface on a smartphone or laptop by connecting to


the NodeMCU's access point (created if Wi-Fi is not used).
3. The web interface allows setting alarm time, selecting tones, and configuring
snooze options.

4. NodeMCU stores user-defined settings in memory.

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:

In The Smart Alarm Clock, We Will Use A Low-Cost And Low-Powered


Microcontroller Which Will Be Programmed By Using C-Language In The Case Of
Arduino UNO And NodeMCU And Will Be Programmed By Python Language In
The Case Of RaspberryPi. Smart Objects Should Be Capable Of Collecting Data
From The Environment And Then Using That Data To Activate Real-World Events.
This Is Achieved With The Help Of Sensors And Actuators.

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.

Customizable Alarms : Users can set personalized alarms based on their


schedule or preferences. This includes options to set different alarm tones,
volumes, and recurrence patterns for weekdays, weekends, or specific dates.

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.

Integration with Calendar Apps : By syncing with calendar apps or platforms


like Google Calendar, the alarm clock can display upcoming events or
appointments and offer tailored wake-up notifications based on the user's
schedule.

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>

#include <Wire.h> // must be included here so that Arduino library


object file references work

RtcDS3231<TwoWire> Rtc(Wire);

#include <LiquidCrystal_I2C.h>

const byte DNS_PORT = 53; // 53 is set as DNS port

IPAddress apIP(10, 10, 10, 1); // Network Server

DNSServer dnsServer; // DNS server object

ESP8266WebServer webServer(80); // Webserver object

#define buzzer D8

#define ledPin D7

LiquidCrystal_I2C lcd(0x27, 16, 2);

String hr, minut;


int hr1, minut1;

String new_time;

/*START OF HMTL CODE*/

String style_detials = //This String defines the style attributes for


webpage

"<style type=\"text/css\">"

" body{"

" background-color: #a69695;"

"}"

"button{"

" display: inline-block;"

"}"

"#buttons{"

" text-align: center;"

"}"

".controllButtons{"

" margin-top: 15px;"

"margin-left: 5px;"

"background-color: white;"

"padding: 10px;"

"border:1px solid black;"


"border-radius: 10px;"

"cursor: pointer;"

"font-size: 14px;"

"}"

".controllButtons:hover{"

" background-color: orange;"

"padding: 10px;"

"border:1px solid black;"

"border-radius: 10px;"

"cursor: pointer;"

"font-size: 14px;"

"}"

"@media only screen and (max-width: 700px) {"

" button{"

" display: block;"

"}"

"#buttons{"

" margin-top: 10%;"

"margin-left: 35%;"

"}"
" .controllButtons{"

" margin-top: 15px;"

"margin-left: 5px;"

"background-color: white;"

"padding: 15px;"

"border:1px solid black;"

"border-radius: 10px;"

"cursor: pointer;"

"font-size: 16px;"

"}"

".controllButtons:hover{"

" background-color: orange;"

"padding: 15px;"

"border:1px solid black;"

"border-radius: 10px;"

"cursor: pointer;"

"font-size: 16px;"

"}"

"}"

"</style>";
String home_screen = "" //Page 1 - Home Screen HTML code

"<!DOCTYPE html><html>"

"<head><meta name=\"viewport\" content=\"width=device-width,


initial-scale=1\">"

+ style_detials + "<body><h1>IoT Alarm Clock</h1>"

"<div id=\"login\">"

" <form action=\"confirmation_screen.php\" method=\"get\">"

" <h2>Please enter your next Alarm in format (05:45)</h2>"

" <div>Alarm Time: <input type=\"numeric\" name=\"code\"


autofocus></div>"

" <div id=\"submit\"><input type=\"submit\" value=\"Submit\"></div>"

" </form>"

"</div>"

"</body></html>";

String confirmation_screen = "" //Page 2 - If Alarm is Set

"<!DOCTYPE html><html>"

"<head><meta name=\"viewport\" content=\"width=device-width,


initial-scale=1\">"

+ style_detials +

"<body><h1>Alarm Time Set</h1>"


"</body></html>";

/*END OF HMTL CODE*/

void setup() {

pinMode(buzzer, OUTPUT);

pinMode(ledPin, OUTPUT);

Wire.begin(D2, D1);

lcd.begin();

Rtc.Begin();

WiFi.mode(WIFI_AP); //Set ESP in AP mode

WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));

WiFi.softAP("ESP8266 DNS Server"); // Name your AP network

dnsServer.start(DNS_PORT, "*", apIP);

// redirect all requests to the login page

webServer.onNotFound([]() {

webServer.sendHeader("Location",
String("http://www.alarmclock.com/home_screen.php"), true);

webServer.send(302, "text/plain", "");

});

webServer.on("/home_screen.php", []() {

webServer.send(200, "text/html", home_screen);

});

webServer.on("/confirmation_screen.php", []() {

if (webServer.args() > 0) {

new_time = webServer.arg(0); // Stores the Alarm time input

webServer.send(200, "text/html", confirmation_screen); //when alarm


time entered direct user to Confirmaton page

hr = new_time.substring(0, 2); //substring is used to split the data in


hour and minute form

hr1 = hr.toInt(); // toInt is used to convert string into integer

minut = new_time.substring(3, 5);

minut1 = minut.toInt();

});

webServer.begin();
}

void loop() {

dnsServer.processNextRequest();

webServer.handleClient();

alarm();

void alarm() {

RtcDateTime now = Rtc.GetDateTime();

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);

You might also like