Email Address:

Lost your password?

This is the legacy website; please use the new website.

USB Clock With LCD Readout, Pt.1

This LCD USB Clock connects to your PC's USB port. It synchronises its time with your PC - and ultimately an internet time server - when your PC is on to maintain accurate time-keeping. It can also operate on its own using battery back-up and has user-selectable display modes.

By Mauro Grassi

Main Features

  • Automatically synchronises its time with your PC and by extension, an internet time server.
  • Internal rechargeable battery to keep the time while disconnected from the PC.
  • 4-digit LCD with optional dimming LED backlight.
  • All settings are changed by connecting to a PC.
  • Can display supply voltage and battery charge status, as well as date and time.
  • Low-power CMOS design for extended battery life.
  • Automatic backlighting mode.
  • Displays time in either 24-hour or 12-hour format.
  • All recent PC operating systems, including Windows, provide services for NTP (Network Time Protocol), a protocol that’s used to synchronise your PC’s local time with an internet time server. This USB Clock in turn synchronises with your PC’s clock and provided you boot your PC regularly (and synchronise it to an internet time server), it will maintain accurate timekeeping.

    In operation, the USB Clock is powered via the PC’s USB port when the PC is on. This also charges an internal NiMH battery. This battery powers the clock when the PC is off or when the clock is disconnected from the USB port.

    When the PC is off, the clock’s timekeeping is maintained by a 32.768kHz watch crystal. This is accurate to within ±20ppm, giving a timekeeping accuracy of better than two seconds a day in stand-alone mode.

    Control software

    By now, you’ve probably guessed that the LCD USB Clock is based on a microcontroller. In this case, we’re using a PIC18F4550 micro to provide all the necessary functions.

    In addition, a small command-line program (usbclock.exe) is used to change the USB clock’s settings and to synchronise the clock’s time with your PC’s clock. This will be described next month. We’ll even show you how to set-up your Windows operating system (using an entry in the Start-up folder) to automatically synchronise the USB Clock to the PC’s clock each time the machine boots.

    That way, you can install the software and forget it. In fact, this system will even take care of daylight saving time shifts. When your PC automatically adjusts for daylight saving it automatically adjusts the USB clock as well (when it is next synchronised).

    1VPPProgramming voltage (typically 13V)
    2PGCProgramming clock signal
    3GNDGround reference
    4GNDGround reference
    5VDDSupply voltage (typically 5V)
    6PGDProgramming data signal

    Table 1: this table shows the pin-out of the ICSP (in-circuit serial programming) header CON1. It can be used to program IC1 in-circuit using a programmer like the dsPIC Programmer featured in the May 2008 issue. Other programmers like Microchip’s PICKit2 can also be used, by connecting the pins appropriately.

    Share this Article: 

    Privacy Policy  |  Advertise  |  Contact Us

    Copyright © 1996-2021 Silicon Chip Publications Pty Ltd All Rights Reserved