I had some older lenses for my Pentax SLR camera. The lenses have manual focus and manual aperture control. So, I went about designing a 3D printed holder for the lenses and the raspberry pi camera module V2.
First, I measured the Pentax SLR camera body - particularly the distance from the lens mount plane to where the film was. Then, I designed a barrel and holder so that the bayonet lens can twist into the print, the raspberry pi camera module v2 can mount on the other side, and the whole thing can be mounted securely.
Note - you have to take off the original lens that shipped with the raspberry pi camera module v2. You can use the lens removal tool that came with the camera, or 3D print your own ( https://www.thingiverse.com/thing:1574661 ).
It worked out pretty well! Here is a photo using a 28 mm lens.
The distances were roughly correct - the subject was about 2 m away, but the lens reading was about 1m.
I put some black construction paper on the inside of the print to help block the light, but there is still a little light leaking through the back, so the picture has a delightful blueish tinge. :)
Since the lens ended up a bit closer to the sensor, then you can always add spacers at the back where the sensor is to adjust the lens through normal to macro operation. You only need a few millimetres, which is something I never fully appreciated until this project.
Note that the sensor area is quite a bit smaller than the film for the SLR camera, so you get a smaller slice of the image.
If you want to see what can be done with this setup, head on over to:
https://hackaday.io/project/178655-getting-cozy-with-the-diffraction-limit