Introduction: Alarmclock
This is an instructable for an alarmclock. We made an alarmclock because we are always to late or we often forget to set the alarm.
This alarmclock is totally automatic, so you don't have to set your alarm. You can choose a different wake-up time for everyday. You have to set the wake-up time once, and then your alarm goes on the chosen time.
Step 1: Materials
1. Arduino
We used an Arduino Uno. You can connect the Arduino to the computer with an USB-cable. To program the Arduino, you need the Arduino Sketch program on your computer.
2. Real Time Clock
The Real Time Clock, named RTC, is an computer-clock. The RTC updates the time, so you have to set the time once. We used the RTC ZS-042
3. Liquid Crystal Display
The Liquid Crystal Display, named LCD, is a screen which you can connect to the arduino.
4. Breadboard
To make electric circuits, it is very useful to have a breadboard. The Arduino controls every single pin.
5. Female and Male wires
To connect the electric components, you can use these wires. You can connect the male and the female wires with the holes and the pins.
6. Buzzer
The buzzer makes the sound for your alarmclock.
7. USB-cable
You can connect the Arduino to the computer with the USB-cable, so you can program the Arduino.
8. 9 volt battery
9. Battery clip
To connect the arduino with the 9 volt batty, you need this clip.
10. Lego
We made our protective cover with lego, but you can choose something else if you want.
Step 2: Connect the RTC
To connect the RTC to the arduino, we need the RTC, the Arduino, the Breadboard, female and male wires.
Connection Arduino
-GND: place at position j12 of the breadboard
-8: Place at position j10 of the breadboard
Connection RTC:
- 32K: place at A5 in the Arduino
-SQW: place at Vin in the Arduino
- SCL: Place at position h30 of the breadboard
- SDA: Place at position g30 of the breadboard
-VCC: don't place this one
-GND: place at GND in the Arduino
Step 3: Set the Time
First, you have to explain the RTC in the sketch:
#include
DS3231 rtc(SDA, SCL);
Now, you can set the time:
rtc.begin();
rtc.setDOW(FRIDAY); // Set Day-of-Week to SUNDAY
rtc.setTime(15, 49, 0); // Set the time to 12:00:00 (24hr format)
rtc.setDate(13, 4, 2018);
You can check your time at the serial monitor.
Step 4: Connect the LCD
Now you have to connect the LCD to the Arduino. We connect 4 wires from the LCD to the Arduino or the breadboard. You have to connect the wires like this:
- GND: place at GND into the arduino
- VCC: place into the powerrail of the breadboard
- SDA: place at position j29 of the breadboard
- SCL: place at position f30 of the breadboard
Step 5: Set Up the LCD
You have to explain the LCD in the sketch. You have to do it like this:
#include <LCD.h>
In this part of the code is explained that the LCD will show the date and time on the screen.
void setup()
{ lcd.begin(16,2); for(int i = 0; i<5; i++){ lcd.noBacklight(); delay(500); lcd.backlight(); lcd.print(" Terror alarm"); delay(500); lcd.clear(); }
Step 6: Connect the Buzzer
The buzzer is placed at pin h10 and in pin h12 of the breadboard. The tone is indicated by the word ‘tone’. In our sketch we have chosen this tone for the alarm: tone (10,440,200).
Step 7: Install the Alarm
We have chosen to make an automatic alarm clock. We have set the alarm clock from Monday till Saturday. We often have the problem that we forget to set our alarm clock, this is the solution for our problem. We have adjusted the alarm at our school schedule. If the alarm goes of there is a beep and the screen flashes. This is the code for the alarmcheck in de void loop:
alarmcheck();
if(t.min==15 && t.hour==7){ lcd.noBacklight(); delay(5000); lcd.backlight(); tone(10,440,200); } }
void alarmcheck(){ if (t.min==15 && t.hour==7 && rtc.getDOWStr(FORMAT_LONG)=="Monday"){ alarm(); } if (t.min==45 && t.hour==9 && rtc.getDOWStr(FORMAT_LONG)=="Tuesday"){ alarm(); } if (t.min==14 && t.hour==13 && rtc.getDOWStr(FORMAT_LONG)=="Wednesday"){ alarm(); } if (t.min==45 && t.hour==7 && rtc.getDOWStr(FORMAT_LONG)=="Thursday"){ alarm(); } if (t.min==45 && t.hour==7 && rtc.getDOWStr(FORMAT_LONG)=="Friday"){ alarm(); } if (t.min==15 && t.hour==9 && rtc.getDOWStr(FORMAT_LONG)=="Saturday"){ alarm(); } }
void alarm(){ lcd.noBacklight(); delay(1000); lcd.backlight(); for(int i = 0; i<100; i++){ tone(10,200*i+200); } }
When there is no alarm you can see the time and the date on the display. This is the code:
t = rtc.getTime();
Serial.println(rtc.getDOWStr(FORMAT_LONG)); lcd.setCursor(0,0); lcd.print("Time: "); lcd.print(rtc.getTimeStr()); lcd.setCursor(0,1); lcd.print("Date: "); lcd.print(rtc.getDateStr()); delay(1000); lcd.clear();
Step 8: Make the Protective Cover
All electric components are connected by now. The only thing we need is the protective cover. We made the protective cover from Lego, but you can choose whatever you want.
Step 9: Use Your Alarmclock
Now, the alarm clock is ready to use. You will never come late, because of this automatic alarm clock!