Components and supplies
Jumper wires (generic)
Standard LCD - 16x2 White on Blue
Potentiometer (10K)
Arduino UNO
Thermistor
Buzzer
DS3231 RTC Module
Tools and machines
3D Printer (generic)
Project description
Code
Arduino Alarm Clock Project
c_cpp
Displays time, date, temperature. Has the ability to set alarm time.
1/* 2Name: Christopher S. 3Date: 8/26/2018 4Project: Use DS3231 RTC 5 to print Time, Date.. Use Thermistor for temp. Ability to set Alarm. 6*/ 7 8//----------------------------------------------------------------------------- 9 10// 11 Define variables. 12 13#include <DS3231.h> //Library for RTC 14 15#include 16 <Wire.h> //Allows comunication with TWI (Two Wire Interface) 17 18#include <LiquidCrystal.h> 19 //Used for DS3231 and thermister 20 21LiquidCrystal lcd(2, 3, 4, 5, 6, 7); //Pins 22 used by the LCD 23 24DS3231 rtc(SDA, SCL); 25 26Time t; 27 28#define buz 29 11 30 31int tempPin = 0; 32 33int Hor; 34 35int Min; 36 37int Sec; 38 39int 40 tempC; 41int tempF; 42 43int tempCDS3231; 44int tempFDS3231; 45 46 47//------------------------------------------------------------------------- 48// 49 Used to fix Date, Time, Day of Week 50 51 // Uncomment to adjust. Be sure to 52 // back once fixed. 53 54 //rtc.setDOW(WEDNESDAY); // Set Day-of-Week to 55 SUNDAY 56 57 //rtc.setTime(01, 33, 00); // Set the time to 12:00:00 (24hr 58 format) 59 60 //rtc.setDate(23, 8, 2018); // Set the date to August 8th, 2018 61 62//-------------------------------------------------------------------------- 63 64 65void 66 setup() 67 68{ 69 70 Wire.begin(); 71 72 rtc.begin(); 73 74 Serial.begin(9600); 75 76 77 pinMode(buz, OUTPUT); 78 79 lcd.begin(16,2); 80 81 lcd.setCursor(0,0); 82 83 84 t = rtc.getTime(); 85 86 Hor = t.hour; 87 88 Min = t.min; 89 90 Sec = t.sec; 91 92 93 94} 95 96 97//--------------------------------------------------------------------- 98 99 100void 101 loop() 102 103{ 104 int tempReading = analogRead(tempPin); 105 // This is OK 106 107 double tempK = log(10000.0 * ((1024.0 / tempReading - 1))); 108 tempK = 1 / 109 (0.001129148 + (0.000234125 + (0.0000000876741 * tempK * tempK )) * tempK ); // 110 Temp Kelvin 111 int tempC = tempK - 273.15; // Convert Kelvin to Celcius 112 113 int tempF = (tempC * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit 114 115//------------------------------------------------------------------------------------------- 116//Can 117 change the ABOVE tempC and tempF "int" to "float" this can give you temperatures 118 with two decimal points. 119//Can also use "lcd.print(tempF, 1);" BELOW to print 120 with one decimal place or "lcd.print(tempF, 0);" // print without decimal place 121//------------------------------------------------------------------------------------------- 122 123 124lcd.setCursor(0,0); //Top line of the LCD 125lcd.print(" "); 126lcd.print(rtc.getTimeStr()); 127lcd.print(" 128 "); 129lcd.setCursor(0,1); 130lcd.print(" "); 131lcd.print(rtc.getDateStr()); 132 133 134//---------------------------------------------------------- 135 136 137 lcd.setCursor(0,1); //Second line of the LCD 138 139tempFDS3231 = (tempCDS3231 140 * 1.8) + 32.0; // Convert C to F 141tempCDS3231 = (rtc.getTemp()); 142 143 lcd.setCursor(0,1); 144 145 lcd.print(tempF); 146 lcd.print((char)223); //This creates a Degree symbol 147 lcd.print("F 148 "); 149 lcd.print(rtc.getDateStr()); 150 151 152//-------------------------------------------------------------------------- 153 154 155 t = rtc.getTime(); 156 157 Hor = t.hour; 158 159 Min = t.min; 160 161 Sec = 162 t.sec; 163 164 165//------------------------------------------------------------------------------------------- 166//Use 167 the BELOW "if" statement to set your desired alarm time 168 if( Hor == 10 && (Min 169 == 00 || Min == 00)) //Comparing the current time with the Alarm time 170//------------------------------------------------------------------------------------------- 171 172{ 173Buzzer(); 174 175Buzzer(); 176 177lcd.clear(); 178 179lcd.print("Alarm 180 ON"); 181 182lcd.setCursor(0,1); 183 184lcd.print("Wake Up!!"); 185 186Buzzer(); 187 188Buzzer(); 189 190 191} 192 193 delay(1000); 194 195} 196 197 198 199 200void Buzzer() 201 202{ 203 204digitalWrite(buz,HIGH); 205 206delay(500); 207 208digitalWrite(buz, 209 LOW); 210 211delay(500); 212 213 214} 215
Arduino Alarm Clock Project
c_cpp
Displays time, date, temperature. Has the ability to set alarm time.
1/* 2Name: Christopher S. 3Date: 8/26/2018 4Project: Use DS3231 RTC to print Time, Date.. Use Thermistor for temp. Ability to set Alarm. 5*/ 6 7//----------------------------------------------------------------------------- 8 9// Define variables. 10 11#include <DS3231.h> //Library for RTC 12 13#include <Wire.h> //Allows comunication with TWI (Two Wire Interface) 14 15#include <LiquidCrystal.h> //Used for DS3231 and thermister 16 17LiquidCrystal lcd(2, 3, 4, 5, 6, 7); //Pins used by the LCD 18 19DS3231 rtc(SDA, SCL); 20 21Time t; 22 23#define buz 11 24 25int tempPin = 0; 26 27int Hor; 28 29int Min; 30 31int Sec; 32 33int tempC; 34int tempF; 35 36int tempCDS3231; 37int tempFDS3231; 38 39 40//------------------------------------------------------------------------- 41// Used to fix Date, Time, Day of Week 42 43 // Uncomment to adjust. Be sure to // back once fixed. 44 45 //rtc.setDOW(WEDNESDAY); // Set Day-of-Week to SUNDAY 46 47 //rtc.setTime(01, 33, 00); // Set the time to 12:00:00 (24hr format) 48 49 //rtc.setDate(23, 8, 2018); // Set the date to August 8th, 2018 50 51//-------------------------------------------------------------------------- 52 53 54void setup() 55 56{ 57 58 Wire.begin(); 59 60 rtc.begin(); 61 62 Serial.begin(9600); 63 64 pinMode(buz, OUTPUT); 65 66 lcd.begin(16,2); 67 68 lcd.setCursor(0,0); 69 70 t = rtc.getTime(); 71 72 Hor = t.hour; 73 74 Min = t.min; 75 76 Sec = t.sec; 77 78 79 80} 81 82 83//--------------------------------------------------------------------- 84 85 86void loop() 87 88{ 89 int tempReading = analogRead(tempPin); 90 // This is OK 91 double tempK = log(10000.0 * ((1024.0 / tempReading - 1))); 92 tempK = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * tempK * tempK )) * tempK ); // Temp Kelvin 93 int tempC = tempK - 273.15; // Convert Kelvin to Celcius 94 int tempF = (tempC * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit 95 96//------------------------------------------------------------------------------------------- 97//Can change the ABOVE tempC and tempF "int" to "float" this can give you temperatures with two decimal points. 98//Can also use "lcd.print(tempF, 1);" BELOW to print with one decimal place or "lcd.print(tempF, 0);" // print without decimal place 99//------------------------------------------------------------------------------------------- 100 101lcd.setCursor(0,0); //Top line of the LCD 102lcd.print(" "); 103lcd.print(rtc.getTimeStr()); 104lcd.print(" "); 105lcd.setCursor(0,1); 106lcd.print(" "); 107lcd.print(rtc.getDateStr()); 108 109 110//---------------------------------------------------------- 111 112 lcd.setCursor(0,1); //Second line of the LCD 113 114tempFDS3231 = (tempCDS3231 * 1.8) + 32.0; // Convert C to F 115tempCDS3231 = (rtc.getTemp()); 116 117 lcd.setCursor(0,1); 118 lcd.print(tempF); 119 lcd.print((char)223); //This creates a Degree symbol 120 lcd.print("F "); 121 lcd.print(rtc.getDateStr()); 122 123 124//-------------------------------------------------------------------------- 125 126 t = rtc.getTime(); 127 128 Hor = t.hour; 129 130 Min = t.min; 131 132 Sec = t.sec; 133 134 135//------------------------------------------------------------------------------------------- 136//Use the BELOW "if" statement to set your desired alarm time 137 if( Hor == 10 && (Min == 00 || Min == 00)) //Comparing the current time with the Alarm time 138//------------------------------------------------------------------------------------------- 139 140{ 141Buzzer(); 142 143Buzzer(); 144 145lcd.clear(); 146 147lcd.print("Alarm ON"); 148 149lcd.setCursor(0,1); 150 151lcd.print("Wake Up!!"); 152 153Buzzer(); 154 155Buzzer(); 156 157 158} 159 delay(1000); 160 161} 162 163 164 165 166void Buzzer() 167 168{ 169 170digitalWrite(buz,HIGH); 171 172delay(500); 173 174digitalWrite(buz, LOW); 175 176delay(500); 177 178 179} 180
Downloadable files
Ali Hamza Alarm Clock Schematic
Ali Hamza Alarm Clock Schematic
Ali Hamza Alarm Clock Schematic
Ali Hamza Alarm Clock Schematic
Documentation
Button
Button
Base
Base
Thingiverse
https://www.thingiverse.com/thing:3079571/zip
https://www.thingiverse.com/thing:3079571/zip
Back
Back
Thingiverse
https://www.thingiverse.com/thing:3079571/zip
https://www.thingiverse.com/thing:3079571/zip
Back
Back
Button
Button
Base
Base
Top
Top
Comments
Only logged in users can leave comments