Posted in "The Bound Forum"Phesto (the original thread disappeared)
You need the right solenoid. For example, presently available at Electronics Goldmine for about $3 (US).
NOTE this is a surplus electronics shop.. they aren't going to have these solenoids forever and usually a solenoid like this would cost you $20 or more. If you have any inkling to try this ever, don't miss out on this opportunity to get a decent solenoid for dirt cheap!
The plunger comes out all the way, which makes this solenoid especially handy. Simply mount the solenoid upside down, attach your keys to the plunger somehow (easy), and when you apply power to the solenoid and the solenoid will hold the plunger in. I found that 3V (two AA batteries) was more than enough to hold up my entire keychain and draws 60mA. A charged pair of alkaline batteries should last hours.
NOTE, do not try to run this solenoid at 12 volts continuously, it was not rated for that and will eventually burn up (despite what the site says). I wouldn't drive it for a long time at anything more than 6 volts. If you do hook it up to a different power source, test it to make sure it isn't getting really hot after no less than 10 minutes of holding the plunger in. Solenoids fail when in the insulation on the tiny wires that make up their coil burns up and the wires short together, thus heat buildup is the enemy you want to look out for.
Then, simply use whatever means are convenient to cut the power to the solenoid at the right moment. A simple 555 timer circuit would suffice (google it), so would your basic vacation lamp timer.
Also, this mechanism has the built-in feature that it's failure mode is to drop the keys. If it looses power for whatever reason, the keys drop. Just make sure you have enough weight on the keys to pull out the plunger because there will be a small amount of residual magnetism that will hold in the plunger even after power is removed if there isn't a weight to counteract it. A little testing and tuning should be all that is needed to make this mechanism bulletproof.
To view Aliexpress you might need to switch your mobile browser to the Desktop version.