Maker Pro
Maker Pro

Digital clock using DS3234

I want to design and build a digital 6 digit 7 segment display clock using large displays and as accurate a clock as is practical. Does anyone have ideas on how to interface a DS3234 into a 7 segment LED driver?
 
Last edited:

KrisBlueNZ

Sadly passed away in 2015
The DS3234 is a real-time clock with a serial interface (SPI). To read the time information, you really need a microcontroller. The microcontroller would also have to convert that time into digits to be displayed, and provide a way to set the time, and implement any other features you want.

This is a fairly undemanding project for a microcontroller; you could use a small PIC programmed in C. The microcontroller could produce a multiplexed output, driving the display via some buffer devices (e.g. MOSFETs).

It might be possible to implement a clock without using a microcontroller, by using the 32k output from the DS3234, but the circuit would be pretty big, limited in its functionality, and messy to modify.

A digital clock is a reasonable project for a relative newbie to microcontroller programming. Microcontrollers are fascinating and versatile components and there are a number of easy-to-use development systems such as Arduino. Arduino may also have a suitable display module already developed. It is probably the best place to start.

Google the keywords in this post to learn more.
 
Thanks KrisBlue. Yes the conclusion I came to was to use the 32KHz output to generate a 1hz pulse and drive a series of decade counters like 4026's. I wanted to use the 3234 or 3232 because of their accuracy not because of their versatility. Not interested in date information, only time and certainly that would give better accuracy than a 1hz oscillator derived from a 555 or other simple timer circuit that primarily relies on a capacitor charge/discharge cycle. I'm a bit of a discreet component dinosaur
I considered using a DS1307 which has a 1Hz output but not an integrated crystal or compensation.
Haven't delved into the world of microcontrollers - suppose this would be a good start.
 

KrisBlueNZ

Sadly passed away in 2015
Sure, any crystal-controlled circuit will be far more accurate than an R-C oscillator. An R-C oscillator would be a terrible timing source! But (depending on where you live) the AC mains frequency is an accurate reference. In the countries that I know of, it is adjusted so that over the medium term, it averages out at an extremely accurate frequency, although there are variations in the short term. So if you already have AC power going into your clock, that would be more accurate even than the DS3234. Except when there's a power failure!

Yes this would be a good opportunity to get involved with microcontrollers. Good luck!
 
Ok and thanks for your perspective and the advice.

We do have a reliable mains power supply here and if I go down that path would be a good (best) source for a derived 1hz reference frequency.

I would still have to build a driver for the LED display. The ones I intend to use are rated at 20ma and 12V per segment (5 LEDS in series). I'm thinking along the lines of the ULN2803 which is an 8 transistor array IC. Would only need 1 per display. Ah the benefits of ICs. Can remember building a decade to seven segment display driver with 26 diodes because that device simply didn't exist at the time.

I suppose the huge advantage using the microcontroller is that it would retain all time information if there was a power failure or brown out. Is that a correct assumption?

Option with the dinosaur version would be a UPS which are certainly costly but would avoid the need to climb a ladder to reset the clock which will be mounted quite high.

The facility in which I want to install this clock does have a backup generator but I have noticed on the status display that the frequency is not reliable. Is this yet another reason to go for the microcontroller option using the DS3232 as frequency reference?
 
The advantage of a microcontroller in your project is that it'll replace a lot of other logic you'd need to "count" the time and render it on an LED display. Instead of multiple counter ICs, BCD-to-7-segment decoder ICs (or 26 diodes as you mention), and decade counters and drivers for multiplexing the display, you can do it all with one microcontroller.

To retain time during a power outage you'll need some sort of backup power source, such as a battery, and a clock source to keep it "ticking". If you use the DS3234 it'll provide the clock source. If you use the DS3234 as the clock and use SPI to a micro to drive the display, your backup power wouldn't need to power the micro at all, just the DS3234. You'll lose the display during outages in this case, but the battery will last much longer.

You may not even need the DS3234. A mid range PIC can drive its Timer1 register with 32.768 KHz watch crystal directly, and can run even in sleep mode during power outages.

If you plan on using the mains frequency as a clock source, and power outages are rare, you could probably get by with an RC oscillator as a backup clock source, though a crystal oscillator will be much more accurate.

If you really want to get creative you could add a GPS module and use that to set the clock automatically.

The ULN2803 is a Godsend. I always keep these on hand. They're great for 7-segment displays as long as they're common anode.
 

KrisBlueNZ

Sadly passed away in 2015
I agree with kpatz's post. Good advice there.

I would still have to build a driver for the LED display. The ones I intend to use are rated at 20ma and 12V per segment (5 LEDS in series). I'm thinking along the lines of the ULN2803 which is an 8 transistor array IC. Would only need 1 per display. Ah the benefits of ICs. Can remember building a decade to seven segment display driver with 26 diodes because that device simply didn't exist at the time.
Do you plan to multiplex the displays? It doesn't sound like you do. In that case you'll need seven separately controllable digital outputs for each digit. A serial-input parallel-output shift register like the 74HC595 is a good choice here. You can also get serially interfaced devices that include medium-duty output drivers on-chip. They have open drain outputs.
I suppose the huge advantage using the microcontroller is that it would retain all time information if there was a power failure or brown out. Is that a correct assumption?
See kpatz's answer.
Option with the dinosaur version would be a UPS which are certainly costly but would avoid the need to climb a ladder to reset the clock which will be mounted quite high.
The facility in which I want to install this clock does have a backup generator but I have noticed on the status display that the frequency is not reliable. Is this yet another reason to go for the microcontroller option using the DS3232 as frequency reference?
Yes. If the AC mains supply could be driven from a backup generator, I wouldn't use the AC mains frequency for timing at all, and stick with the DS3234. Your best solution would be a GPS receiver, as kpatz suggested. These will never drift perceptibly and will also enable your clock to handle leap seconds automatically. These are inserted occasionally due to variations in the Earth's rotation and cannot be predicted far in advance.
 
Top