I'd like to make a working pin tumbler lock out of LEGO bricks. I have already designed a key I'd like to use that should be compatible with five cylinder lock.
This would push the pins up and down like a normal key would.
Here is the basic system. I don't have time to build to whole thing but this resolves the main problem and proves the feasibility.
The main problem was to reproduce the pins system with LEGO bricks since each pins needs to have different lengths. Early in this project, I wanted to have a 'analog' approach of setting the pins length so to not be constrained by only stacking plates. For that I used axle perpendicular-joiner (6536) on an axle to build the driver pins (top pins):
The key pins (lower pins) are caped with angles connectors (32013) creating the needed round tips on which the key can push.
In a standard pin tumbler lock system, if the right key is not pushing on the pins, both the driver pins and the key pins can prevent the rotation motion. If the key tooth is too low, the driver pins is blocking and, if the key tooth is too high, the key pin is blocking. In my system the driver pins are doing both functions.
In the prototype the red rounded beam and the driver pins would be fixed while the rest would rotating with the key. In the following picture you can see the lock without the key. In that state all the driver pins go through the black Technic beam (under the red rounded beam). This would prevent the key from turning.
In the following picture the key is now inserted and all the driver pins are now flushed. In this position ther driver keys are not engaged into the beams that are part of the rotating module. This enables the key to turn.
If the wrong key is used or the key is not inserted correctly, the pins would be either too low or too high engaging into the beams that are part of the rotating module and thus preventing rotation.
Movie time! Here's a video demonstrating the mechanism.
The biggest downsides of this system are the size and the fact that the driver pins are not pushed down by spring but by gravity. Both of those troubles are put to shame by the total awesomeness of having a functioning pin tumble lock made of LEGO bricks.