Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
clicshnycorg
Published © GPL3+

Arduino Alarm Clock

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

IntermediateWork in progress34,292
Arduino Alarm Clock

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Buzzer
Buzzer
Buzzer goes on pin 11 and ground
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
These will be necessary when you solder the rtc
×1
Male Header 40 Position 1 Row (0.1")
Male Header 40 Position 1 Row (0.1")
×1
Real Time Clock (RTC)
Real Time Clock (RTC)
rtc DS1307 https://www.amazon.com/JBtek%C2%AE-DS1307-AT24C32-memory-Arduino/dp/B00UUR8GJU
×1
Jumper wires (generic)
Jumper wires (generic)
×1
RGB Backlight LCD - 16x2
Adafruit RGB Backlight LCD - 16x2
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
Resistor 100 ohm
Resistor 100 ohm
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1
Breadboard (generic)
Breadboard (generic)
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Arduino Alarm Clock Circuit Model by Ali Hamza

Code

Arduino Alarm Clock With DS1307 rtc

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

   }
}

Credits

clicshnycorg

clicshnycorg

0 projects • 2 followers

Comments