Way back in the late 80s, I remember seeing a TV show (I think it was Amazing Stories) which featured an interesting clock. It was round, black, about the same size as a normal wall clock, and all done up in LEDs. The LEDs appeared to be what I now recognize as pretty normal 5mm LEDs, in a ring around the edge of the clock, facing forward. It didn’t have any numbers, but from the motion of the lights, I could tell that it had an hour hand, a minute hand, a second hand, and one hand that went all the way around in one second.
Many years later, when I got into modern hobby embedded electronics, I remembered that clock and wanted to have it. Thus was born Project Precision. I also learned about the unit of time called the "third". See, once upon a time, sundials and mechanical clocks were so inaccurate that they just showed hours. Later, as technology marched on, they divided the hour up into tiny minute parts, called minutes. When clocks got even better, they did this a second time and got the second minute, or as we now call it, the second. Yes, this is really why the primary unit of time has a secondary name. Smaller divisions were also done, each one being 1/60 of the previous. So, we have third minutes (1/60 second, about 17ms), fourth minutes (1/3600 of a second, about 278 microseconds), fifth minutes (about 4 microseconds) and so on. My clock displays hours, minutes, seconds, and thirds. Smaller than that is measurable with a computer but not visible to the naked eye.
The clock has a red ring of LEDs closest to the center which represents hours, a yellow ring representing minutes, a green ring representing seconds, and a blue ring representing thirds. I originally was concerned that the third hand going around that quickly would be annoying, but some computer animations suggested that it would be OK. Just in case, I always had in mind the ability to disable the third hand, and that ability remains -- a small change in the code would disable the third hand.I went through a couple of iterations. The first design only used 7400 series logic, and kept time by watching the zero crossings on the 60Hz AC mains frequency. A
third in this case would simply then be one cycle of AC. This design worried me, as I was taught proper respect for high-voltage in electronics class, and anything higher than about 12V is high for me.
The clock needed to be super-accurate in order to justify displaying the third hand. I originally considered adding a WWVB receiver, but by the time I actually got to implementing the project, GPS had progressed to the point where that was the solution that made sense.
Then one day I found out about Charlieplexing. This is a way to activate an enormous number of lights using a relatively small number of control signals - on the order of O(n^2). Charlieplexing has been well-covered in other places, so I will only discuss here the practical consequences I have fallen across in my experiences.
A clock with 4 hands, each with 60 lights, requires a total of 240 lights. The exact number of lights which can be controlled by a Charlieplex with n lines is n^2-n. With n=16, we have the ability to control… exactly 240 lights. The number of available pins on an ATmega328 is… exactly 16 pins. The ATmega328 seems to have been perfectly designed for this project.
Is it practical?
The first thing to do was to check if I could really do this. I wanted a wall clock with all of its hands done with LEDs, preferably each in its own color.The parts necessary are:
- A round circuit board
- A whole mess of LEDs
- A GPS receiver module
- A microcontroller with enough pins and current drive to handle the job
It rapidly became apparent that I didn’t want to do a full 9 inch circuit board. I get boards through Laen (now oshpark.com) for $5.00 per square inch of bounding box....Read more »