Full writeup on my blog at: http://eclecti.cc/hardware/physical-keygen-duplicating-house-keys-on-a-3d-printer
It occurred to me recently that I had printed almost nothing actually useful on my RepRap 3D printer, aside from parts to improve on or build more RepRaps. I am rectifying that with this project. The goal here is to generate working house keys by inputing the key code of the lock into a parametric OpenSCAD model. Instead of having to explain to my landlord how I ended up with a wedge of plastic jammed in my front door, I ordered a box of (well) used locks and latches from eBay to experiment on. Luckily, the lot includes both Kwikset KW1 and Schlage SC1 locks, which are the two most commonly found in the US. I created an SC1 model to start with, but Iâ€™ll probably make a KW1 soon.
EDIT: I uploaded a KW1 model as well.
Designing the key model was actually pretty straightforward. I measured a key with a ruler and calipers and created an approximate model of it that is reasonably easy to print. I then got pin depth specifications and parametrically differenced them out of the model. To generate new keys, you can just edit the last line of the file and enter in the key code for your key. If the code isnâ€™t written on the key, you can measure the height of each bit and compare to the numbers in the Root Depth column on the aforementioned pin depth site. Perhaps more nefariously, you could implement something like SNEAKEY to generate key codes without physically measuring the key.
Youâ€™ll of course need OpenSCAD to edit the .scad file and generate an STL to print out, unless your key just happens to be 33172 like the example STL posted below. If it is, you can unlock the doorknob currently sitting on my desk. As a small, precise object, this is a great test of how accurate your Skeinforge settings are. You may need to adjust some thicknesses or the built in pin depth fudge factor to get it working properly with your printer. The pictures above show the key being used on a disconnected lock cylinder, but I found it was also strong enough to turn a deadbolt. If your lock needs a lot of force to turn, you may need to cut a space into the key to use a torsion wrench with it.