12.7 C
United States of America
Wednesday, April 9, 2025

A Ticking Time Prank – Hackster.io



Precision engineering. High quality craftsmanship. Reliability. Impeccable accuracy. No particulars ignored. These are the types of phrases producers of timepieces bandy about to extol the virtues of their merchandise. And with good purpose — that’s what shoppers need in a timepiece. Until they occur to be like Grant Iraci, that’s. Iraci believes the time is correct for clocks to be improper. But in addition principally proper. Sure, it’s complicated, however that’s precisely the form of factor that makes for April Fools’ Day prank.

For the event this 12 months, Iraci constructed a Discworld-inspired gadget known as the Ventinari Clock (which itself appears to be a not-quite-right spelling of “Vetinari”). The clock was then secretly positioned in his college’s pc science analysis lab for the aim of providing purposeful malfunctional timekeeping to his colleagues, and usually making them query their sanity after one too many cups of espresso. Probably the most maddening factor concerning the Ventinari Clock is that it does — roughly — maintain correct time. There’s simply one thing off concerning the timing of the ticks.

The Ventinari Clock is constructed round an inexpensive $5 quartz wall clock with its authentic management circuit changed by a Raspberry Pi Pico clone with an RP2040 chip. The microcontroller is answerable for producing the pulses that drive the clock’s second hand — however as a substitute of a gradual one-second interval, it introduces rigorously calculated randomness into the timing.

Bizarre quartz clocks function utilizing a easy mechanism — a 32.768 kHz crystal oscillator drives an built-in circuit, which divides the frequency down to at least one pulse per second. This pulse alternates polarity, activating a tiny electromagnet contained in the clock motion that flips a rotor forwards and backwards. This, in flip, strikes the gears that advance the arms.

Iraci’s modification hijacks this mechanism. As a substitute of the usual management circuit, he wired the electromagnet immediately to 2 GPIO pins on the RP2040 microcontroller. By alternately pulsing these pins excessive and low, the clock will be “tricked” into ticking beneath the management of his customized software program, which was written in Rust.

Fairly than merely introducing random noise, Iraci applied a Markov chain algorithm. This algorithm consists of a four-state system, the place every state transition happens with predefined possibilities. Each 125 milliseconds, the microcontroller generates a four-bit random quantity utilizing a linear-feedback shift register, which determines the subsequent state of the clock. If the system enters a particular “ticking” state, the clock advances by one second.

To make sure that the typical tick charge stays appropriate over time, Iraci simulated dozens of days’ value of clock operation utilizing Python. By manually adjusting the transition matrix that governs clock ticks utilizing these insights, he achieved a near-perfect stability between chaotic ticking patterns and long-term accuracy. The consequence? A clock that appears fully damaged at a look, but maintains the right time — not less than for a day or so.

The Ventinari Clock was put in the evening earlier than April 1st, positioned simply above the lab’s espresso machine — the place its irregular ticks would have the best psychological impression. Simply in case somebody tried to repair the clock, Iraci labeled the again with a “final serviced” date of April 1, 2025 to allow them to in on the gag.

Iraci doesn’t advocate that anybody copy the mission, as it’s prone to break in a matter of days. However if you wish to throw warning to the wind, the code and construct particulars are out there on GitHub beneath an MIT license.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles