LED Clock

Start with a Concept

Clock Cartoon

This was my goal. Create a clock that shows the time and day of week. My friend at work, Bob, had acquired some old 64 x 16 LED boards a renovation at the subway station. They are copyright 1985, which is the same time the subway system was built.

LED Board Profile

I also wanted the brightness of the screen to adapt to the room.

Brightness CartoonCreate a Plan

This was the list of what needed to be done:

  • Find out how to communicate with the LED board
  • Determine how to keep time
  • Create specification for both hardware and software
  • Design a system and test it
  • Make a clock

Reverse Engineering

Each board actually used slightly different parts. These were probably replacements over the years.

I looked up each part, and made a schematic of the system. I was then able to understand how to communicate to the board.

  • Pins 2-4 (3 pins) chose which of 8 rows to control using binary decoders and transistors (2^3 = 8 options).
  • Pin 5 chose which 8 rows would be controlled using a NAND gate (16 rows total).
  • Pin 6 turned the chosen row on or off using the same NAND gate as pin 5.
  • Pins 1 and 7 were used with shift registers and transistor arrays to load in 64 bits of data (for the 64 columns)

LED Control

This is a simplified example of the communication structure with the LED board.

The communication process was then to turn the LEDs off, shift in 64 bits of data, pick a row, and turn the LEDs on. This then done for each of the 16 rows extremely fast to allow a visible screen of LEDs.

Schematic done in paint

Schematic of LED board as I interpreted it, Simplified.


Clock speed error can be accounted for with a constant. Drift in clock error speed on the other hand can not. Clocks require very low drift, as even being 0.01% off over a year is almost an hour off in a year.

There were six options that I thought of looking into for this project:

Atomic clock – Just kidding.

Micro-controller internal oscillator – These are known to drift quite a bit.

External oscillator or RTC – After doing several week long tests, the drift for my Real Time Clock (RTC) was quite high. This could have been from using a cheap RTC (like $2.00 at DX). It may also have been from the 10ºC temperature changes in my house (too cheap to put on the heat at night).

Radio receiver for time – I did a bit of research on this once, and couldn’t find any time broadcasts that were in Vancouver.

Wireless receiver for time – This would be a project in itself.

Reading the mains AC line (60Hz) – I was opening up my bedside alarm clock in order to rewire the snooze button, and I decided to look into what it used for timekeeping. It turns out that the 60Hz line is wired directly to one of the pins. Wait, what? I did some research, and apparently the power station works really hard to maintain the correct number of pulses in a day. If the AC frequency is off for one day, they will compensate the next day. I did some tests and was satisfied with the result. I wasn’t planning on powering this with batteries anyway.


This is why Paint is better than Eagle

  • The light sensor was something I wanted from the beginning, so that goes in.
  • The input knob and input button are for editing time and brightness controls.
  • I originally wanted to use an internal clock for running the programming, but the standard 8 MHz speed was not enough to keep all 16 rows on without flicker. A 16 MHz crystal was added to the spec.
  • The AC line would provide power, and a timekeeping system via interrupt.

This gives a total requirement of 13 I/O.


Designing the system was definitely fun, but testing and failing was a blast (separate post).

Electrical Design

With pins to spare

I decided to wire up a connector that allows me to program my final product later. This allowed me to fix bugs, and give the board the ability for new purposes in the future.

Test Layout

Test Layout

Program Cable

Using the Programming Cable

Code Design

Simplified for simplicity

This chart is a simplification of the actual code (posted here and poorly commented). I loaded the characters as arrays of shorts, because each 16 bit value corresponded to a column for the LED board.

The menu has 8 different pages:

  • Edit seconds
  • Edit minutes
  • Edit hours
  • Edit day
  • Edit maximum display brightness
  • Edit minimum display brightness
  • Edit maximum measured light
  • Edit minimum measured light

The software could then extrapolate the brightness to a user defined range. This made it possible to have constant brightness, alter brightness within a range, or even turn off below a threshold.

Finally Making the Clock

Circuit Installation

The clock ended up working pretty well. I tried doing a bit of a time lapse, but the light adjustment of my camera did not help show the dimming effectively.

LED Clock

Back To Projects List






This entry was posted in Projects. Bookmark the permalink.