A Ticking Time Prank
Grant Iraci built a clock that ticks unpredictably, but still keeps time, to mess with the coffee-fueled minds of computer scientists.
Precision engineering. Quality craftsmanship. Reliability. Impeccable accuracy. No details overlooked. These are the sorts of phrases manufacturers of timepieces bandy about to extol the virtues of their products. And with good reason — that is what consumers want in a timepiece. Unless they happen to be like Grant Iraci, that is. Iraci believes the time is right for clocks to be wrong. But also mostly right. Yes, it is confusing, but that is exactly the sort of thing that makes for a good April Fools’ Day prank.
For the occasion this year, Iraci built a Discworld-inspired device called the Ventinari Clock (which itself seems to be a not-quite-right spelling of “Vetinari”). The clock was then secretly placed in his university’s computer science research lab for the purpose of offering functional malfunctional timekeeping to his colleagues, and generally making them question their sanity after one too many cups of coffee. The most maddening thing about the Ventinari Clock is that it does — more or less — keep accurate time. There is just something off about the timing of the ticks.
The Ventinari Clock is built around a cheap $5 quartz wall clock with its original control circuit replaced by a Raspberry Pi Pico clone with an RP2040 chip. The microcontroller is responsible for generating the pulses that drive the clock's second hand — but instead of a steady one-second interval, it introduces carefully calculated randomness into the timing.
Ordinary quartz clocks operate using a simple mechanism — a 32.768 kHz crystal oscillator drives an integrated circuit, which divides the frequency down to one pulse per second. This pulse alternates polarity, activating a tiny electromagnet inside the clock movement that flips a rotor back and forth. This, in turn, moves the gears that advance the hands.
Iraci’s modification hijacks this mechanism. Instead of the standard control circuit, he wired the electromagnet directly to two GPIO pins on the RP2040 microcontroller. By alternately pulsing these pins high and low, the clock can be "tricked" into ticking under the control of his custom software, which was written in Rust.
Rather than simply introducing random noise, Iraci implemented a Markov chain algorithm. This algorithm consists of a four-state system, where each state transition occurs with predefined probabilities. Every 125 milliseconds, the microcontroller generates a four-bit random number using a linear-feedback shift register, which determines the next state of the clock. If the system enters a specific “ticking” state, the clock advances by one second.
To ensure that the average tick rate remains correct over time, Iraci simulated dozens of days’ worth of clock operation using Python. By manually adjusting the transition matrix that governs clock ticks using these insights, he achieved a near-perfect balance between chaotic ticking patterns and long-term accuracy. The result? A clock that seems completely broken at a glance, yet maintains the correct time — at least for a day or so.
The Ventinari Clock was installed the night before April 1st, positioned just above the lab’s coffee machine — where its irregular ticks would have the greatest psychological impact. Just in case someone attempted to fix the clock, Iraci labeled the back with a “last serviced” date of April 1, 2025 to let them in on the gag.
Iraci does not recommend that anyone copy the project, as it is likely to break in a matter of days. But if you want to throw caution to the wind, the code and build details are available on GitHub under an MIT license.