Project in progress
Arduino Alarm Clock

Arduino Alarm Clock © GPL3+

An alarm clock that uses an Arduino UNO, a buzzer, DS1307 rtc, and usb port.

  • 13,698 views
  • 3 comments
  • 17 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

About this project

My project is an Arduino alarm clock. I was curious to see if I can make a functional alarm clock with just an Arduino board and an RTC. At first, the numbers only appeared on the serial monitor because I struggled with getting the LCD to light up. I wanted to go step by step in the process so that I can fully understand what was going on. This can be seen here where I prioritized connecting the RTC with the Arduino board to see if I can manipulate the date and time in the code:

Then, with the help of the circuit model made by Ali Hamza, I was able to get my LCD to light up. I soldered the RTC in the pins GND, SDA, SCL, and VCC. Unfortunately, because she used a different rtc (real time clock), I could not efficiently use her code and library.

A lot of my time was spent trying to find a way to connect both my rtc and LCD. Although I take a computer science class at school, I never really worked with code that's this expansive. Finally, I did find some code that I could use to get both my rtc and LCD together and accurately show the time. It didn't work very well initially and showed a lot of errors in the date/time. I had to change the variables on top (all the #'s) and upload the correct library for it to work. The buzzer came later where I simply added the standard code for a buzzer on the arduino board and changed it so that it would beep at certain time intervals, like a real clock!

And more pictures!

If you follow the steps on Ali Hamza's site on where the wires go, you can then upload the rtc DS1307 in place of the rtc she uses and use the code I modified to suit for the DS1307 and the buzzer. Change the date and time to fit the laptop's date/time and it should be all set!

Code

Arduino Alarm Clock With DS1307 rtcJava
Just upload the code and plug the USB port in. The LCD should immediately light up showing the date and time
#include <Wire.h>
#include "RTClib.h"
#include <LiquidCrystal.h>
LiquidCrystal lcd(2,3,4,5,6,7);
//LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
RTC_DS1307 RTC;
#define buz 11
const int buzzer = 11;
 
void setup () {
    Serial.begin(9600);
    Wire.begin();
    RTC.begin();
    lcd.begin(16, 2);
    pinMode(buzzer, OUTPUT);
 
  if (! RTC.isrunning()) {
   Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
  //RTC.adjust(DateTime(__DATE__, __TIME__)); // Use ONCE then comment out and reload
  RTC.adjust(DateTime(2017,05,18,11,10,0)); // Set time manually ONCE as above
  }
}

void loop () {
    DateTime now = RTC.now();
    lcd.setCursor(0, 0);
    lcd.print(now.day(), DEC);
    lcd.print('/');
    lcd.print(now.month(), DEC);
    lcd.print('/');
    lcd.print(now.year(), DEC);
    lcd.print(' ');
    lcd.setCursor(0, 2);
     if (now.hour()<10)
    lcd.print('0');
    lcd.print(now.hour(), DEC);
    lcd.print(':');
     if (now.minute()<10)
    lcd.print('0');
    lcd.print(now.minute(), DEC);
    lcd.print(':');
    if (now.second()<10)
    lcd.print('0');
    lcd.print(now.second(), DEC);
    lcd.setCursor(12, 0);
    if (now.hour() == 10 && now.minute() == 53){
      Buzz();
    }
    
}
void Buzz() {
    tone(buzzer, 1000); // Send 1KHz sound signal...
    delay(500);        // ...for 1 sec
    noTone(buzzer);     // Stop sound...
    delay(500);        // ...for 1sec
  }

 void printTime() {
  int dayofweek;
   switch(dayofweek){
     case 1: 
     lcd.print("Mon");
     break;
     case 2:
     lcd.print("Tue");
     break;
     case 3:
     lcd.print("Wed");
     break;
     case 4:
     lcd.print("Thu");
     break;
     case 5:
     lcd.print("Fri");
     break;
     case 6:
     lcd.print("Sat");
     break;
     case 0:
     lcd.print("Sun");
     break;
    delay(1000);

   }
}

Schematics

Arduino Alarm Clock Circuit Model by Ali Hamza
Screen shot 2017 06 01 at 9 hynsgpo5js

Comments

Similar projects you might like

Alarm Clock and Timer Working Standalone

Project showcase by ozyRonald

  • 5,617 views
  • 6 comments
  • 10 respects

Alarm Clock

by Tittiamo

  • 46,964 views
  • 59 comments
  • 47 respects

Complete Digital Clock Including Alarm and Motion Sensor

Project tutorial by LAGSILVA

  • 13,590 views
  • 12 comments
  • 51 respects

Sensal - All Senses Alarm Clock

Project in progress by Leonid Piliptsevich

  • 8,783 views
  • 2 comments
  • 28 respects

Simple Alarm Clock with DS1302 RTC

Project tutorial by SurtrTech

  • 2,635 views
  • 11 comments
  • 15 respects

Arduino Alarm Clock Project

Project tutorial by CSteele

  • 1,689 views
  • 0 comments
  • 9 respects
Add projectSign up / Login