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.


Here’s a quick demo..



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.


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.


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:




Freeform build

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


The dial part uses 0.9mm copper wire, with some 1.2mm copper wire for the more structural stand parts. It solders really well with my favourite “shiny” 2% silver solder. I never forget to pick up more copper wire from the jewelry/craft section if I find myself in a Daiso or Tokyo Hands!

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


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:


Credits and References

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 just my personal collection of projects. Two main themes have emerged in recent years, sometimes combined:

  • electronics - 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
  • scale modelling - I caught the bug after deciding to build a Harrier during covid to demonstrate an electronic jet engine simulation. Let the fun begin..
To be honest, I haven't quite figured out if these two interests belong in the same GitHub repo or not. But for now - they are all here!

Projects are often inspired by things found wild on the net, or ideas from the many great electronics and scale modelling podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know (or send a PR!). See the individual projects for credits where due.