Arduino alarm clock with Phi-1 shield
November 25, 2010 9 Comments
I’ve thought about this for a while, make an alarm clock and be waken up by my own creation (I guess babies will do but they wake you too early).
I will need a real time clock chip (DS1307) to keep the time, arduino to display it on an LCD or LED matrix. I also need a buzzer to make some noise and a high-brightness LED to make flashy lights. Besides I need to program it so that it takes user input: adjust the time and date, set alarm with various settings “weekday, weekend, daily, once, off”. More importantly, I need to make sure a special key stops the alarm so I can get back to sleep!
Here is a flow chart of the alarm clock:

Well, let’s get to work. I’d like to get the “adjust clock” to work first. I know just the right tricks to do the job. I took a part of my other project, which is the human machine interface, added a few features, and poured it into the adjust clock and alarm. The functions simply take an initial value, its upper and lower boundary, and step. It renders the numbers or information and takes user inputs like up and down and confirm. It traps until the user finishes with the input and returns the entered value. The rest of the work is just labor.
The alarm function isn’t too hard either. You take an alarm time and compare with current time, then decide if the alarm criterion fits with the day of the week. I wrote a simple function within() to determine if the current day is within the alarm’s criterion, like Thursday is both daily and weekday.
The alarm isn’t too hard either. I picked a tone that is close to the clock I used years back and make it turn on and then off repeatedly four times. That was the alarm.
We will construct a fully-interactive arduino powered alarm clock with the following functions:
1. Displays the time and date
2. User adjustable time and date
3. User settable alarms with various settings “weekday, weekend, daily, once, off”, with buzzer and flashy led to wake you up.
4. More importantly, a special key that stops the alarm so you can get back to sleep!
5. Use the alarm function to power any shenanigans you want against your sleepy head ![]()
We will need the following parts:
We will need the following tools:
1. A soldering iron. Anything from radioshack will work just fine. I use a set that is $8 with the iron and a few tools including some solder.
2. 45 degree cutter for electrical cords, to trim after you’re done solder. You can buy one from radioshack or other places.
3. Optional third hand for holding circuit board. I can just lay the board down and solder it
4. Masking tape to hold down parts to be soldered
Code:
Alarm clock (buzzer and LED) This program is a fully-functional alarm clock. You will find it more complex than the basic clock. If you can’t understand, try the Clock display first.
For more information on Phi-1 shield, read its webpage!
Here is a video:













Looks like you are an expert in this field, you got some great points there, but you’ll want to add a facebook button to your blog. I just bookmarked this article, although I had to complete it manually. Simply my $.02
- Daniel
Thanks Daniel. I will look into adding the button tonight!
Just added a link on my Phi-1 shield page. Will add to every post soon!
Hi,
your clock is very nice,
but can you add few things
I want set alarm end time minute increments and
I want two separate outputs
I can do that, will find time:)
What do you mean by two separate outputs? Alarms?
There are two outputs buzzer and led, I want use two outputs to control various devices (relays) different time
Thank you very much for an awesome shield. It was a snap to assemble but I am having a bit of difficulty with the buzzer. The buzzer in my kit appears to be somewhat different from the one in the video…maybe piezo…not sure. Bottom line is I cannot get the buzzer to buzz even though the L.E.D. will flash. Everything else works beautifully. I followed directions to the letter (outstanding detail by the way) and, yes, the buzzer is oriented with the positive lead at the top. Thank you very any help you can provide.
Hey, thanks for purchasing the shield. Could you send me a picture of the buzzer showing it marking on the side and the assembled board, top and bottom? I’ll email you my email address.
Thank you so very much for replying. I strained a neuron and failed to notice I had not installed the buzzer resistor (R2). I noticed my error when I zoomed in on Figure 2 under paragraph 10 of your build guide. Apologies for my error which I literally just discovered.
Dipmicro is currently packaging a “Magnetic Transducer PB-1226PEAQ by Mallory” as the buzzer for your shield. The buzzer works perfectly fine (as I have just now installed R2 and tested the unit) however it does not exactly match the image of the buzzer in your build photo. Your build guide is very well written and everything was very easy to set up…minus my error.
I am sorry to see DipMicro is out of stock on your shield as I have already told several people about it. Do you have an idea as to when it will be back in stock…or the status of the Phi-2? Again, thank you very much for your reply and for developing an awesome shield.
Have an OUTSTANDING day!
P. Shay