Building a Graphical Alarm Clock with Arduino

LCD12864-faceI’m a fan of clock building. I’ve built several kits and designed a few from scratch, and I even teach others how to build their own. When I saw the DFRobot February Giveaway was one of six graphical LCD shields, my first thought for a proposal was some sort of clock. I recently completed a 6-month contract at a place that did not provide free coffee. There was a cafeteria where you could purchase coffee and get $0.25 refills. The catch was they closed at 13:30 every day. If I wanted that inexpensive refill, I had to remember to head down at least 10 minutes before they closed or they might be out for the day. About once a month, I arrived too late for an afternoon cuppa. It got me thinking about building a coffee alarm. Of course I could write an app or use Google Calendar to remind me, but there was something more satisfying in thinking up a physical alarm clock that would light up and display a picture of a cup of coffee rather than just a piece of software popping up a window. One design involved laser-cutting a fixed image in a hunk of 12mm acrylic and lighting up the edge with an RGB LED module, but a graphical LCD would provide for multiple types of alarms, each with its own symbol to remind me what the alarm was for. I drafted a reply and sent it off and waited to hear the results.

Well, I won.

What I described in my proposal was essentially a stack of an Arduino Uno, a DS1307 battery-backed-up clock module, a piezo buzzer, and one of the contest’s DS12864 LCDs. The sketch would loop and display the current date/time while checking the joystick on the front of the LCD shield. When it detected user input, it would permit the date and time to be changed, alarms to be set, and pre-compiled icons to be attached to an alarm event. At the alarm time, it would make noise and replace the date/time with the pre-selected image. I also proposed possible later enhancements of a light-dependent resistor for engaging/disengaging the backlight, and an RGB LED to attract attention when the alarm was silent.

I’ve taught workshops with their older LCD Keypad shield so I’m not starting from a blank page. I plan to use the Arduino Time library, along with a DS1307 library as well as the DS12864 library provided by DFRobot. The only challenge to the hardware is how to fit the 1×4 pinout of the DS1307 module with the “servo connector” arrangement on the LCD board (there are several ways to do it – choosing one is the hard part). The software I plan to write as a Finite State Machine to handle the complexity of the user interface mixed with the ordinary cycle of display-alarm-display. My goal is to have a functional alarm clock within a couple weeks of receiving the LCD.

About these ads

One response to “Building a Graphical Alarm Clock with Arduino

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s