Dilshan Jayakody's Desk Clock Keeps Great Time in Nothing But CMOS Logic Chips
Who needs a microcontroller just to know what time it is? Not you, if you build this clever clock.
Embedded systems engineer Dilshan Jayakody has built a wall clock with a difference: it's fully digital, but works using only discrete CMOS logic chips without a timer or microcontroller in sight, just a single crystal oscillator.
"This project began with a simple idea: to build a fully functional digital desk clock using only classic CMOS logic ICs [Integrated Circuits] that are still readily available in local electronics markets," Jayakody explains. "No microcontrollers, no firmware, no programmable logic β just counters, flip-flops, logic gates, and seven-segment decoders doing exactly what they were designed to do. The result is a 24-hour digital clock powered from a 5V, 1A supply, drawing roughly 200mA, and assembled entirely by hand on a perfboard using point-to-point wiring."
A clock needs to be able to tell when time is passing, of course, so there is one active component that isn't a simple CMOS logic chip: a 32.768kHz crystal oscillator, which feeds its timing signal to the rest of the system through a frequency divider to provide a pulse once every second. "From this point onward," Jayakody explains, "time is counted purely in hardware, one pulse at a time, just as early digital clocks did."
The master clock pulse feeds through a cascade of Texas Instruments binary-coded decimal (BCD) dual up-counter chips, with one pair handling the seconds, the next the minutes, and the final pair the hours β with additional logic to reset the counts to zero when the minutes and seconds hit 60 and when the hours hit 24.
"Each digit of the clock is displayed using a seven-segment LED module driven by a BCD-to-seven-segment decoder," Jayakody continues. "These decoder ICs take the four-bit BCD output from the counters and translate it into the appropriate segment pattern. This greatly simplifies the design, as there is no need to generate segment patterns manually using discrete logic. Current-limiting resistors are placed on each segment line to protect the LEDs and keep the brightness consistent across all digits."
That's enough for a device that starts counting time up from zero, but not for an actual clock; for that, you need to be able to set the start time. "User interaction is also handled entirely in hardware," Jayakody adds. "Push buttons allow manual setting of minutes and hours. When pressed, these buttons temporarily override the normal 1Hz clock signal and inject faster pulses into the relevant counters, allowing the time to be adjusted quickly.
"A stop/run control lets the clock be paused during setting, preventing accidental increments while adjustments are being made. All switch inputs are conditioned with simple RC networks and Schmitt-trigger inverters to ensure clean, bounce-free transitions. The clock is designed to allow time adjustment while running, and when setting minutes, the seconds are automatically reset to zero."
A full write-up is available on Jayakody's blog; a schematic is available on GitHub under the Creative Commons Attribution 4.0 International license.