Arduino - Game'n'Watch


This Arduino project was based on the «Illy Clock» project by Florin Chiperi. I used his software and hardware designs as a starting point for this «Game'n'Watch» project. He was also kind enough to send me extra LED matrices and answer my questions. Thanks! And now go and buy stuff from his shop!

The finished alarm clock (containing many special features) is shown in the following photos:

displaying the time
displaying the time

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

All parts required for this project (except for the outer box) are shown in the picture below. (By clicking on the image, a larger picture with brief description will pop up.)

The Processor Board

The core of this design is the Arduino platform. I started out with a «Japanino»-board from «Otona no Kagaku» which is based on the Atmega 168V processor. However, various problems arose while programming: It seems that either my board had memory problems, or the compiler was not fully compatible.

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

The PCB is also based on the design of the «Illy Clock». However, I extended it for my needs and added the following components:
  • Real time clock with backup battery (RTC1307)
  • Temperature Sensor (TMP102)
  • Accelerometer (ADXL345)
  • Buzzer
  • Rotary Encoder Switch
RTC chip, thermometer chip, and the accelerometer were all connected through the I2C bus. The Buzzer was attached to the Arduino's "analog" PWM output, and the Rotary encoder switch was read by the analog input of the Arduino, the switch by the digital port (I needed that for HW-interrupt creation).

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

I used two break-out boards instead of single components for the clock design. I wanted to separate the thermometer from the PCB, to get away from the warm display a bit more. I therefore used a breakout board for that and connected it through longer wires to the PCB.

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

Because of the initial memory problems experienced while using the «Japanino» board, the code might at times look odd: In a first version, I tried to initialize all memory in the main program, and the classes were mainly a collection of methods, operating on global variables.

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

The clock has various features and I will try to describe them in the following paragraphs and pictures as precisely as possible. We can switch between modes by single-pressing the rotary switch.

Displaying the Time

The most useful operation mode is clearly displaying the time. I have experimented with various fonts and displays. As already shown before, the clock adjusts the display automatically with the setup orientation--horizontally or vertically:

displaying the time
displaying the time

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 night mode is a preliminary "feature". As the display is rather bright, and I cannot dim the whole display easily, the idea was to display the time with as few LEDs as possible.

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

The "date mode" displays the day of the month and the month with numbers. The day of the week (Monday -> 1, Sunday -> 7) is encoded with the two green dots in the top row of the display.

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

The measured temperature seems to be somewhat higher than the real room temperature, I think. But I have not yet made an effort to calibrate it, or to take the sensor further away from the display. The temperature is displayed with a precision of 0.1 degrees Celsius.

Clicking again leads us to the "Game Mode".

Game Mode

The implemented game is a simple version of "snake" that was popular on Nokia phones, and similar to the game inspired by the movie "Tron". One special feature is, that the game is controlled through the accelerometer.

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.


Another special feature of this alarm clock are the messages that it displays every hour on special occasions (e.g., New Years, Christmas, pre-set birthdays), or in the morning for weekdays or weekends. The text is displayed as scrolling text. The source code for the scrolling text feature was also "stolen" from the «Illy Clock».

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

By double-clicking the rotary switch, the clock goes into the "alarm-setting mode". While in any "settings mode", double-clicking sends us back to the "time display mode".

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

For the alarm melody, I chose the "5 o'clock song" of Tokyo called "Yuyake Koyake". I switch off the display-refresh while the alarm is playing, as the refresh interfered with the PWM output necessary for playing the music. This is not a feature, rather a bug. Any advice on that problem is appreciated!

Here's a video of the alarm clock playing the melody:


The Software was written with the Arduino Software v0021, the libraries were written in C++.

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

This is work in progress and the alarm clock can be extended more. Please feel free to do so!

Contact Information

If you have any questions, feel free to contact me:

Matthias Frey: matthias (at)


There is no copyright on neither the software nor the hardware. I based my work on other people's work. If you decide to build on this project (hardware or software), feel free to do so. If possible, please let me know and even refer to this site in your project. And be sure to release everything into the public domain later for others to profit. Thank you.

Creative Commons License

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

May 12th, 2011 - matthias frey