3D Printing, Electronics, Photography, Software

The New Raspberry Pi Pieca Camera for Leica Lenses

I was really happy with the original Pieca design at the beginning. It was boxy and quirky but it made it easy to add all the necessary electronics for a Raspberry Pi camera. But as I kept using it one big problem became apparent, the lens mount was not going to last… After taking it to Supercon in 2022 and showing off all the optical components over and over the plastic tabs started to shear and after a few more months of use I could no longer mount a lens to the camera.

I was left with a few options, reprint the front face, design in a metal lens mount to the original camera, or create a brand new design with a few improvements. I took on the last challenge!

All New Design

I had put a lot of work into the original design, but I had a few outstanding problems I wanted to fix. The main ones were,

  • Ability to adjust the sensor position so I could tune the back focus after printing
  • Metal lens mount
  • Compact design

Micro-adjustable Sensor Depth

In the original design, I had a fixed sensor mount, which meant no moving parts but I had to print several different sizes to get the right depth to the lens mount. And when I discovered the focal reducer I had to do the whole thing over again! So I set out on a design and came up with a simple screw and linear guide that could all be 3d printed.

Since the sensor needs to be in a fixed orientation (not spinning) I used a slip ring so that as the screw moves it just pushes or pulls the sensor carriage along a set of rails.

The image sensor carriage uses several rails to guide it along so that it remains parallel to the lens mount. Any wobble would distort the image and make it difficult to focus. The carriage has notches that mate with the front of the camera on the inner and outer rings of the carriage. This was necessary for stability.

Combining it all together we can see in this speed up GIF that the adjustment steps are quite small due to the fine pitch. I didn’t do any calculations on this so I was pretty happy it worked out of the box!

Slim Design

Since we now need to have this screw protruding out of the camera body I could not keep the same triangular aesthetic. The adjustment screw needs to be centered with the sensor carriage which would intersect the screen in the old design. This design constraint limited my options forcing me to rearrange the components to fit in a more traditional rectangular format.

The old design left a lot of open space inside, so I was able to shift the Raspberry Pi computer to be mounted vertically in the front shell instead of horizontally. This worked great but meant I had a few more things to work out.

The first was batter placement, the old design had the battery mounted closer to the PiSugar battery board but that would interfere with the new sensor carriage. So I used the area above the sensor carriage to mount the battery and voltage monitoring electronics.

Simplified USB stick compartment

The original design used a complex hinged door with a locking mechanism that would sometimes pop open on its own. So for this new design, I wanted to update it to be simpler and there wasn’t a whole lot of room to begin with. it took several iterations but I went with a sliding door that is just friction fit. I may want to update it to be more robust in the long term but it’s been working pretty well so far!

The compartment houses the same USB stick from the old design and there is even some space for and extra one as well.

Metal Lens Mount

Plastic parts are not really meant to hold up against metal lens bayonets and this is especially true for 3d printed plastic. I didn’t want to have to machine my own mount for the camera so I came up with an idea that builds off of the heat set insert concept. I found a cheap Leica M mount to micro 4/3 adapter, off eBay but they can be found lots of other places, and removed the front metal piece that mounts to the lens.

I then set the metal piece into the 3d printed part and used my soldering iron to heat insert the screws into the plastic. It’s surprisingly robust for how small the screws are and its reversible meaning I can easily remove the mount for a different one. No glue required.

Amazon: Leica M to M43 Mount

The metal lens mount I purchased a while ago seems to be out of stock but this one should work. You just need to get one that does not use separate springs to tension to the lens. The one you want to look for just holds it against the metal by little cuts in the metal mount that are bent outward to pressure fit to the lens. I know it’s difficult to explain but just take a look at these images for reference.

Build Video

Here is the build guid for the new mechanical enclosure. Since the electronics and software have stayed the same please reference the original documentation. If there is more interest I will try to create written instructions with diagrams for the assembly.

Original Pieca Camera Documentation

Mount all the Lenses

With the ability to insert a metal lens mount into the plastic design and adjust the sensor depth with precision, I could add pretty much any lens I want to the system!

The fixed sensor depth and focal reducer that I used in the original design limited the lenses I could attach due to the reduced spacing between it and the final lens element. In the new design I can remove the focal reducer to adapt more lenses then adjust the depth. I can also increase the distance of the focal reducer to the sensor plane to play with the magnification factor.

Even with the focal reducer most of the lenses are still too telephoto. So I found a wide angle adapter that goes on the front of the lens. This allows for a more reasonable field of view from the 28mm M mount lens.

The other side benefit of the adjustable sensor is I can also use it to make any lens into a macro beast! This is because the sensor can be moved farther from the intended focal plane to focus closer than before.

The other thing I wanted to do was also use CS and C mount lenses that are intended for the pi HQ camera. I got a cheap 8mm lens off amazon that did the trick, but I 3d printed a m mount cover to complete the look.

3D Model Files

All of the print files are up on Printables for easy download.

Printables: Pieca Camera V2

What I’ve learned

Mechanical design is hard, form factor improves usability, heat set inserts are amazing, iterate small and iterate fast, reuse what works and don’t reinvent wheels.

What’s Next?

Finally got my Raspberry Pi5 and I have a larger sensor module to integrate. It requires a whole new software layer so that’s going to take some time but I will be trying to do incremental updates when possible. I also have some new tricks for the camera that I want to show off.