Maker Pro
Maker Pro

Before I start on a project - wheel re-invention protection

I want to start on a small project but I'm not looking to re-do anything that is already available.

I'm looking to make a simple date-time clock out of 7 segments, with .01s time resolution. Basically I want 16 7-segs showing YYYY.MM.DD HH:mm:ss.SS
I also want to be able to control brightness with a small dial somewhere on the device.

Does anyone know of any plans/microcontroller software that already does something similar to give me a place to start without doing everything from scratch?

Cheers.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Well, nothing there is revolutionary.

But having said that, there is probably nothing you can find easily that would satisfy all your requirements (there may be unstated requirements like accuracy, power source, etc. That could make this more true).
 

hevans1944

Hop - AC8NS
The problem you will discover is building a clock with 0.01 second time resolution. Why do you want to do this? It is impossible to "read" a clock whose last digit changes every 0.01 seconds. It is almost impossible to "read" a clock whose last digit changes every 0.1 seconds. Other than that, there are thousands (maybe zillions) of 7-segment LED and LCD clock/calendar circuits with one second resolution available on the Internet, including at least one integrated circuit that does everything... but where is the fun in that?

To get 0.01 second resolution you will need a stable 100 Hz clock frequency, which you can obtain from zero-crossings of your 50 Hz mains power. Here in the USA the line frequency is 60 Hz and I use a small center-tapped filament transformer (which also powers a full-bridge rectifier and 3-terminal voltage regulator for logic power) to drive the bases of two NPN transistors through 10 kΩ resistors. The emitters are connected to the center tap (ground) and the transistor collectors are connected together to a 1 KΩ pull-up resistor to Vcc and also to the input of Schmitt hex inverter IC. This produces fast pulses centered on the zero-crossing of the AC line. There are other circuits that do the same thing.

I would count these zero-crossing pulses using an interrupt-driven microprocessor, with software to convert the accumulated counts to YYYY.MM.DD HH:mm:ss.ss. You would need to account for leap years as well as the number of days in a month, which IMHO is easier to do with software than hardware. Then you have to convert the numbers to 7-segment display signals, but there are hardware integrated circuits that will do that. It may be difficult to "refresh" the display every 0.01 seconds by multiplexing the BCD or binary number outputs, but that is both doable and probably necessary because of the limited number of I/O pins available on microprocessors.

With interrupts arriving every 0.01 seconds, and a 1 MHz instruction clock, you have "only" 10,000 instructions that can be executed between your 100 Hz "clock" pulse interrupts. If that isn't enough to do all the above, choose a microprocessor that runs with a faster instruction clock. For multiplexing the output, you need a minimum of four bits for the digits plus four more bits to select which display receives the digit, the digits being stored in sixteen external latches for display purposes. And you probably need another 1-bit output to clock the latches. Sixteen four-bit latches that can be set and then later their contents transferred to their outputs will produce a flicker-less display (except in the those last two tenths and hundredths seconds digits).

If you use 7-segment LEDs for display, dimming is trivial. Don't forget to include (perhaps hidden) push-button switch interfaces to set the clock. It is desirable to have both UP and DOWN push-buttons for setting digits. You may want to integrate an alternating action push-button pause function while setting the clock, releasing the pause by pressing the push-button again after all the digits are set. If your reflexes are fast enough (I doubt it) this will allow you to manually synchronize the hundredths digit to an accurate external clock. Good luck with that. Of course you would disable the 100 Hz clock interrupts while doing the clock settings, meaning you have all the time in the world to set the clock.
 
Top