Building the Perfect Alarm Clock (Part 2)
[In my previous posting, I discussed the shortcomings of the digital alarm clock and what my goals were for the ideal clock. A link to that posting is at the bottom of this one.]
How the Clock Works — from the Outside.
Our clock has only three interface elements; a big blue display (the time), a smaller yellow display (the alarm time) and a knob. Pressing the knob turns the alarm (and the yellow display) on and off. No yellow numbers, no alarm. Yellow numbers? That’s what time the alarm will go off. It’s that simple.
You change the alarm time by turning the knob. It moves in 15-minute increments, so in a couple of spins (forwards or backwards) you can move through a whole day. I’ve always thought that the little AM/PM light was hard to notice, so we’ve done away with it here. You set the alarm in 24-hour time. which makes it really hard to get it wrong; 7:00 AM reads as “7:00” while 7:00 PM reads as “19:00.”
That just leaves the noisemaker. Rather than leave it up to the a radio station, which has too many parameters to set (volume and tuning) or may have unreliable programming, I decided to include my own noisemaker. Sure, we could have interfaced to an iPod, but adding another device undermines our assurance that the alarm will go off as planned. Instead, I’ve chosen to play sound files off a micro-SD card. This gives us lots of other capabilities as well, like making the clock chime on the hour, speak the time, or play different alarm tones at different times. Since the reader accommodates a 2Gb card, you can design your own audio “skin” if you like.
Last, but not least, we solved the power problem. With the old mechanical clocks, you lost exactly as much time as the power was out. With digital clocks, even a brief power interruption restarts the clock at 12:00. Some clocks have a back-up battery in case the power fails, but most do not. The ones that do, require you to replace the battery periodically (which no one ever seems to do).
This clock keeps the correct time even when you pull the plug. For how long? At least a few days and maybe a couple of weeks (there are a lot of factors involved). The displays turn off and the alarm can’t sound when the power is off, but when power is restored, the time is still accurate.
How the Clock Works — from the Inside.
The guts of this machine contains a hard-working and very inexpensive 8-bit PIC microcontroller. (It’s the long rectangular black thing in the picture.) There is also some audio circuitry to play sound files off a micro-SD, an amplifier to drive a speaker, some LED displays, and a power supply to make it all work.
The PIC microcontroller does all of the heavy lifting, keeping track of the time, managing the two displays, controlling the audio chip, and handling user interaction.
One more component worth mentioning is the carbon aerogel supercapacitor. (It’s the big round thing on the logic board.) This little guy stores up electricity when we’re plugged in. When we’re not, the microcontroller senses the power failure, shuts down everything non-essential and hunkers down for a long winter. It draws just enough power from the ultracapacitor to stay alive and keep track of the time. Supercapacitors are cool because, unlike batteries, they don’t get tired of charging/discharging so they don’t need to be replaced periodically.
I decided to build this clock into a CD storage container. It was about the right size, inexpensive, and I liked the color. In order to give myself a little more flexibility, I put all of the electronics on two boards instead of just one. There is a display board, which holds the digital displays and the knob, and a logic board which holds the microcontroller, audio electronics, and power supply. A 16-pin connector mates the two boards together.
The size of the display board, which is the larger of the two, is primarily determined by the size and placement of the LED displays. By putting the rest of the electronics on another board that mates behind it, I gave myself the option of fitting the whole thing into a smaller box than I could have if it were all on one board (in case I change my mind later).
In our next installment, we’ll talk more about the details of the design and how engineers design something like this.