Arduino alarm clock with Phi-1 shield

ATTENTION:You are reading an old post. The hardware and code mentioned here have long been upgraded.

Visit this link:

Phi-2 shield

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:

Arduino Duemilanove or UNO

Phi-1 shield kit

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: