Introduction: Make a Working Lock and Key
In this instructable I'm going to run through the process of making a working 5-lever mortice lock and key. Steps 1 & 2 are an overview of 3D printing requirements and how the mortice lock works, with steps 3-7 showing you the construction of the lock, and the final piece demonstrated on page 8. For the purposes of this I will leave out the making of the decoration, though it can certainly be 3D printed also, but feel free to contact me if you want to know how to do it.
Step 1: Planning a 3D Print
Firstly, I'm going to run through the basics you need to keep in mind when preparing a model for 3D printing. If you have already used 3D printers, then feel free to skip on to the next page, or take a quick look at the bold writing to double check the basic rules.
There are several types of 3D printer available, and depending on what one you're using will affect the way you make your model. For example, a printer using photopolymerization uses light to harden a liquid resin in layers, so when completed the model is simply pulled from the liquid, allowing for all types of undercuts/ interlinking items. However, Thermal Extrusion printers heat plastic and print each layer on top of the previous, meaning that it has to create supports to reach any undercuts in the model. As a result, the supports need to be cleared away before the part is ready, so interior or interlinking details are not really viable. For the purposes of this instructable I am going to assume the model is being printed using Thermal Extrusion as it is by far the most common form of 3D printing. Another important aspect of the printer to keep in mind is the type of material you will be printing in, as it will limit the thickness and minimum level of detail it can print.
So, for thermal extrusion here is what you need to keep in mind.
1. The digital model you send to the printer will be in STL format (Stereo-lithography). This is basically a 3D placement of the paths of the surfaces on your model. However, if your model has any intersecting details it will have difficulty understanding what is meant to be an exterior or an interior surface, and can easily print the wrong thing. Avoid intersecting surfaces. While it can be time consuming to find ways to connect geometry together, especially if detailed, it is necessary. Booleans are a great tool for combing/subtracting objects, but be careful with these. Multiple boolean operations to one object can cause unexpected results. If using booleans, try to compile all objects to be cut into one object before cutting. If in doubt of any problems on your model then run an STL check before exporting. Most 3D programs have the ability to do this.
2. Don't try to send multiple objects in one STL file. As tempting as it is to just export everything together and rush through the printing setup it can easily cause problems, as well as leaving no room for manoeuvring objects in the print setup. One of the main problems here is that any models touching against each other will have a layer of support built between them, regardless of whether or not there is space in the 3D file for it, which can cause parts of your model to be lost. Individual STLs of objects also makes it easier to detect and replace faulty pieces.
3. Thermal extrusion builds up in layers, whose thickness depends on the quality and speed of the printer. This means that any vertical detail will have layered ridges, much like a stack of paper (though often rougher as the layers will be thicker than a single sheet of paper on most machines). While flat surfaces shouldn't have a problem printing vertically, it can become an issue when printing curves. Try to limit curves to being printed horizontally. While it takes up more space on the printer bed to lie everything flat, it will reduce the number of layers and thereby the roughness of the object. Think about how you place your models.
4. When making objects to fit inside another, don't make them flush. While 3D printing is highly accurate, there is a small amount of bleed in the plastics as they cool, and the ridges of the layers will provide grip to the sides. Trying to insert an object into an exact sized hole will be nearly impossible and require filing/sanding in order to fit. Allow a small gap (~0.5mm, depending on the quality of the printer) around the edges to ensure the piece will fit smoothly.
Phew. Ok, now that the boring part is over, let's take a look at what we're going to be making!
Step 2: Overview of the Lock
There are a huge number of different types of locks out there, but I decided to demonstrate the mortice lock as it is one of the few locks that can be made without using any springs. This means that you will require no external parts to make this, everything you need will come from the printer. Now yet again, there are several types of mortice lock, so i will be making the standard 5 lever lock that would be found in most homes.
Unfortunately, there is a distinct lack of imagery of the interior workings of a mortice lock, so I hope you don't mind if I use my own images to explain it. I have included the exploded views of the lock to demonstrate how it will all fit together, in front, side and elevation views, as well as the components spread out so you can see them better.
The mechanism for the lock is surprisingly simply, but getting the shapes to fit together and flow smoothly can be a problem. As the name of the lock implies, there are 5 levers inside, however you would probably have noticed that most mortice keys have more than five notches to them. In fact, they will have seven. This is because two are used to actually push and retract the bolt that locks the door. In order for the key to work from both sides, it will need to be symmetrical (although if you wish the lock to be one sided only, for something like a safe or cage where it can only be opened from one side, then you can alter the design).
The key, once entered into the lock, sits inside a small cylindrical container called the "curtain". This is pushed around by the turn of the key and is what catches onto notches in the bolt which will push and retract it. The levers then have notches which hold onto a section of the bolt and need to each be lifted to the correct height in order to open a gateway for the bolt to escape. Curves at the base of each lever match the height of the corresponding pin on the key, so that it maintains an even height long enough for the bolt to move.
These are really all the requirements of the lock, beyond that all we need to worry about is building a casing to house the components, and ensure everything is supported and able to move to it's full range of motion. The curtain for example really pushes the bolt using a smaller segment at it's back (which we'll see later), but has a larger support that will help to steer the bolt. Similarly the levers rest on the notch of the bolt when open, but once the device is locked they need something to rest against, hence the slight support jutting out from the side of the casing.
If you're still unclear, or want to see a mortice lock in motion then here is a good explanatory video.
So, now that we understand the premise of the lock, let's take a look at how we're going to make it.
Step 3: Beginning the 3D Model
There are a number of 3D modelling programs to choose from out there, ranging from free to extremely expensive. I work from the Autodesk Entertainment Creation Suite so I chose to work with 3ds max as it is probably the most efficient for modelling for print. If you want to use max, then you can get the trial version here. However there are plenty of other free options for modelling such as Sketchup, Blender or Autodesk 123.
A note before I begin; Poly flow and maintaining all quads is an important process in most pieces of 3D work, however, it is far less important for 3D printing. Keep the models tidy enough that you can control what you're doing, but don't overly concern yourself with perfectly clean meshes. By the end of this you'll see I have left my meshes quite untidy, but as long as they pass the STL check they'll print as you see them.
Make sure to set your units to a scale you're comfortable with. for something of this size I chose to work in mm. In max, go to Customize > Units Setup and set both the system units and working units to mm. To begin, I found it easiest to consider the key as it is the centre of all the action. You needn't make the actual key for now, simply make a cylinder of about 3mm radius, and increase the segments. An important thing to remember is that smoothing won't be considered when printing so it will print in faceted surfaces, meaning curves will need higher numbers of segments to be kept smooth. It may even be best to set everything to 'Hard' surface in Properties so that you'll see exactly what will be printed. Convert to an editable poly and, using connect and extrude, divide up the surface and pull out the basic shape of the key. At this point you can make it look however you want (I went with space invader, just because I could) as the levers will be made to match, just keep in mind the scale you're working at and try to keep the the notches tall enough to make a difference (1mm+) but don't go overboard or your lock will be giant! Make sure each pin is about 2mm wide. Once you're happy with a basic shape we can move onto making the curtain.
Step 4: Making the Curtain
The curtain's main purposes are to
A) Fit and move with the key
B) Move the bolt
C) Steady the bolt
We also need it to sit into the casing so it is supported and turns freely. So, we'll need a section for each layer. Step 1, make sure it fits by taking the shape from the key.
Duplicate your key, take the loop of polygons going around the longest pin on the key and extrude them along their local normal a few millimeters. You may need to tweak the result slightly to keep it tidy, just make sure to only use the axis they're on so you keep the surface flat (or use the constraints in the edit poly stack). Keeping the faces you just made, delete the rest of it and bridge the new borders. This is your starting point. Don't forget to scale the interior every so slightly so it's not flush with the key. You may need to tweak this slightly so it's even all round.
Select all the faces on one side and extrude outwards in group the same thickness as the next pin. Extrude the same amount one more time. Select the inner ring of polygons and extrude it outwards on it's local normal. This will be the largest section of the curtain which will steady the bolt. You can shape this into an egg like shape similar to the one shown above (You can ignore the small notch in it as this was for a separate mechanism I decided not to include as it was unnecessary). On the third segment, delete all but the curved section as you can see above, and bridge the remaining gap closed. This piece will be what sits into the casing to support this end, and needs to be perfectly round (aside from the gap for the key) in order to freely turn.
Finish off the other end by extruding a wider segment for supporting itself against the opposite casing, with another purely circular piece to sit into the casing. Once closed up, the curtain should now rotate freely on it's ends. Next up we will look at the levers.
Step 5: Making the Levers
The levers will sit inside the bolt so will need to remain quite small to fit them all. While there are five of them, the only real difference between them will be the curves at the bottom for the pins on the keys. Start with a small box only slightly wider than it is tall. Make sure it is a bit thinner in depth than the pin on your key, but still close to 2mm. You'll likely want to fit a small washer (.3mm) or something similar between each lever when assembling to help it run smoothly so it will need a small gap, but you want it wide enough that it can withstand some pressure without snapping. Ideally you would want to print these in metal. Place the box so that it's centre is slightly to the left of the key, and so the key when turned up towards it is about a quarter of a way up the lever.
Firstly, you will need to establish a pivot point. You'll want this as far to the right as possible to make it easier for the key to lift. Using swift loop / quickslice / connect, cut about a third at the top and extrude out a small piece to house the pivot. Create a small cylinder, make sure it has high enough segments to be smooth in printing, and place it over where you will have the hole. Next, select your lever, and adjust it's pivot point. You can do this in max in it's hierarchy tab next to create and modify, by selecting "Adjust Pivot Only", then use the align tool to match it's pivot with the pivot of the cylinder. Exit out of the hierarchy. Now the lever should rotate from the cylinder like it will inside the lock.
The lever should only have to rotate about 15° upwards to reach it's opening state, but you can determine for yourself the best height. Rotate it to your chosen open position and create a small box close to the center to represent the notch of the bolt. Cut and delete a horizontal pathway to the left for the notch to exit through, making sure to close up any gaps you create. Rotate the lever back down and note the path the notch follows. Cut and delete a section for this path. Once again cut lines horizontally to the notchs new resting position and cut a small hole in the side of the lever to catch the notch should the bolt be pressed back while the levers are closed. Clean up the current layout into something similar to what I have above, and round off any corners where pieces might be gliding against each other.
To create the curves for the key pins, create a cylinder for each pin, where the center of the cylinder is aligned to the keys handle and the radius reaches to the pin. You should have 4-5 cylinders depending on how you made your key. These will be deleted from the lever while it is in open position so that the pin will move along the created curve, holding the lever up til the notch has passed through the gateway. Attach the cylinder to the cylinder for the pivot point and use a boolean operation (found in max under Create > Compound objects > Boolean) to subtract them from the lever. Bridge any gaps. You'll need to do this separately for each lever, just be careful to try and boolean only once per lever, and make sure you're cutting the right shape for each pin. Once they're all cut, you can rotate them back to a closed position.
You may notice that I have one lever that doesn't match the others. It's gateway is straight without rotating and the hole for the notch is below it rather than above. This is because the lowest pin will pass through the lever without touching it, whereas an incorrect pin would lift the lever, thus trapping the notch. Feel free to include this type of lever in your own model. Next up, we will create the bolt.
Step 6: Making the Bolt
The bolt is one of the hardest pieces to make because it needs such accurate holes for the curtain to drive it forward and back a long enough distance in a very short amount of time. For this reason your levers should be shaped like the ones demonstrated so that the notch has less of a distance to travel while still being secure. While making the bolt you may need to revise your levers slightly to ensure accurate timing for the bolts release.
Start with a box about 1.5 times the height of the lever, and almost double the width. The depth should be the same as the entire width of the keys pins. Don't worry too much about these measurements, they can easily be adjust later without too much hassle. Position it so the cylinder for the levers rotation is halfway up on the far right. Rotate the levers up to their open position and adjust the bolt height to ensure it fits inside. Angle the top of the bolt so it encompasses the levers and prevents them going beyond their open position. Cut to the left of the lever and along the top to extrude inwards a space for the levers to sit. It should be about 5 pins deep, leaving two for the curtain and bolt throwing mechanism. They should just fit, including any space for washers between them. Using the box you created in the previous step as a reference for the notchs positioning, cut and extrude the actual notch, and round the corners slightly.
To better understand the hole required for the curtain to move the bolt and how it works, I suggest you watch this video. You'll notice how the largest piece of the curtain is barely used in pushing the bolt, but rather the moulding on the back that you created first when making it. Line up your curtain with the bolt and rotate it a few times to understand where it will contact it. Move the bolt across to the minimum point where the notch has been released from the levers, note the distance it has travelled and the point where the curtain leaves the bolt. Note the halfway points of both of these positions (ie, when the curtain is pointing directly up and where the bolt would need to be.). Do the same for the reverse direction (opening the lock). If you were looking for a very accurate and smooth result, you would need to turn to either a specialized drawing program like AutoCad, or draw up the plans on a drawing board to get the required curve. However, and while I don't recommend this for a good lock, you can get a pretty solid result by applying the shape of the notch, as seen above and in the video, to the points you currently have which should have given you the required height and width. To do this, create a box with a good number of segments and move it into the required shape. Then, track it's position as the bolt moves and adjust the curve to suit the required push. Again, I would try and draw up the plans accurately first if at all possible before resorting to that method.
With the notch in place, all that's left is the secondary curve for the curtains stabilizing section to move through. This can really be any shape you like, it's simply the depth that matters, though I shaped mine to try and assist the pushing off the bolt. Just make sure the curtain can rotate freely with the movement of the bolt.
Don't forget to tidy up and smooth off any corners or moving parts, and move the model back and forth to make sure nothing collides. If possible, it's best to set up an animation of the piece moving so that you can see everything moving together and check for errors.
Finally, we just need to assemble the casing.
Step 7: Making the Casing
The final stage of making the casing is almost as simple as building a box around the mechanisms, but with a few additional touches;
1. Incorporate a small support to hold up the levers when the bolt isn't in place.
2. Create a small notch at the back to help guide the bolt.
3. Include a way of screwing the two halves together without blocking any moving parts.
4. Boolean out all relevant supports, screwholes and keyholes.
I have chosen to screw together the model as it is by far the simplest method, though I am sure there are many people who would have much more interesting solutions. While I won't go into detail on how to make screws, they are relatively simple models that can either be downloaded or if you fancy trying them yourself I'd recommend this tutorial.
Begin by creating a box wide enough to incorporate the full rotation of the curtain, and that ends with the bolt (in open-lock position) flush against the edge. Leave a small bit of room above the bolt and enough room at the bottom for the curtain. The thickness of the casing is up to yourself, and can vary depending on what material you intend to print in. Duplicate the model and extrude the front to create the other half and delete the rest. Bridge / Cap any gaps. If you choose to screw the models together then simply extrude a few blocks on the back casing for the screws to settle into. These can double up as supports for the bolt if you align them with it. If in doubt of where everything will move, try placing cylinders over anything rotating to see it's rotation arc. Also cut and extrude a small section to meet with the back of the levers when resting so that it can prevent them moving without the bolt in place. Keep in mind that it will need to come in from the side wall, as the curtain will have to rotate beneath it.
Seeing as the bolt and casing are flat against each other, it is easy enough to make a segment that extrudes from the back of the bolt, and a matching recessed channel in the casing to allow for the range of motion of the bolt. This will help to guide the bolt and prevent it from slipping.
Finally, we can prepare to boolean out the final shapes. Be careful in your setup at this stage and make sure you have included everything and remembered to slightly offset the scale of each shape so that it won't be 100% flush. I found that in order to keep the positioning exact, include the pivot cylinder for the levers in the boolean without it passing all the way through, and then create the actual piece extruding / moving the resulting circle out. In this stage you need to include: The keyhole shape, the curtains circular support rings, the screwholes, the lever rotation pin. Once these have been subtracted there will likely need to be some cleanup in order to make the pieces printable. Try to weld all vertices at an extremely low value like .1mm, and do the same for edges, as this should remove a lot of problems. If there appear to be borders where there aren't any, then check to make sure no faces got their normals flipped in the process, and flip them back if they did.
Once everything is cleaned up then that's it, you now have a working lock. Congratulations! On the next step I'll show you the final piece in action.