As early as the 17th century, English craftsman John Wilkes's locks once safeguarded valuables. Today, his clever contraptions are considered to be treasures in their own right. Museums around the world display the craftsman’s surviving works; the one below was spotted by The Verge in Amsterdam’s Rijksmuseum. Called “the detector lock,” the complicated, two-bolt device is designed to tell someone whether anyone has opened a room without its owner's permission.

The detector lock features a tiny man wearing a hat, holding a pointer against a numbered dial. The lock is secured by tilting the man’s hat; to unlock it, one has to push the hat back down while turning a knob. The lock's actual keyhole is hidden behind the man’s leg—which can be flipped up by pushing a tiny button—and a key activates both bolts.

When a key is turned inside the lock, the dial rotates, and the pointer specifies a number. This tells the owner how many times the lock has been secretly opened. As as a security precaution, the lock’s main bolt can be lockedbut can’t be releasedonce the number hits 100. To reset the dial, the owner presses a tiny button, and the tiny man’s counting process begins anew.

See how the detector lock works by watching the video below, filmed by London’s Victoria and Albert Museum.

[h/t The Verge]