Static Pages

Word clock

June 28, 2021

Ever since I saw a first word clock in my native language, Swiss German, I was intrigued. Here's a simple version I made in HTML/JS:

ESTISCHTJZÄHCFÜF
ZWÄNZGUVIERTUHAB
PUNKTKVORQLHAUBI
SÄCHSIIPNÜNISEIS
ZWÖINZÄHNIAHEUFI
DRÜBZWÖUFIFSIBNI
ACHTIXFÜFIRVIERI

There are a lot of tutorials out there on how to build a real one:

I'm not really a "hardware person" (apart from some projects with the Raspberry Pi), so I only played around with a HTML/JS word clock, as you can see above.

The time parsing part is a simple differentiation, based on the minutes - If we're between .00 and .20 away from the full hour, take the current hour ("quarter past 4", else use the next hour "twenty minutes before 5", even there hour is still "4").

Note that this is different in German than in English - for example "half past 4" is something like "a half hour before 5" in German.

So this is the simple Python script to generate a text version of the time, on which above clock is based:

# Initialize time parts (example)
hh = '10'
mm = '45'

# Initialize hour names
hours = ['zwöufi','eis', 'zwöi', 'drü', 'vieri', 'füfi', 'sächsi', 'sibni', 'achti', 'nüni', 'zähni', 'eufi']

full_time = ''
if mm == 0: full_time = 'punkt ' + hours[hh]
elif mm == 5: full_time = 'füf ab ' + hours[hh%12]
elif mm == 10: full_time = 'zäh ab ' + hours[hh%12]
elif mm == 15: full_time = 'viertu ab ' + hours[hh%12]
elif mm == 20: full_time = 'zwänzg ab ' + hours[hh%12]
elif mm == 25: full_time = 'füf vor haubi ' + hours[(hh+1)%12]
elif mm == 30: full_time = 'haubi ' + hours[(hh+1)%12]
elif mm == 35: full_time = 'füf ab haubi ' + hours[(hh+1)%12]
elif mm == 40: full_time = 'zwänzg vor ' + hours[(hh+1)%12]
elif mm == 45: full_time = 'viertu vor ' + hours[(hh+1)%12]
elif mm == 50: full_time = 'zäh vor ' + hours[(hh+1)%12]
elif mm == 55: full_time = 'füf vor ' + hours[(hh+1)%12]   
elif mm == 60: full_time = 'punkt' + hours[(hh+1)%12]

# full_time is now "viertu vor eufi"

This generates the sentence which belongs to the time. In the word clock above, the correct words are then highlighted, but of course, for a real clock, the mapping to highlight the correct LEDs would have to be done.

You can find the source code (TypeScript) on Github.

Thanks for reading!