[Devon Croy] built a case to join a webcam sensor with a camera lens. The box is a PVC conduit box you’d find at a home center. He used JB Weld to attach four bolts to the back of the box. These are used to fine-tune the mounting plate for the webcam sensor to ensure it’s at the focal point of the lens. The lens connects through a couple of extension tubes to an adapter mounted in the center of the box’s cover plate. The setup above shows a macro lens that takes pretty good pictures.
If you need images of really tiny things you should look into a microscope adapter for your camera.