IQ Alarm clock using Arduino for heavy sleepers

iq-alarm-clock-arduino

Raising from bed can be the most painful thing you could ever do. We often set alarms to wake up but ends up in snoozing it out or even kick the alarms away. To address this we have come up with an Arduino project ” IQ alarm clock ” which will annoy you until you wake up. The most highlighting thing about this alarm is that it will ask you a question once it starts sounding and you can turn it off only if you answer the question correctly.

COMPONENTS REQUIRED:

  1. Arduino Pro mini-1
  2. DS 1307 RTC Module-1
  3. Push Buttons-3
  4. 16×2 LCD Display-1
  5. Buzzer-1
  6. 10Kilo ohm Resistors-2
  7. 10kilo ohm POT-1

IQ ALARM CLOCK SCHEMATIC DIAGRAM:

IQ-alarm-clock-schematic-diagram

WORKING EXPLANATION:

The working of this IQ alarm clock is pretty simple and straight forward. DS1307 RTC chip feeds the real time data to our Arduino. It is because of this chip Arduino will track of real time and activate alarm’s accordingly. This chip can be powered using a small coin cell because of its low current consumption. The real time data is fed to the Arduino via SCL and SDA pins.

Three buttons are interfaced to Arduino for the purpose of setting the alarm in it. The button connected to pins 10,11,12 will command Arduino to Go Next, Increment time and Set Alarm. Buzzer connected to pin 13 will be acting as sounding element for our project. Finally comes the LCD which will display the time and other user interactions such as Setting alarm time and displaying questions to answer.

As narrated above the alarm time should be set using the three buttons. Once the alarm is set all we have to do is wait for it to trigger till the alarm time.

QUIZ TIME:

iq-alarm-clock-questions-arduino

When the time hits the alarm mark, the Arduino will drive the buzzer connected to it. Eventually it will wake up sleeping user near it. And once you woke up Arduino will start shooting questions that will test your IQ (Refer the above image for example) . You need to answer those questions correctly, you will be given two options to choose the best answer from it (Refer the image below).

alarm-clock-answers

This IQ alarm clock will keep on sounding until you answer the right answer for the question. You can save questions in internal EEPROM of Arduino. You can save many questions to it to make this more challenging. You would have finally woke up fully from your sleep once you done answering the question. And thus the purpose of our project is served.

NOTE:

We have built the project using Arduino Uno but posted the design using Arduino Pro Mini since Mini can do the same job as Uno by occupying less space. You can go for Pro mini design if you are worried about space constraint.

CODE:

#include <Wire.h>
#include<EEPROM.h>
#include <RTClib.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(7,6,5,4,3,2); 
RTC_Millis RTC;
int temp,inc,hours1,minut,add=11;

int next=10;    
int INC=11;
int set_mad=12;
int swt=9;
int t,c=1;
#define buzzer 13

int HOUR,MINUT,SECOND;

 
void setup()
{
 Wire.begin();
 RTC.begin(DateTime(F(__DATE__), F(__TIME__)));
 lcd.begin(16,2);
 pinMode(INC, INPUT);
 pinMode(next, INPUT);
 pinMode(set_mad, INPUT);
 pinMode(swt,INPUT);
 pinMode(buzzer, OUTPUT);
 digitalWrite(next, HIGH);
 digitalWrite(set_mad, HIGH);
 digitalWrite(INC, HIGH);
 digitalWrite(swt,HIGH);
 
   lcd.setCursor(0,0);
   lcd.print("Real Time Clock");
    delay(10000);
}
 
void loop()
{
   int temp=0,val=1,temp4;
   DateTime now = RTC.now();
   if(digitalRead(set_mad) == 0)      //set Alarm time
   { 
     lcd.setCursor(0,0);
     lcd.print("  Set Alarm  ");
    delay(2000);
    defualt();
    time();
    delay(1000);
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("  Alarm time ");
    lcd.setCursor(0,1);
    lcd.print(" has been set  ");
    delay(2000);
 }
 lcd.clear();
 lcd.setCursor(0,0);
 lcd.print("Time:");
 lcd.setCursor(6,0);
 lcd.print(HOUR=now.hour(),DEC); 
 lcd.print(":");
 lcd.print(MINUT=now.minute(),DEC);
 lcd.print(":");
 lcd.print(SECOND=now.second(),DEC);
 lcd.setCursor(0,1);
 lcd.print("Date: ");
 lcd.print(now.day(),DEC);
 lcd.print("/");
 lcd.print(now.month(),DEC);
 lcd.print("/");
 lcd.print(now.year(),DEC);
 match();
 delay(200);
}

void defualt()
{
  lcd.setCursor(0,1);
  lcd.print(HOUR);
  lcd.print(":");
  lcd.print(MINUT);
  lcd.print(":");
  lcd.print(SECOND);
}


/*Function to set alarm time and feed time into Internal eeprom*/

void time()                             
{
  int temp=1,minuts=0,hours=0,seconds=0;
    while(temp==1)
    {
     if(digitalRead(INC)==0)
     {
      HOUR++;
      if(HOUR==24)
      {
       HOUR=0;
      }
      while(digitalRead(INC)==0);
     }
     lcd.clear();
      lcd.setCursor(0,0);
    lcd.print("Set Alarm Time ");
    lcd.setCursor(0,1);
    lcd.print(HOUR);
    lcd.print(":");
    lcd.print(MINUT);
    lcd.print(":");
    lcd.print(SECOND);
    delay(100);
    if(digitalRead(next)==0)
    {
      hours1=HOUR;
      EEPROM.write(add++,hours1);
     temp=2;
     while(digitalRead(next)==0);
    }
    }
    
    while(temp==2)
    {
     if(digitalRead(INC)==0)
     {
      MINUT++;
      if(MINUT==60)
      {MINUT=0;}
      while(digitalRead(INC)==0);
     }
    lcd.setCursor(0,1);
    lcd.print(HOUR);
    lcd.print(":");
    lcd.print(MINUT);
    lcd.print(":");
    lcd.print(SECOND);
    delay(100);
      if(digitalRead(next)==0)
      {
       minut=MINUT;
       EEPROM.write(add++, minut);
       temp=0;
       while(digitalRead(next)==0);
      }
    }
    delay(1000);
}

/* Function to check time */

void match()
{
  int tem[17];
  for(int i=11;i<17;i++)
  {
    tem[i]=EEPROM.read(i);
  }
  if(HOUR == tem[11] && MINUT == tem[12]) 
  {
   beep();
   beep();
   lcd.clear();
   lcd.setCursor(0,0);
   lcd.print("Wake Up........");
   lcd.setCursor(0,1);
   lcd.print("Wake Up.......");
   delay(5000);
   lcd.clear();
   lcd.setCursor(0,0);
   lcd.print("who is our 1stPM");
   delay(3000);
   lcd.clear();
   lcd.setCursor(0,0);
   lcd.print("1)rajendraprasad");
   lcd.setCursor(0,1);
   lcd.print("2)indiragandhi");
   delay(3000);
   
   if(digitalRead(swt)==0)
   {
    t=1;
      if(c==t)
      {
        lcd.clear();
        lcd.print("off");
        delay(50000);
         digitalWrite(buzzer, LOW);
          delay(50000);
      }
   }
   else
   {
      t=2;
        if(c==t)
        {
          lcd.clear();
          lcd.print("off");
          digitalWrite(buzzer, LOW);
          delay(3000);
        }
   }
  beep();
   }

}

/* function to buzzer indication */

void beep()
{
   digitalWrite(buzzer,HIGH);
}

 MAKERS:

inventor-icon

  1. Mahitha Krishna
  2. Keerthana
  3. Ravali

4 Comments

  1. Pingback: IQ Alarm clock using Arduino for heavy sleepers • Tech Projects

  2. Ashok Rathod

    Thanks for the code…..!

    Reply
  3. Vamshi Obulareddy

    Thankyou…i found it useful

    Reply
  4. Agzogne

    i don’t know in what way i give thank any way God bless u

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *