Introduction: 3D-Printed Screw-In Front Lenscaps

About: I'm an Electrical and Computer Engineering Professor at the University of Kentucky. I'm probably best known for things I've done involving Linux PC cluster supercomputing; I built the world's first back in Fe…

Camera lenses might not be particularly fragile, but it can be surprisingly easy to get them dirty, or even to damage the exposed front surface -- commonly when you try to wipe dirt off them. That's what lens caps try to prevent.

Lenscaps (it's officially "lens caps," but let's see if I can coin a new word) come in a multitude of configurations, primarily differing in how they attach to the lens they are protecting:

  • Slide-on over the smooth lens barrel -- which often also slide off too easily
  • Various types of clamping mechanisms designed to grasp the female threaded part of the lens which is intended to hold screw-in filters -- these work well, but the spring mechanisms used are somewhat fragile
  • Screw-in like filters -- potentially getting stuck on the lens if the threads bind

Our goal here is simply to use 3D printing to make a better screw-in lenscap -- one with a few simple features to help ensure it will not get stuck. We err on the side of it being a slightly loose fit that even could be popped in or out without being likely to damage the lens thread (not that I'll accept any responsibility if you do damage anything ;-) ).

While we're at it, we will make these lenscaps serve a second purpose. By printing them using plastic of a known and relatively neutral color, we can make them also serve as a reference for color calibration.

One more goal. It isn't expensive to buy a lenscap -- a few dollars each is typical -- but cheaper would be nice, right? If you have access to a 3D printer, the most common sizes use less than $0.15 worth of PLA filament each.

It's probably also worth mentioning that my free, open-source, lenscap design program (written in OpenSCAD with Thingiverse customizer support) lets you make lenscaps in any of 37 "standard" diameters, not just the common sizes, and includes the ability to print-in text labels.

Step 1: Lens Filter Thread Sizes

If we are going to be making lenscaps that screw-into lens filter threads, we need to either measure or look-up the screw thread parameters for the named filter size: major diameter and pitch.

It's hard to measure these fine threads. That's bad, right? Not really. All common filter threads are compliant with metric thread standards. That's good, right? Not really. The shape may be the metric standard, but there are various diameters that can come in multiple pitches. That's bad, right? Yeah, it is. Thus began my quest to find an authoritative list of filter size names and the major diameters and thread pitches they imply....

Wikipedia gave a variety of sizes and said "thread pitch is 0.5 mm, 0.75 mm or 1.0 mm, depending on ..." -- but didn't include a table, formula, or rules to determine which diameters pair with which pitches and go by what names. For example, 49 means 49mm diameter with 0.75mm pitch, but what the heck does 40.5 mean? How about 86C vs. 86M? So, what are the standard filter sizes?

Hoya makes a lot of filters... they list the sizes they make, but give no details. Tiffen also doesn't say much, although they do separately list names for the larger-sized ones as 86C, 86M, 94C, 95C, 105C, 107C, 107, 125C, 127. Schneider Optics gives a list of the size and pitch for each filter they sell, but doesn't give the filter size names. In short, I'm left guessing. Most are 0.75mm pitch, so guessing isn't too hard:

NameDiameterPitch
3737mm0.75mm
3939mm0.75mm
40.540.5mm0.75mm
4343mm0.75mm
4646mm0.75mm
4949mm0.75mm
5252mm0.75mm
5555mm0.75mm
5858mm0.75mm
6262mm0.75mm
6767mm0.75mm
7272mm0.75mm
7777mm0.75mm
8282mm0.75mm
86M (medium)86mm0.75mm
86C (coarse)86mm1.00mm
94C (coarse)94mm1.00mm
95C (coarse)95mm1.00mm
105C (coarse)105mm1.00mm
107107mm0.75mm
107C (coarse)107mm1.00mm
125C (coarse)125mm1.00mm
127127mm0.75mm

Please comment with corrections if you know any of the above entries to be wrong. I've omitted smaller sizes because I found no consistent naming to distinguish the pitches. Of course, the standard metric thread notation would work -- e.g., 49 is M-49 X 0.75 -- but none of my 130+ lenses have threads labeled like that.

In summary, either find your filter size in the above table or measure and round to the nearest standard size (because that's probably what it was supposed to be).

Step 2: Material Choice

There are a lot of different 3D printing technologies and material choices. You'll want to choose wisely. What you want is a material that's durable, reasonably stiff, doesn't outgas or provide a good home for biologicals, etc.

Most "consumer" 3D printers extrude heated plastic filament to build-up the part. Here are a few of the materials I've tried on my MakerGear M2:

  • PLA (polylactic acid): works very well and is available in a wide variety of solid and translucent colors, but temporarily softens if left in a very warm environment, such as the rear deck of a car parked in full sun. You shouldn't be baking your lenses like that anyway (it can make internal lubricants flow where they shouldn't be), and this is probably the most environmentally friendly material to print, so this is probably your best choice.
  • ABS (acrylonitrile butadiene styrene): a little more heat-tolerant than PLA and more flexible, but usually not as good at holding precise dimensions as PLA is. ABS should be fine if the part doesn't significantly warp as the print cools, but the thread requires high dimensional accuracy.
  • T-Glase (PETT): more flexible than ABS, but holds dimensions well, this is generally supplied in transparent colors. The clear filament is particularly clear, without a yellow tint, but the construction of 3D prints makes a part like this look more like a white diffuser or ground glass than an optically clear filter. Be warned that the black T-Glase is really more of a smokey bronze color -- very pretty, but quite strongly tinted.

In sum, any of the above can work, but PLA will probably give you the most solid lenscap.

I'd suggest using a plastic of a neutral color, as that will facilitate the use of the lenscap as a color calibration reference (as discussed in Step 4). The best choices are probably gray or white PLA or clear T-Glase (clear PLA usually has a significant yellow tint). The caps shown here are all made of Rosewill Grey PLA.

Step 3: Design and Print the Lenscap

The 3D-printable design is on Thingiverse: Thing 414556.

Actually, it's an OpenSCAD program that lets you use the Customizer to specify the parameters:

  • Cap Diameter: a pull-down menu of the standard sizes -- select the one you need
  • Cap Pitch: a pull-down menu of common pitches, although most are 0.75mm
  • Cap Tolerance: a slider to set the tolerance (gap spacing) for the thread; 0 will usually result in a thread that's hard to screw-into the lens, and it is easy to make things too loose, but about 1/2 the thickness of the extruded plastic is probably about right (125 microns for 0.25mm extrusion)
  • Cap Thick: a 1000 micron (1mm) thickness works fine for the grip part of the cap, but thicker feels better, is stiffer, and will allow labeling to be set-into both the front and back of the cap
  • Cap Label Position: I like the size marked on the inside, but you have several choices
  • Cap Name: If you selected "both" for the label position, the inside of the cap will be marked with the lenscap size and the outside will be marked with the name you give here -- text is scaled to fit, but you'll get an unreadable mess if you use too many characters

Tell the Customizer what you want and have it make the STL file to print... or download the OpenSCAD file, edit it to set parameters, and make the STL locally. The labels are made using the Write.scad library, so if you're making STLs locally, you need to have a copy of that too.

Although you need high precision for a good fit, the STL should be an easy print on a well-calibrated consumer-level 3D printer in the default (outside down) orientation. There's actually a little trick here: such fine-pitch metric threads would normally be virtually unprintable, so this uses a metric-compatible thread profile that avoids the filament-dropping overhang angle (it never exceeds a 45-degree slope). The resulting thread is not holding the lens filter thread as well as a real metric thread would, but it is more than good enough to hold the cap in place. A well-calibrated printer should not have problems printing a bunch of the caps plated together.

I used Cura for slicing, with 25% fill and 0.25mm extrusion. Up to about 40% fill is reasonable, but denser fill doesn't really make a stronger part -- it primarily makes warping during cooling much more likely. A 55mm lenscap takes about 4 grams of PLA and prints in under 10 minutes. My MakerGear M2 can spit them out in closer to half that time. I generally recommend printing on a heated glass bed around 70C for both PLA and T-Glase, and this helps give what will be the outside front of the cap a glassy-smooth finish that can resist the environment a tad better than the slightly rough finish you get from printing cold on blue tape.

Step 4: Using the Lenscaps

Whenever I fly, I always get instructions on how to buckle a safety belt. Well, using a screw-in lenscap is at least as difficult, so here are your instructions:

  1. Line-up the threaded portion of the lenscap with the threaded front of your lens.
  2. If the cap does not start threading easily into the lens, you can gently push it in a bit to seat it more evenly in the thread.
  3. Gently push the cap against the threads, rotating the cap clockwise to tighten it.

To remove the cap:

  1. Gently pull the cap away from the lens, rotating the cap counterclockwise to loosen it.

Whew! I'm glad that's over... but wait, there's more!

If you wisely picked a neutral-colored plastic, you can also use this cap to set white balance. There are three methods:

  • Hold the cap in the same lighting as the scene you want to color balance and take a photo. Use your favorite photo editing software to sample the image of the cap to set color balance for postprocessing your photos.
  • Hold the cap in the same lighting as the scene you want to color balance and set the camera's manual white balance by sampling it.
  • With a thin cap on the lens, the plastic is slightly translucent and can act as a diffusion filter so that you can set the camera's manual white balance by sampling the ambient lighting with the lenscap on. The gray caps shown work ok using this method, but white or clear plastic can work better. Laugh at the people laughing at you when you deliberately take a photo with the lenscap on. ;-)

The first of these methods is most precise because you can easily compensate for a lenscap that isn't quite a neutral color. Note that the cap does not need to be in-focus for any of these methods to work.

Now, go take some photos!