Like any normal person, I want a desk clock that has sub-millisecond accuracy.
Parsing and immediately displaying time from NMEA messages as they arrive from the GPS module, like GPS Wall Clock originally did, gives a useable-enough value for display, but it's not particularly accurate for a few reasons:
The GPS module outputs messages at 1Hz, but each of these serial transmissions only begins once the GPS has finished its internal fix calculations. Fix calculations take a variable amount of time depending on the number of satellites being used in the calculation, which can be from 40 to 100ms for 1-12 satellites.
At the default 9600 baud, a NMEA RMC sentence containing the current time will take 42 - 82ms to receive, depending on the number of fields filled.
Converting the received time into segment data and sending to the MAX7219/MAX7221 over SPI takes some processing time.
To avoid these delays and uncertainties, the GPS module offers a TIMEPULSE pin that can be used to generate interrupts on our controller at the top of each second with considerable accuracy.
How accurate are we talking?
The u-blox documentation claims it's possible to get timing accuracy in the order of nanoseconds with ideal conditions, while accuracy in the order of microseconds is quite achievable:
As a rule of thumb the position should be known with an accuracy of better than 1m for a timing accuracy in the order of nanoseconds. If an accuracy is required only in the order of microseconds, a position accuracy of roughly 300m is sufficient.
Consider that in your day-to-day life, knowing the time to ±1 minute would likely be inconsequential, and ±1 second would be practically imperceptible. I would hazard a guess that the standard deviation of maintained time-keeping devices you encounter is at least 30 seconds, though I can't find anyone who has sampled this, and networked clocks probably tighten this guess up a bit.
I'm happy drawing a line at ±1ms, mainly because digging any deeper yields more and more uncertainty:
What is the precision of the timepulse signal? (Something like ±30ns if the jitter and quantization in the module's 48MHz clock isn't compensated for)
How quickly does segment data sent to the MAX7221 actually change the output signal? (The datasheet lists a maximum output propagation delay of 25ns)
How long does it take for light to travel from the display to your eyes? (about 3.3ns, if you're 1 metre away).
...ad nauseam ...
Given that I'm using these modules indoors and don't have equipment to verify absolute accuracy anyway, all of this is essentially academic, but it's fun to consider.
Using timepulse (1PPS)
The TIMEPULSE pin on the GPS module generates a rising edge at the top of each second, with a configurable offset in nanoseconds to account for electrical and processing delays. Messages sent by the module always correspond to the previous timepulse, though the documentation only mentions this a few times briefly:
To display the time correctly, we'll need to calculate the next time to display when a NMEA "Recommended Minimum" (RMC) message arrives. At the following rising TIMEPULSE edge, this calculated time needs to be displayed. The MAX72xx will immediately update its display when any digit data is written, so the most I can prepare in my case is internally buffering segment data ready for blasting out over SPI.
A year ago I picked up some new-old-stock "VQB 71" 7-segment displays — not for any particular project, but simply because they looked fantastic. These gorgeous, vintage common-anode digits have distinctive segments with six tiny LEDs each, internally connected with bond-wires and encapsulated in transparent red epoxy/resin:
This batch was manufactured in 1989* by WF Berlin (Werk für Fernsehelektronik), a division of the East German state-owned company VEB Kombinat Mikroelektronik Erfurt. The packaging is titled "lichtemitteranzeige" which is literally "light emitting display": an odd name by modern standards according to a German colleague of mine, who said this would simply be labelled "sieben segmentanzeige" today.
A few partial scans of datasheets for the VQB 71 are available online, with the one below from tu-chemnitz.de being the most complete copy I've found. A datasheet isn't strictly necessary here, but it's useful to have dimensions provided for the footprint, and I wanted to know the maximum current per segment specified by the manufacturer. After all, These parts haven't been made for nearly 30 years, so it would be a shame to destroy one accidentally.
It's easy enough to figure out the specs without knowing any German, but Google Translate makes quick work of the dry/technical language. Here's the English translation of this datasheet:
VQB 71 Not for new designs
Light emitting display made of red-beam GaAsP diodes in a segment design to display the digits 0...9 and a decimal point (DP). The wavelength of their max emission is 630...690 nm. The half width is 40 nm.
Forward direct current / segment or DP at θa -25...25 °C
max 15 mA
DC blocking voltage at θa -25...+70 °C
max 4 V
θa -25...+70 °C
Storage temperature for storage up to 30 days
θstg -50...+70 °C
Characteristic values at θa = 25°C
Luminous intensity / segment at IF = 10 mA
typ 150 μcd
↳ Decimal point
typ 100 μcd
Forward DC voltage / segment at IF = 10 mA
max 3.6 V
↳ Decimal point
max 1.8 V
Note that unlike modern LED datasheets, this doesn't specify maximum pulsed currents. Pulsed currents with modern LEDs are typically 3-5x the max constant current rating (dependent on duty cycle and pulse duration), which can give some head-room for driving them harder in multiplexed configurations.
Driving these segments with a constant 10mA as the datasheet suggests gives a high-contrast image in vivid red. The VQB 71's are so intensely red that it's proved difficult to capture an accurate representation of one on camera. Modern LEDs like those in the GPS Wall Clock look almost orange by comparison.
Driving all segments at this power increases the surface temperature of the digit by around 10°C, but who needs efficiency when you have style, right?
I hear we're building another clock
There are only so many applications for a 7-segment display these days, and I'm a firm believer that one person can never have enough clocks. A miniature version of...