Fuzzy Alarm Clock

A bedtime idea for a barebone, impratical alarm clock made with an arduino.

fuzzy_alarm_clock/clock-tmb.jpg

This clock uses just a few LEDs to provide such informations about time as are really needed during the night. A wake-up time T is first set via serial commands from a keyboard-equipped device. During most of the night a warm, nice red led remains lit to tell anybody who awakens "it's the middle of the night, get back to sleep". At T - 30 minutes a PWM controlled yellow LED starts to light up, gently mingling with the red light, gradually fading throught orange tones to suggest that if you're awake it may not be worth getting back to sleep, but you still have time to cuddle in your bed for a while. At T the light will be fully yellow and some noise emitting device will be turned on until the usual stop key is pressed. At T+15, at least, a bright, blinding blue led will light up, telling you to get off your bed, you lazy...

While quieter than my SO's old alarm clock, this looked quite impratical and borderline useless, which means it just had to be done (expecially since I've already bought an RTC for another application).

We built the thing on a breadboard, used it for a month or so, and found out that, contrary to our expectactions, it works. It has been soldiered on a shield, enclosed in a plastic box and it has become our main waking device.

Kicad schematics and source code are in a git repository which can be browsed online or cloned with:

git clone git://git.home.trueelena.org/arduino/fuzzy_alarm_clock.git

A mirror of the repository is available on repo.or.cz.

Components and Schematics

fuzzy_alarm_clock/fuzzy_alarm_clock_ds1307-tmb.jpg

Schematics (click to open)

  • Arduino
  • DS1307 I2C RTC
  • 32.768 KHz, 12.5 pF crystal
  • 2 2.2KOhm resistors
  • 3V coin cell plus holder
  • 3 LEDs (red, yellow, blue)
  • 3 220 Ohm resistors
  • speaker salvaged from an old PC (Noise Emitting Device)
  • 33 µF electrolytic capacitor (optional)
  • switchbutton
  • 10kOhm resistor

Software

Arduino

The latest version of the arduino sketch is available in the git repository; it requires an old (<1.0) version of the arduino tools and can be built outside the IDE thanks to arscons. It also requires an old (pre 1.0 migration) version of the RealTimeClockDS1307 library by davidhbrown.

Now that arscons is compatible with arduino 1.0 a conversion is planned.

Client

fuzzy_alarm_clock/client-tmb.jpg

Please ignore the unimplemented status line :)

Since the serial commands are a bit unpractical, I'm writing a simple client in python + urwid (a text based “g”ui library) to help syncing the time and setting the various alarms. It is available in the git repository with everything else.

Docs

Just a few quick notes that will be organized later.

  • Alarms can be set to ring on certain days of the week or on a specific month/day and can either repeat of ring just once on the first occurrence of the conditions.
  • Alarms are saved as 5 bytes:
    • byte 0 contains a "repeat alarm" bit and bits for the seven days (sunday, saturday, ..., monday).
    • byte 1 is month
    • byte 2 is day
    • byte 3 is hours
    • byte 4 is minutes
  • There are a few alarms available (current default 4)
  • Alarms must be entered via serial line as the above 5 bytes (in hex). (Yes, this is why a python frontend is needed :) )
  • The time/date is set with decimal values
  • Most useful things are saved in the DS1307 RAM; starting from address 0x08 there are the status, current running alarm, current minute and saved alarms.
  • If the arduino loses power for a few minutes, the status is recovered from the DS1307 (as long as the 3V battery is available), even in the middle of an alarm routine. If the power is gone for more than an hour in the middle of an alarm routine, bad things may happen.

Old status update: for more than a month we've been woken every weekday by the breadboard version of this alarm clock, and we've been seriously thinking of soldiering a more stable version and adopting it as our main waking device. During this time it has only failed twice (yes, we had a backup alarm), in both cases because moving the breadboard had let the battery come loose; this shouldn't happen with the soldiered version, and there is now a visible hint when no alarm is setup.

Dependencies mirrors

In the case some upstream should disappear, and since nothing of this is available in debian :), here are mirrors of the dependencies.

Send a comment: unless requested otherwise I may add it, or some extract, to this page.

Return to Top