SNTP Clock Project History


      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:       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 10MHz. It 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 displays. The 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.
      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 Bud or 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 for the short sides. A smoked plexiglass front panel hides everything that isn't illuminated.

PCBA front
PCBA back
Ready for assembly
Clock back
Clock front
RGB clocks



SNTP Clock resources

Format
Title Size
Download schematic and BOM 3 pages, 70K
Download PCB artwork 5 pages, 570K
Download Apple remote protocol & notes 1 page, 30K