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:

New Arduino shield – Phi-1

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

I have developed this shield in my spare time to make prototyping with Arduino much easier. The shield, when assembled, has one LCD monitor, 6 buttons, real time clock and battery backup for keeping time, EEPROM for data storage, GPS connector, buzzer, LED, and two RJ11 connectors for things you absolutely want secured against pull.

Here is a video of a 360 degree view of an assembled Phi-1 shield:

Just running a clock with DS1307 Real Time Clock (RTC) module

Running a testing routine to make sure everything works

Running a fully-functional alarm clock (it woke me up this morning) Details of making the alarm clock is on a separate post. The code is listed near the end of this post.

Morse encoder: type in a sentence and translate it into Morse code.

Function list:

  • 16X2 LCD character display
  • 6 push buttons –  four arranged in arrow keys and two more on the side
  • 2 RJ11 ports for long and robust connections with sensors or control devices
  • Optional buzzer and LED in place of the RJ11 ports
  • Real time clock with battery backup keeps the time when Arduino is turned off
  • EEPROM for easy data logging keeps data when Arduino is turned off. Use 24LC256 or compatible I2C EEPROM
  • GPS connector and breakout for this popular GPS module (http://www.sparkfun.com/commerce/product_info.php?products_id=465)
  • Reset button for Arduino
  • All Arduino pins are brought out for maximal flexibility.
  • Hackable for more functionalities (see the end of the assembling)

 Possible projects with this shield:

  • Alarm clock
  • Standalone or PC data logger
  • Lab data acquisition system (Physics, Chemistry etc)
  • Weather station
  • Input or operating panel, like security panels or garage door opener
  • Handheld GPS
  • Morse code generator
  • The list goes on… 

Documentation:

Phi-1 shield documentation revision 11/19/2010

PCB design:

Schematic:

Fully assembled shield running clock:

 

PCB and parts:

Connector board design pictures:

Standard board breaks out connections from the RJ11 jack and 5V/GND. The prototype space has 5V/GND running down middle for convenience. You can make a TTL-RS232 circuit on it, or maybe power an opamp, add I2C A/D converter to it or else. The screw terminals are pretty convenient and their connections are brought out for prototyping. You can also simply plug it into a breadboard. It also has two LED indicators and has connections for X, Y, 5V and GND.

The relay board has a standard AC or DC relay with control signal coming through the RJ11 jack from the main board. Several screw terminals are included for wiring. A power jack is also included so that it can easily power a single piece of equipment with the relay. You can turn on and off an electromagnetor else light with it. 

This board passes the RJ11 connection to a 3.5mm stereo plug. It also has an LED indicator.

Assembling pictures:

Sample codes:

Clock display This is a basic program that displays the Clock. You can modify it to suit your needs.

Testing all functions This program tests everything, LCD, buttons, the clock, and EEPROM if you have one on board. Learn the basics of everything with this program.

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 Click display first.

Morse encoder This program allows you to type in a sentence in letters, numbers, and symbols. Then it plays it in Morse code. Use the arrow up and down to type letters (think old-school arcade game record) use left and right to move cursor. Use B to enter.

More to come!

I am coordinating an effort to have it made in a small quantity so it will be affordable. If I have one made, it will cost me around $30, but if I have more made, I could cut the cost down and possibly have it for $12. Leave me a message if you’re interested in getting one. I might be able to get my favorate electronics online store to sell these so you could buy the board along with all needed components in one purchase.