Fork me on GitHub

Project Notes

#533 Ted’s LED Clock

Building a freeform 20th anniversary clone of @tedyapo’s LED clock, driven with a PIC16F84A.

Build

Here’s a quick demo..

clip

Notes

I saw @tedyapo’s tweet about the LED clock he made 20 years ago. It is controlled with a PIC16F84A and he shared the original source code.

teds_tweet

Now if that isn’t an invitation to attempt a replica of the project, I don’t know what is!

The project seems perfectly suited to a freeform construction, so that’s what I’ve done here.

Building the Code

I’m running MPLABX IDE on MacOSX, and it’s testament to Microchip’s custodianship of the aging PIC platform that I had no trouble at all recompiling the code with MPLabX 5.30 and mpasm 5.86.

I’m using an unmodified copy of the original source. See clock.asm for the code used.

Construction

I’ve selected components based on a visual inspection of a few photographs that Ted shared.

The project uses a 32.768 kHz clock (as this perfectly divides for time-based applications). The code sets LP clock mode accordingly in the configuration bits, and per the datasheet, I’ve used 100pF loading capacitors (not sure what Ted originally used). With this configuration, the clock seems to keep time reasonably well.

The circuit uses a neat trick to have a single GPIO pin double as LED output and push-button input. This is used for the hour and minute adjust buttons, as there are not enough pins on the PIC16F84A to dedicate a pin for each function. Essentially:

  • the LED and low value (180Ω) current-limiting resistor are connected normally for active high output
  • a normally-open push-button is wired to pullup the pin to VDD
  • so that the pin is positively pulled down when being scanned as an input, a 10kΩ resistor is in parallel with the LED. This is a high enough value that it does not interfere with the normal LED operation
  • a 1kΩ resistor is in series with the pull-up push button so that when active. This is large enough so that it does not light the LED too much, but small enough (compared with the 10kΩ resistor) that it provides a sufficient pull-up voltage on the pin.

I’ve sketched the circuit and initially tested it successfully on a breadboard:

Breadboard

Schematic

TedsClock_bb_build

Freeform build

I used an old cardboard box as formwork for the dial:

build_wip

The rest of the build was just done by eye on a lazy Saturday afternoon, with my usual preference for “anything but straight lines”;-)

Build

Updated Code

Ted shared an updated version of the code, which improves the hour/minute adjust handling. It did work before but was really touchy. Now it is very easy to use.

Local sources files updated; here’s a quick demo:

clip

Credits and References

About LEAP#533 PICLEDfreeform
Project Source on GitHub Project Gallery Return to the LEAP Catalog

This page is a web-friendly rendering of my project notes shared in the LEAP GitHub repository.

LEAP is my personal collection of electronics projects, usually involving an Arduino or other microprocessor in one way or another. Some are full-blown projects, while many are trivial breadboard experiments, intended to learn and explore something interesting (IMHO!).

The projects are usually inspired by things found wild on the net, or ideas from the sources such as:

Feel free to borrow liberally, and if you spot any issues do let me know. See the individual projects for credits where due. There are even now a few projects contributed by others - send your own over in a pull request if you would also like to add to this collection.