I recently built a timed lock picking competition, based on a similar design created by @dossman33. It consists of four deadbolts (plus two spares), all pinned identically, that, when opened, trigger a switch wired to a Raspberry Pi. The Pi has a UI written in Python that shows the current elapsed time, plus the time that each station opened. I’ve shared the code at https://github.com/mburrough/locktimer.
(BSides Lockpick Village images from @deviantollam)
These are the switches I used: https://www.adafruit.com/product/818. In hindsight, these switches are “normally open (NO)”, which means that as long as the switch is depressed (which it is, so long as the deadbolt is “locked”), the circuit is closed and electricity is flowing to the wired up ins on the Pi. As soon the the lock opens, the switch releases, and the current flow stops. The code in the Pi sees that there is no more power going through, and stops the timer. The downside is, you can achieve the same effect by unplugging the wire between the device and the Pi.
Instead, I should have used a “normally closed (NC)” switch. This would flip the pattern, so the circuit would only be energized when the lock was open. That way, if someone unplugs a stand, the timer keeps running. There are many switches that actually feature both NO and NC sides, but this one does not. Were I to re-do them, I’d just this switch https://www.adafruit.com/product/819, and choose its NC terminal. This would require a very small change to the code; I suspect on lines 91, 94, 97, and 100. Change:
if(readPin(seatXPin) == 1 and seatXOpen < 1): -to- if(readPin(seatXPin) == 0 and seatXOpen < 1):
But I haven’t tested it, so I might also be forgetting something else.