Project tutorial
Arduino Alarm Clock Project

Arduino Alarm Clock Project

Make an alarm clock that will only stop once the light is on and the button is pressed using an Arduino Nano.

  • 967 views
  • 0 comments
  • 2 respects

Components and supplies

Ard nano
Arduino Nano R3
or any arduino
×1
ISD1829
https://www.allelectronics.com/mas_assets/media/allelectronics2018/spec/ME-63.pdf
×1
101020013 1 t7q8dzawsn
Seeed Grove - RTC
any RTC module
×1
4767222
LDR, 5 Mohm
any LDR
×1
43w7816 40
Pushbutton Switch, Push On-Push Off
Any push
×1

Apps and online services

About this project

I have built an light depended alarm clock using arduino nano, RTC module, ISD module, LDR, button, etc

all of the details are in the video

you are more than welcom to ask me here or in private anything.

Code

Wake up CodeArduino
using DS3231 library
#include <DS3231.h>
#define Hour 7    //define hour to wake up
#define minute 0 //define minute to wake up
// Init the DS3231 using the hardware interface
DS3231  rtc(SDA, SCL);   //set up RTC module
int Shout = 7;          //this is connected to the ISD module
int Butt = 6;           //this is the button
int Light = A0;         //LDR
bool Stop;             //Bool to stop screaming
long Read;             //to read LDR analog value
Time  t;               //from the Library

void setup()
{
  Serial.begin(115200);   //just for debug. not important
  pinMode(Shout,OUTPUT);  //define inputs and outputs
  pinMode(Butt,INPUT);
  rtc.begin();            //from library
  Stop = false;           //Scream at mE!!! (not yet)
}

void loop()
{
  t = rtc.getTime();     //get the time from RTC module
  if(rtc.getDOWStr()!= "FRIDAY" &&rtc.getDOWStr()!= "SATURSDAY")//unless its the weekend!
  {
    if((t.hour)== Hour && (t.min) == minute )   //when Time as come...
    {
      while(Stop==false)     //as long as the Bool is false (starting poin is false)
      {
         Read = analogRead(Light);  //read analog value
         digitalWrite(Shout,HIGH);  //the routine to oparate scream flow
         delay(20);
         digitalWrite(Shout,LOW);
        if((t.hour)== Hour && (t.min) == (minute+20))//if it lastad for more than 20 minutes 
          Stop=true;                              //Stop screaming at me!!
        if(digitalRead(Butt)==1 && Read >=905)//if the button is Pressed AND the light is ON!
          Stop=true;                           // STOP THIS MADDNESSSSSS
      } 
      delay(80000);            
      Stop=false;                         //get ready to start again tomorrow!
    }
  
  
  
  Serial.print(rtc.getDOWStr());
  Serial.print(" ");
  // Send date
  Serial.print(rtc.getDateStr());
  Serial.print(" -- ");
  // Send time
  Serial.println(rtc.getTimeStr());

  
  // Wait one second before repeating :)
  delay (1000);
  /*   SET this to change time!  do this if u didn't set the RTC time
  if(digitalRead(Butt))
  {
     rtc.setDOW(MONDAY);     // Set Day-of-Week to MONDAY
  rtc.setTime(19,35, 0);     // Set the time to 19:35:00 (24hr format)
  rtc.setDate(8, 4, 2019);   // Set the date to april 8, 2019
  }
  */
  
  }
}

Comments

Similar projects you might like

Complete Digital Clock Including Alarm and Motion Sensor

Project in progress by LAGSILVA

  • 15,434 views
  • 18 comments
  • 55 respects

Weather Forecast Clock Using Old Alarm and Arduino

Project showcase by LenkaDesign

  • 7,580 views
  • 18 comments
  • 38 respects

Alarm Clock and Timer Working Standalone

Project showcase by ozyRonald

  • 8,622 views
  • 10 comments
  • 11 respects

A Very Compact Alarm with Card Reader and Real-Time Clock

Project tutorial by Simone Adobs

  • 7,291 views
  • 3 comments
  • 31 respects

Industrial Alarm Clock

Project showcase by Insight Machines Laboratory

  • 4,437 views
  • 2 comments
  • 17 respects

ElBanquos Alarm Clock

Project showcase by ElBanquo

  • 1,031 views
  • 1 comment
  • 2 respects
Add projectSign up / Login