Updated Not so simple Clock,Timer,Alarm,Pong

Well this is my first complete project.
I figure I’d share it.
It’s on GitHub here Simple Clock

Who know maybe I’ll add more features later and make it an alarm clock, a timer, etc.

UPDATE: April 18 2017
I completed the clock app, added Alarm and Timer settings.
Also fixed bugs.

UPDATE: April 20 2017
Fixed bugs. and added Comments to virtually every lines of code

UPDATE: April 21 2017
Added time Offset for accuracy, Suggested by Dreamer3
So every 18 Minutes 32 Seconds 956 Millisecond, 1 second is removed.

UPDATE: April 22 2017.
Well the Offset is to much random.
Battery charge, temperatures. to much variable and fluctuation. so I removed the Offset function.

UPDATE: April 24 2017.
Drastically changed and improved the interface.
OLD version ClockAlarmTimer

UPDATE: April 26 2017
Wow this project has gotten more complex, Not so simple clock anymore.
Added Screensaver options Turn off screen or Pong (AI or Playable)
See Readme for more details
Started a new branch for this on GitHub,

UPDATE: April 28 2017
Now using arduboy2 version 4.0 new functions displayOn() and displayOff()
also fixed a small bug.
Latest Version Here Enjoy


I have a thing for clocks, thank you for making this.

Would it be possible to have a larger digit font for easy viewing?

And, could this be expanded to include a game, off the top of my head, something like Pong Clock. I could load this up to tell the time and be free of a cell phone / watch and have quick games of Pong too. And when not playing, Pong plays itself while the score tells the time. Something like this:

1 Like

The big problem is no time chip and you lose the time if you turn it off… has anyone done power tests to see how long it’ll lost with the screen off but keeping time?

If anyone want help with additional power saving hit me up. There are opportunities to power down the chip further than you get with the default frame power keeping. Additionally something wanting to run for long periods (days) could do the following:

  • deep sleep
  • watchdog timer (might not be possible to deep sleep and keep time, since we have no clock chip)
  • turn off power to USB

During typically use the OLED screen is a majority of the power usage - but if you’re going to have it off for extended periods of time then how much battery the actual CPU uses starts to make a difference. It should be possible to run the CPU alone for a month or more on just the battery - though I’m not sure how much power the OLED sips when “off”.

1 Like

The next version of the Arduboy2 library has functions to power down/up the display. My testing shows that the majority of power used by the display is the pixels themselves. Powering the display down doesn’t save much over just clearing it.


Also the precision you get from millis() is really poor. But I have to confess that the pong clock looks neat :sunny:

1 Like

If I needed precision time I’d wear a watch lol

but yeah, would be awesome of course if arduboy can keep precise time, but I’d be happy with “approximate” time, coupla minutes here and there not a problem for me, this is really “nostalgic” for me in a sense - if anyone remembers Game & Watch …

1 Like

Precision or accuracy? It should be pretty precise.

Well, maybe both :smiley: … In a long run

I just test how long it keeps it powers. It keep its power with the screen off for about 10hours, more or less 30 min, so that’s not bad I’d say.
I don’t know how fast it charges so who knows maybe a 5 min plug in every 9 hours could keep it on all day.

I have the frame rate set to 15, maybe I could drop it more for longer life time, yet again It shouldn’t matter since the screen is mostly off, lowering that would improve Screen On lifetime.

And for precision/accuracy its about 1-2 min over 10hours that’s decent.

If your code runs fast that won’t make a big difference. Turning off USB or going into deeper sleep with watchdog might though. Turning off USB completely saves about 50% CPU power.

You should be able to get better than that. You might have to find the average skew and build that into the code.

I’ve increased the digits size , great suggestion.
also fixed a bug with the 12h/24h swap

updated the file on GitHub, Clock Alarm Timer

1 Like

I don’t know what ‘watchdog’ is
Turning off USB could be a good idea.
I’m guessing once it runs out of power the USB will turn back on?

I’m still new to Arduino. Only started programing it a less than a week ago.

And I’ll do more testing on the accuracy.
I’ll keep it plug in for longer than the battery life time.

Well you could just turn off USB when the screen is off… or turn it off after the first x minutes etc… the only effect of having it off is you cant immediately “reflash” from the IDE since that requires USB on - so you’d have to use flashlight mode, etc… or build a way for your sketch to decide when USB should be on.

// on
++    USBCON &= ~(1 << FRZCLK);             // Freeze the USB Clock
++    PLLCSR |= (1 << PLLE);              // Disable the USB Clock (PPL)
++    USBCON |=  (1 << USBE  );
++    power_usb_enable();
// off
++    power_usb_disable();
++    USBCON |= (1 << FRZCLK);             // Freeze the USB Clock
++    PLLCSR &= ~(1 << PLLE);              // Disable the USB Clock (PPL)

I could add an way to turn on or off the USB. Button combination or something.

Is there a way to monitor battery level?
So i could have the USB to turn back on if the battery level dips under a certain level.

I been looking around for a way to monitor that before you mention anything I wanted to have a warning of some sort or even a battery level display.

Why? As soon as it’s plugged in it has power anyways.

There is a PR on Github right now that adds this functionality.

How about a photo of the app?

Here’s some picture.

Main Screen

Timer Screen

Alarm Screen, Top left show clock is now set to 24h version

Main Screen with Timer running and Alarm on


Newbie here, I don’t know how to get that.
I’ve tried searching the GitHub website but no good result.
could you point me in the right direction if its not a hassle