Project tutorial
Arduino Alarm Clock Project

Arduino Alarm Clock Project © GPL3+

Snap together 3D-printed case for an Arduino alarm clock!

  • 4,483 views
  • 0 comments
  • 12 respects

Components and supplies

Necessary tools and machines

3drag
3D Printer (generic)

About this project

Arduino Alarm Clock Project

Design Tools

Inventor

Information

Snap Together Case for an Arduino Uno Alarm Clock with date and temperature display.

Parts List (Required)

(All electrical components found in an Elegoo "Most Complete Starter Kit")

  • Arduino Uno
  • LCD 1602 Module
  • DS3231 RTC
  • Active Buzzer
  • Potentiometer (10K)
  • Thermistor
  • Dupont Wires
  • 3D Printed Parts (4)

Parts (optional)

  • Thermistor - The DS3231 has a built in temperature reading device, but it is used more as an internal temperature reading and takes about a minute to update when temp changes.

Libraries

Makuna Rtc

  • #include <DS3231.h> //Library for RTC

Make sure you use this same library otherwise aspects of the code will cause an error!

--------------------------------------------------------------------------------

  • #include <Wire.h> //Allows comunication with TWI (Two Wire Interface)
  • #include <LiquidCrystal.h> //Used for DS3231 and thermister
  • LiquidCrystal lcd(2, 3, 4, 5, 6, 7); //Pins used by the LCD

Additional Information

  • Code can be found on Thingiverse with Files.
  • To fellow Americans...The Date displays dd/mm/yyyy
  • TemperatureCan be displayed in Celcius by removing conversion in code.
  • Soon to come.. Replacement knob for Potentiometer. Way to use the reset button for turning off alarm.. (would appreciate help from code ninjas)

Sources

In order to build and code the alarm aspect of this clock I used some of the steps included in this "Maker Pro" tutorial by Ali Hamza.

https://maker.pro/arduino/projects/arduino-alarm-clock-using-real-time-clock-lcd-screen/

Thing License

Arduino Alarm Clock Project by CSteele0514 is licensed under the Creative Commons - Attribution license.

What does this mean?

  • Remixing or Changing this Thing is allowed.
  • Commercial use is allowed.

Code

Arduino Alarm Clock ProjectC/C++
Displays time, date, temperature. Has the ability to set alarm time.
/*
Name: Christopher S.
Date: 8/26/2018
Project: Use DS3231 RTC to print Time, Date.. Use Thermistor for temp. Ability to set Alarm.
*/

//-----------------------------------------------------------------------------

// Define variables.

#include <DS3231.h>   //Library for RTC

#include <Wire.h>   //Allows comunication with TWI (Two Wire Interface)

#include <LiquidCrystal.h>  //Used for DS3231 and thermister

LiquidCrystal lcd(2, 3, 4, 5, 6, 7);  //Pins used by the LCD

DS3231  rtc(SDA, SCL);

Time  t;

#define buz 11

int tempPin = 0;

int Hor;

int Min;

int Sec;

int tempC;
int tempF;

int tempCDS3231;
int tempFDS3231;


//-------------------------------------------------------------------------
// Used to fix Date, Time, Day of Week

  // Uncomment to adjust. Be sure to // back once fixed.

  //rtc.setDOW(WEDNESDAY);     // Set Day-of-Week to SUNDAY

  //rtc.setTime(01, 33, 00);     // Set the time to 12:00:00 (24hr format)

  //rtc.setDate(23, 8, 2018);   // Set the date to August 8th, 2018

//--------------------------------------------------------------------------


void setup()

{  

  Wire.begin();

  rtc.begin();

  Serial.begin(9600);

 pinMode(buz, OUTPUT);

  lcd.begin(16,2);     

  lcd.setCursor(0,0);

 t = rtc.getTime();

  Hor = t.hour;

  Min = t.min;

  Sec = t.sec;



}


//---------------------------------------------------------------------


void loop()

{
  int tempReading = analogRead(tempPin);
  // This is OK
  double  tempK = log(10000.0 * ((1024.0 / tempReading - 1)));
  tempK = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * tempK * tempK )) * tempK );       //  Temp Kelvin
  int tempC = tempK - 273.15;            // Convert Kelvin to Celcius
  int tempF = (tempC * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit

//-------------------------------------------------------------------------------------------
//Can change the ABOVE tempC and tempF "int" to "float" this can give you temperatures with two decimal points.
//Can also use "lcd.print(tempF, 1);" BELOW to print with one decimal place or "lcd.print(tempF, 0);" // print without decimal place
//-------------------------------------------------------------------------------------------
  
lcd.setCursor(0,0);  //Top line of the LCD
lcd.print("    ");
lcd.print(rtc.getTimeStr());
lcd.print("    ");
lcd.setCursor(0,1);
lcd.print("      ");
lcd.print(rtc.getDateStr());


//----------------------------------------------------------

  lcd.setCursor(0,1);  //Second line of the LCD

tempFDS3231 = (tempCDS3231 * 1.8) + 32.0; // Convert C to F
tempCDS3231 = (rtc.getTemp());

 lcd.setCursor(0,1);
 lcd.print(tempF);
 lcd.print((char)223); //This creates a Degree symbol
 lcd.print("F  ");
 lcd.print(rtc.getDateStr());


//--------------------------------------------------------------------------

  t = rtc.getTime();

  Hor = t.hour;

  Min = t.min;

  Sec = t.sec;


//-------------------------------------------------------------------------------------------
//Use the BELOW "if" statement to set your desired alarm time
 if( Hor == 10 &&  (Min == 00 || Min == 00)) //Comparing the current time with the Alarm time
//-------------------------------------------------------------------------------------------

{
Buzzer();

Buzzer();

lcd.clear();

lcd.print("Alarm ON");

lcd.setCursor(0,1);

lcd.print("Wake Up!!");

Buzzer();

Buzzer();


}
 delay(1000); 

}




void Buzzer()

{

digitalWrite(buz,HIGH);

delay(500);

digitalWrite(buz, LOW);

delay(500);


} 

Custom parts and enclosures

Thingiverse
https://www.thingiverse.com/thing:3079571/zip
Button

Schematics

Ali Hamza Alarm Clock Schematic
Arduinoclock uqa9ri5ax1

Comments

Similar projects you might like

Alarm Clock

by Tittiamo

  • 46,985 views
  • 59 comments
  • 47 respects

Simple Alarm Clock with DS1302 RTC

Project tutorial by SurtrTech

  • 2,635 views
  • 11 comments
  • 15 respects

Complete Digital Clock Including Alarm and Motion Sensor

Project tutorial by LAGSILVA

  • 12,678 views
  • 11 comments
  • 50 respects

Arduino Alarm Clock

Project in progress by Team The Underdog

  • 8,678 views
  • 3 comments
  • 14 respects

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

Project tutorial by Simone Adobs

  • 5,970 views
  • 3 comments
  • 30 respects

Alarm Clock and Timer Working Standalone

Project showcase by ozyRonald

  • 5,617 views
  • 6 comments
  • 10 respects
Add projectSign up / Login