The SNTP (Simple Network Time Protocol) Clock project was completed in mid 2011. Four units were built — two with blue displays, one with a green display, and one with a red display.
SNTP Clock Project Abstract
I needed a clock for my AV cabinet — as there was no conveniently visible clock in my media room. I wanted it to have the following features:
Simplicity. No need for alarm(s) or date functions. Just a clock to look at while listening to music or watching movies.
Blue displays to match those of the nearby AV equipment.
Displays at least 1" tall. With my deteriorating eyesight and darkness in the media room, I didn't want to squint between looking at the TV and the clock.
"No touch" operation. No buttons or switches. Controlled with an IR remote — preferably the Apple remote. I admire its simplicity and small size and I already had an extra one. Plus, brand-new ones can be obtained on eBay for about $5 each.
Network connected. My AV cabinet already had an Ethernet switch for the AppleTV and AV receiver. It would be nice to have the ability to manage the clock over the network.
The clock must look "at home" and "worthy" in the cabinet amongst other equipment from the likes of Pioneer, Panasonic, and Apple.
I spent many hours searching high and low to purchase something like this (or even close), with no results. Sometimes, if you can't buy what you want, you must build it yourself.
The clock is based on an Atmel AVR ATmega168 microcontroller (16K flash, 1K RAM, 512
bytes EEPROM) running at
handles time keeping, display driving/multiplexing, the IR interface, and command processing. It is the only digital IC in the design. The network interface is accomplished with a Lantronix Xport connected to the AVR. The blue displays came from a Chinese electronics supplier via eBay (~$25 for 20 pieces, shipped!).
The software was written entirely in C using GCC for
AVR. It uses interrupts to keep time and to drive the seven-segment
displays, as well as to deal with serial data to and from the Xport.
Decoding the IR remote is also handled with interrupts. The "main()"
loop is only
used to process IR commands and to generate menus on the seven-segment
code takes-up about 11K of flash and
uses about 540 bytes of RAM.
The software has a command processor for manually controlling the clock via network (or direct serial connection). It provides basic debug functions like read/write memory, dump memory, display software version, etc. It also has clock specific commands for adjusting brightness, setting the display format, turning the colons on and off, and dumping raw IR data from the Apple remote. Click here to see the full list of commands. Click the video link to see some of the commands in action.
On power-up, the AVR requests the time from one of
three predetermined SNTP servers, whose IP addresses are stored in EEPROM.
If one server is unreachable, the software will cycle through all three
servers until the time is obtained. The rightmost decimal point is
illuminated during this process to indicate that the clock is attempting
to synchronize. After the initial synchronization, the clock will
synchronize once per day at a predetermined time that is stored in
EEPROM (I prefer the early morning hours so that I won't see it adjust).
Left unsynchronized, the clock gains about 1/2 second a day.
The IR remote (Apple remote) is used to control the
clock in the absence of a network connection. The remote can be paired with the clock — which is important since the clock resides in the same cabinet as an AppleTV (don't want one to interfere with the other). Pressing the "menu" button on the remote cycles through menus that are displayed on the clock's seven-segment displays. The menu sequence is listed below. Click here for a video demonstration of the menu system.
IP: display the clock's IP address
SYnc: synchronize the clock to SNTP now
britE: adjusts the display brightness by number (the brightness can always be adjusted with the + and - buttons while the time is displayed, but not numerically)
colon: turn colons on or off
12 or 24: select 12 or 24 hour display format
PAir: pair the remote to the clock
unPAir: unpair the remote from the clock
utc: set the local time offset from UTC
In software, the IR receiver triggers an interrupt that decodes the IR data. That data, if valid, is stored for the "main" loop to process. Invalid data (i.e. from a non-Apple remote) is ignored.
The PCB is a two layer, 0.062" thick board measuring 8.12" x 2.25". They were made by Advanced Circuits — about $140 for five pieces in five days with plated through-holes plus soldermask and silkscreen on both sides. A PDF of the artwork is available below.
As noted above, one of my requirements was that the
clock must have a finished, professional appearance that blends well
with neighboring AV equipment. Since I don't have the tools or the
skills to make such an enclosure myself, I had to look elsewhere. A
Pactec style project box simply would not be acceptable.
I decided to have the enclosure made from a picture
frame. Who better to cut perfect angles in metal frames than a picture
frame shop? I visited seven local frame shops before I found one that
could make a piece smaller than about 4" (for the sides). The frame
goes together with standard framing hardware that I cut and re-tapped
the short sides. A smoked plexiglass front panel hides everything that