How we hacked the church clock
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-12-01 01:14:27 +01:00
build Add DCF77 bench beacon: EPROM image generator + KiCad schematic 2026-11-25 16:05:09 +01:00
hardware pcb 2026-12-01 01:14:27 +01:00
.gitignore Hand-tidy schematic layout; repair ERC (junctions + wire trims) 2026-11-25 19:53:55 +01:00
gen_eprom.py Fix modulation to DCF77 two-level AM; tidy, compact schematic 2026-11-25 16:53:27 +01:00
README.md removed 2026-11-30 07:10:45 +01:00

DCF77 bench beacon — hardcoded-EPROM recreation

A tidy, modern rebuild of the classic "DCF77 in a backpack" teenage hack — but as a low-power bench tool for testing your own radio clock, not a church-tower prank. TTL/CMOS logic, no microcontroller, exactly as it was done on perfboard back then.

The EPROM holds one full DCF77 minute, hardcoded to 01:00:00, Thursday 1 January 1970 (CET). A binary counter clocked at 10 Hz steps through it, and one data bit of the EPROM is the amplitude-modulation envelope that switches a 77.5 kHz carrier between full amplitude and ~15% (as real DCF77 does).

⚠️ Scope / ethics. DCF77 is public infrastructure that real clocks rely on. Build and run this only as a short-range bench setup to sync a clock you own, at the lowest drive that works. Don't amplify it or aim it at anyone else's clocks — that's the part of the story below that was, in hindsight, "digital vandalism that automatically corrected itself."


The story

Around 1989–1990. A friend and I had discovered the DCF77 time protocol explained on a BBS. We looked at each other and thought, "We can totally spoof that — our signal will always be stronger than that one coming all the way from Frankfurt."

So I built a very simple address-counter circuit with a small EPROM that controlled the amplitude modulation, and a few dividers to get the 100 ms, 200 ms and 1-second timing we needed. It always transmitted a hardcoded time. My friend — the analogue genius back then — did the antenna and the little driver. All on perfboard, TTL logic, no microcontroller. We always hacked cheap, quick and dirty.

We put the whole thing in a backpack and stood underneath the clock at the tram station. Sure enough, at noon, when the station clock syncs to the last DCF77 bit stream, the clock sprang into action, its hands moved, and eventually it stopped at exactly the hardcoded time. It never worked at train stations — later we found out those are synced from a master clock that itself uses DCF77, then drives the rest.

But being 16, we weren't satisfied. We discovered the church clock in my friend's town also synced to DCF77. Naturally, we had to try.

Only… it didn't work. Transmitting from three metres away at the tram stop was quite different from transmitting to a clock 60 metres up a church tower. Our solution? Replace the low-power transmitter with a power MOSFET and drive the antenna with 12 volts.

The next day, around noon, we stood underneath the church clock in the pouring rain, staring intently up. Not suspicious at all. 🙄 As the bells struck twelve, the clock sprang forward, sped up, and stopped one o'clock. (We'd moved it forward for maximum annoyance.) Then the bells rang once more. For the next eleven hours that church clock was exactly one hour ahead of the rest of the world.

Sixteen-year-old us thought this was quite possibly the funniest thing we'd ever done. Looking back, it was essentially digital vandalism that automatically corrected itself — a bit like spray-painting a wall with disappearing ink.

DISCLAIMER: This repository is the clean, grown-up version of the first half of that story** — the tram-stop bench beacon, re-derived from the DCF77 spec and verified — without the 12-volt church-tower escalation. KEEP IT ON THE BENCH!


How it works

1.000 MHz  ──►  ÷100000  ──►  10 Hz  ──►  10-bit address  ──►  2764 EPROM
  (X1)       (3×74LS390)   (100ms/step)   (2×74LS393)          │  D0 = envelope
                                                               │  D7 = self-reset
  77.5 kHz carrier (X2) ──┐  two-level AM (full / 15%)         ▼
                          └──►  gated + always-on paths  ──►  summed into tuned loop
  • 10 Hz / 100 ms slots. DCF77 lowers the carrier for 100 ms (= bit 0) or 200 ms (= bit 1) at the start of each second; second 59 has no reduction (the "minute mark"). At 100 ms resolution a minute is exactly 600 slots.
  • EPROM as sequencer. The 10-bit counter addresses slots 0…599. D0 is the envelope (1 = full carrier, 0 = reduced). D7 is 1 only at address 600 and is wired back to the counter's reset — so the counter self-clears to 0 and the minute repeats forever, with zero decoder logic. Classic EPROM-state-machine trick.
  • Static minute. A hardcoded spoofer sends the same minute every time, so a synced clock parks at 01:00 — just like the tram-station clock stopping at the hardcoded time in the story.

The DCF77 frame (validated against the spec)

Each minute is 59 amplitude-modulated second-marks plus a silent 59th second:

Seconds Field Notes
0 start of minute always 0
1–14 civil/weather 0 here
15–20 R, A1, Z1/Z2, A2, S Z1=0 Z2=1 = CET; S (sec 20) = 1
21–27 / 28 minutes (BCD) / P1 even parity
29–34 / 35 hours (BCD) / P2 even parity
36–41 day of month (BCD)
42–44 day of week (Mon=1…Sun=7) 1 Jan 1970 = Thu = 4
45–49 month (BCD)
50–57 year within century (BCD) 70
58 P3 even parity over 36–57 date bits only
59 minute mark no carrier reduction

Amplitude: the carrier is reduced to ~15 % (≈ −16½ dB) for 0.1 s (bit 0) or 0.2 s (bit 1) at the start of each second — it is not switched off. gen_eprom.py computes all three parities and the day-of-week automatically.


The two-level AM modulator

Real DCF77 reduces the carrier to ~15 %; it does not key it on/off. So instead of gating the carrier with one NAND, two carrier paths are summed into the tank, both carrying the same phase so their currents add:

            ENVELOPE (EPROM D0)
                   │
 carrier ─┬─ U2A NAND ─────── Rb 470Ω ──┐
          │   (gated path)              ├── tank (L ∥ C, 77.5 kHz) ── antenna
          └─ U1D inverter ──── Ra 2.7kΩ ┘
              (always-on path)
  • Always-on path — U1D inverts the carrier → through Ra (2.7 kΩ) → tank. Always toggling, every second.
  • Gated path — NAND(carrier, envelope) → through Rb (470 Ω) → tank.

Full amplitude (ENVELOPE = 1): the NAND outputs NOT(carrier) and so does the inverter — the same waveform, in phase. Both totem-pole outputs swing 0↔5 V together, driving the tank through Ra ∥ Rb → the node swings the full ~5 Vpp. 100 %.

Reduced amplitude (ENVELOPE = 0): the NAND output freezes HIGH at 5 V (it stops toggling — NAND(carrier,0)=1). Only the inverter still supplies AC, through Ra. Now Rb ties the summing node to that stiff 5 V output, which — with VCC bypassed — is an AC ground. Ra and Rb become a plain voltage divider:

   AC at tank node        Rb          470
  ───────────────────  =  ───────  =  ─────  ≈  0.15   →   ~15 %
   AC from inverter       Ra + Rb      3170

That's the whole simple dirty trick: just a simple two-resistor voltage divider that the EPROM switches simply by freezing one leg to the rail. No analogue multiplier, no op-amps — exactly the kind of "I didn't need a real modulator, I needed two levels" shortcut that got built on perfboard the first time around.

Fine print. The node's DC offset shifts between the two states (~2.5 V full, ~4.6 V reduced), but only the AC swing radiates, so it's harmless. A series coupling cap into the tank would remove the offset — deliberately left out here to keep it to the original two-resistor version.

Pick Ra/Rb larger (same ratio) for the weakest drive that still syncs your clock from a few cm away.


Build the EPROM image

python3 gen_eprom.py

Produces in build/:

  • dcf77_0100.bin — 8192-byte image for a 2764 (burn this)
  • dcf77_0100.hex — Intel HEX (for most programmers)
  • frame.txt — human-readable bit-by-bit frame + an ASCII picture of all 600 slots

To encode a different time/date, edit the datetime(...) line in gen_eprom.py → main(). Parities are recomputed automatically.

Verify before burning: build/frame.txt lists every second, its pulse width, and its meaning. Spot-check: hours = 01 → only the second-29 pulse is 200 ms in the hour field; the minute mark (s59) is full carrier the whole second.

Hardware

The schematic draws power as VCC/GND symbols, the oscillators / divider chain / modulator as point-to-point wires, and the address lines A0–A9 as a bus between the counters and the EPROM.

Burning it

Any 2764-capable programmer (TL866/T48, MiniPro, etc.):

minipro -p 2764 -w build/dcf77_0100.bin        # or load the .hex in your GUI

No programmer? A 28C64 EEPROM is pin-compatible on the read side and easier to reprogram — the image works unchanged.

Files

File What it is
gen_eprom.py DCF77 frame encoder + EPROM image generator (the core)
build/dcf77_0100.bin EPROM image, 8 KB
build/dcf77_0100.hex Intel HEX
build/frame.txt decoded frame + 600-slot envelope picture
hardware/dcf77.kicad_sch KiCad 10 schematic