Creating a wooden locking mechanism is not hard in case you can make use of a laser cutter. This instructable describes my approach for locking a compartment
Step 1: Laser Cut
Using online tools for constructing the rack and pinion is very handy. I've used one for calculating the number of teeth and all parameters, and another one to export DXF files in order to import into my CAD system for the laser cutter.
These are my favorites:
- Gear builder: Woodgears
- Geargenerator: this one can export directly into SVG format
- another one with DXF Export InvoluteSpurGearBuilder allow regular, rack and pinion or planetary gear design
Finally you should end up with something like this plan
Let the cutter do it's job
Step 2: Assembly Gear
Now you should have all racks, pinions and spacer in hand and mount them on a wooden plate. Choose the size which you prefer. Best is to glue the two racks together - you can leave the supporting screws in place or remove them after glueing.
You need to add some pieces on top and bottom to keep the pinions in positions and avoid the to move others than the wanted directions
Step 3: Assemble Whole Block
now cut some round 14mm diameter rod into the proper length and mount them on the pinion. The absolute length of course depends on dimensions of your device you want to lock.
Locking to my compartment, I've added an extra wood block to sustain the force which will be applied while the whole device is locked and in place.
Step 4: Test
Don't forget to drill some holes on the other side of your device in which the rods will be pushed.
Finally once all is done, the locking mechanism should work like shown in the video - mine is doing a nice job :-)