Arduino - Game'n'Watch
Introduction
The finished alarm clock (containing many special features) is shown in the following photos:
displaying the time (horizontal) |
displaying the time (vertical) |
|
|
The functions of the clock are as follows:
- Horizontal or vertical clock mode
- Alarm clock with melody
- Set time, date, alarm
- Custom messages on birthdays or special days of the week
- Night mode clock display
- Date: day of the month, month, day of the week
- Thermometer
- Snake-like game with accelerometer as controller
The Hardware
The Processor Board
I therefore switched to the regular «Arduino Duemilanove» board (Atmega 328) and later to the updated version (with better USB support) called «Arduino Uno».
The Custom-made PCB
- Real time clock with backup battery (RTC1307)
- Temperature Sensor (TMP102)
- Accelerometer (ADXL345)
- Buzzer
- Rotary Encoder Switch
In the near future I will provide the schematic and the layout files for download. These can then be opened and edited with the free edition of Eagle PCB. Photos of the soldered and unsoldered PCBs are shown below:
front side (w/o parts) | back side (w/o parts) |
|
|
|
|
front side (with parts) | back side (with parts) |
The Other Parts
The form factor of the accelerometer that I wanted (one with I2C interface) was too small for me to easily solder at home with my cheap soldering iron. I therefore chose the breakout board for the accelerometer, too, and stuck it directly onto my PCB with a connector.
The buzzer is reasonably loud to serve as an alarm clock, and the rotary switch works fairly reliable.
As a case, I chose a Japanese tissue box that had exactly the desired size. I bought it in Ginza, Tokyo at Kyukodo for about JPY 500. The complete hardware inside the Japanese paper box looks as follows:
|
The Software
There are classes for each hardware part, and some comments inside the classes should explain further details. The code can be downloaded in the Downloads section.
Operating the Hardware
Displaying the Time
displaying the time (horizontal) |
displaying the time (vertical) |
|
|
If the alarm is active, a single green dot is on in the right upper corner for both horizontal and vertical modes. In horizontal mode, the day of the month is encoded in binary, starting from the left upper dot (16 - 8 - 4 - 2 - 1; e.g., for the above photo: 16+8+4+2 = 30). The month is also encoded in the middle of the top row of the display with green dots. The two separator dots are blinking with a rate of 2 seconds (1 sec ON/ 1 sec OFF).
By rotating the switch one step forward, the alarm is switched on. The time of the currently set alarm is displayed for a few seconds in yellowish color, before returning to the normal time mode.
Pressing the rotary switch once, switches the clock to night mode.
Night Mode
|
The first version of a "night mode" using one dot for the hour and one dot for the minute (minutes with a precision of 5 minutes. |
Unfortunately, I am not satisfied yet with the current approach. Please experiment and let me know your ideas.
Clicking once more leads us to the "Date Mode".
Date Mode
|
Day of the month and month in numbers (red); the day of the week is displayed with the two green dots (photo: 30.01, 7 -> Sunday). |
Clicking once more leads us to the "Temperature Mode".
Temperature Mode
|
Clicking again leads us to the "Game Mode".
Game Mode
Both displays are the play-field (8x16 dots) , and the snake has to navigate around the field, eating the green apples, and avoiding to bump into a wall or into itself. By eating the apples, the snake gets extra points and grows in length. Over time, the speed increases automatically.
Game play | Game play |
|
|
|
|
Display of points | Display of points |
Once the snake bumps into itself or into a wall (edge of display), the game is over and the points are being displayed. The points are computed by considering the "length of survival" and the "number of eaten apples". The running game is shown in the following video:
After a few seconds, the game restarts automatically. The game mode can be left by single-clicking the rotary switch.
Messages
In the current software version, messages are displayed in the morning at 7AM during weekdays, and at 8AM and 9AM on weekends (Saturday and Sunday). The following photos display the scrolling text for "Wochenende" ("weekend" in German):
(1) | (2) |
|
|
|
|
(3) | (4) |
Setting Alarm, Time, and Date
The "alarm-settings mode" is emphasized by using the orange colors for the display. The number that is actively set is marked with a red overbar as can be seen in the following photos. By single-clicking, we can switch from setting the hours to setting the minutes.
Setting the hours of the alarm | Setting the minutes of the alarm |
|
|
The alarm can be adjusted by rotating the rotary switch either backwards (increasing the time) or forwards (decreasing the time). Once the alarm is set, it is automatically activated.
By single-clicking the switch, we now arrive at the menu for setting time and date. This mode is emphasized by using green leds for the display as can be seen in the following six photos:
(1) Setting the hours | (2) Setting the minutes |
|
|
(3) Setting the day of the month |
(4) Setting the month |
|
|
(5) Setting the day of the week |
(6) Setting the year (2 digits only) |
|
|
The Alarm
Here's a video of the alarm clock playing the melody:
Downloads
Complete Software Files Download
The PCB was designed with the free version of Eagle PCB, both schematic and layout can be downloaded here:
Complete Hardware Files Download
Final Comments
Contact Information
Matthias Frey: matthias (at) komakino.ch
Copyleft

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.