Norwich HackspaceProject Using 3D printing to create an attachment to fix a Raspberry Pi Camera to a Microscope.

Brian Norman
Retired Mathematics and IT Teacher

Background: The club I belong to The Iceni Microscope Club wanted to project an image while someone works under the microscope. We had various camera companies and microscope companies give us quotes, One company demonstrated their camera, which we found out shut down after 20mins, others tended to work through a computer, so when the software stopped being supported they would become obsolete. The majority costing well ove £1000. We ended up with an AV camera made in the year 2000.

When I saw the Raspberry Pi 5mp HDMI camera I realised this could be the answer, but attaching it to the microscope proved tricky. I could work it so that the camera through the Pi could be used to project High Definition images onto a screen using the image from a microscope, but using cardboard and sticky tape proved unreliable.

At this stage I had the camera showing “Live View” through the microscope, with a button press to take a picture and another button press to jump out of the programme.

I then came across Hackspace at the Norwich Castle and discussed using 3D printers to create parts, Having joined Hackspace and discussed the requirements more, I was then introduced to OpenScad a free 3D design programme. I used this and a 1950’s standard camera to microscope attachment to design a fitting to take the Pi Camera which fits onto the microscope. The initial design needed tweaking for printing as I had not understood the way the printer worked, rotating the piece and adding a few extra supporting pieces gave me a printable design.

The first piece was printed and I was able to screw the camera in place and it works well. I am now working on a second piece so the whole microscope camera fitting can be produced, so it is not reliant on a second piece from the 1950’s microscope camera fitting.

I have put more detail including the code for the Raspberry Pi, and the Open Scad information on my website:

Microscope and Camera

The current result is a bit untidy, so having got it to work, the next phase is to tidy it all up.

Make the camera section neater, the Raspberry Pi and buttons need to be more professionally housed so that I can create a simple plug and play camera for the club.

An extension to this project has been to work on automating taking stacked images under the microscope. To this end I have attached a stepper motor to the microscope fine focus, controlled by the Raspberry Pi, this will enable a set of photographs to be produced working through the focus of the object under the microscope. I can then “stack” these images using Helicon Focus to produce a better photograph.


I am developing more attachments to extend this work and the Ultimaker 2 is enabling me to prototype and make attachments that would be impossible in any other way.

Welcome, visitor. Files are available to download with this content. Please sign up to Download. Sign up or Login