Introduction: Raspberry PI Camera Spinner 3D Print

About: Software geek, electronics enthusiast, musician, artist ... I enjoy making stuff, and discovering new things!

This Instructable is for a 3D printed camera-spinner module for the Raspberry PI Camera board.

As part of a larger project (a portable Raspberry PI computer), I needed a way to implement a front and rear facing Raspberry PI Camera board.

Fitting two camera boards to the standard PI boards is not currently possible. The compute module version of the PI does support two cameras, but I have the latest model 2-B board.

This is the optical/mechanical solution I came up with, from prototype to finished product, and it's also an entry in the 3D Printing contest.

Step 1: Parts List

  • 3D printed unit from the STL file below
  • Raspberry PI camera board and flex lead
  • Small mirror (12mmx8mmx1mm thick)
  • Thin metal washers: Large and small
  • Insulated washers
  • Small/tiny self tap screws
  • Dual microswitch
  • Spray Paint (primer and matt black)

Step 2: Cardboard Prototype

Rather than literally spinning the camera, I used a mirror angled at 45 degrees directly above the camera, spinning on the camera's view axis. The camera points upward into this mirror, which lets you look in three directions (and "off").

This prototype was to check dimensions, and see if the viewports in the outer case would be sensible sizes and positions.

The closer the mirror is to the lens, the smaller the mirror can be, and therefore smaller the viewports are to give a completely unrestricted view. I don't want to see the edge of the mirror in the view, or the edge of the viewports.

The viewports were originally made undersize, and then using the view through the camera, remarked/recut to the correct size and position. You can directly measure off the camera's view to work out how far off you are from the correct centre/width/height.

Step 3: Spinner Prototype

Using scrap gears recovered from old VCRs, a large bolt and a small 45 block of Polymorph moulded around its head (shaped to 45 degrees) and various nuts and washers for spacing, I made a temporary spinner. The mirror is held on with a drop of superglue.


Looking at the prototype viewports, you can see clear through the camera unit, so I added a shroud to limit this and to limit any excess light coming in. The shroud is from a 35mm film canister, cut down to fit within the lip on the main gear.

The mirror used is a front surfaced mirror: Most mirrors are silvered on the back, and you look through the glass at the mirror. This can lead to distortions in the image when viewed at angles. This mirror was scavenged from the optical auto-focus mechanism of an old compact camera.

In my target application, I need to know whether the camera is currently aimed forward or backward. I created two shaped cams to operate a pair of microswitches: One cam/switch signals the Raspberry PI to fire the LED flash/lighting if the camera is pointed either forward or backward -- but not for "side" and "off". The second cam/switch allows hardware switching between front and rear flash/lighting.

Obviously using a mirror will flip and rotate the picture. The Raspberry PI camera hardware supports hardware flip and rotate of the image and preview, and so the cam-switches can also be sensed by the Raspberry PI to indicate which way "up" the picture should be.

Step 4: PCB Prototype

The cardboard prototype proved the dimensions could work, so a second prototype in copperclad PCB was made. This is a bit more solid and allows for more accurate measurements, and can be easily joined with superglue and solder dots in corners!


For the viewports, I drilled a large (3mm) hole where the centre of the viewport should be, and then a cluster of smaller (1mm) holes around it. These holes will be used to measure the true edges of the viewports in each direction.

Step 5: Find Accurate Viewports

The two halves of the structure create a square tube, and the camera is mounted on a small block of wood, with matchsticks as spacers to lift the camera so the components on the underside aren't crushed!


With the structure assembled, and the mirror pointed directly at each viewpoint in turn, capture a picture. Using the distance from the centre of the "centre" hole, to the centre of each of the other four, work out how far further the edge of the view really is, and remark/recut the holes square.

This provides the accurate dimensions and positions relative to the camera board.

Step 6: Blender 3D Model and Render

Using the dimensions and positioning from the prototypes, I modelled up and animated the finished design in Blender 3D http://www.blender.org/

There are some changes from the prototypes :-

  • The main gear is moved to the top flat against the lid, which makes it more stable
  • It is shrunk down so it does not have to pass through the sides of the case
  • The whole shaft-gear-cams-shroud and 45 degree block are one component.
  • Drive gear not offset, but mounted straight on
  • An attachment point for the microswitches on the left
  • Viewports bevelled
  • Exit slot for camera cable
  • Camera mount block is hollowed to allow some airflow to the bottom side of the camera board

There are a few other small corrections in the STL supplied above, based on experience of assembling it, moving of mounting holes etc.

For cost reduction, the square tube is split into two pieces, and the spinner and camera mount block moved inside the swept volume. Although the spinner does already fit inside, clearance is minimal (to help keep it straight in use!) which would result in it being fused to the sides when printed. Also, some of the spare space is used to provide some spare drive gears and shafts. Everything is connected by 2mm plastic sprues to make it one single component to print.

The animation feature in Blender is not only cool for showing the model off, but also for having separate points on the timeline for "assembled shape", then "exploded view" and finally "printable shape" as you can see in the video clip.

The design was then exported as an STL file (units = mm), the size of the overall printed unit is 49mm x 46mm x 63mm. Check that these are the dimensions before printing!

Step 7: 3D Print It!

I contacted three UK based companies for quotes to print this. One non-response, one was way out of my budget, and a clear winner was 3D Print UK (https://www.3dprint-uk.co.uk) who not only did a great job, but had a reasonable price and were very helpful in flagging up some corrections to the STL file.

3D Print UK use an SLS system, which fuses nylon powder together with a laser, allowing fine detail and allowing for shapes with overhangs etc. that are very hard to print on an extrusion 3D printer. They have plenty of tips on their website on what minimum sizes and clearances you should use, and also tips on cost reduction. 3D Print's charging system is not based on material used, but on swept-volume of the shape (10p/cm3 economy), hence packing all the parts in close. There is also a minimum charge per component, so using sprues to connect everything makes it one component. This piece comes in just above the minimum order limit.

In the pictures, the "purple" parts highlight/mark the locations of sprues that need to be cut through and filed smooth. Scissors can easily get in and snip through them, and an X-Acto knife will cut them flush after.

The camera mount block did not allow the camera to rest flat, the camera connector is a little larger than I thought/measured. This has been corrected in the STL file above, but for now I milled away some of the nylon (marked) to get clearance.

Now clean all the dust off. Although 3D Print do clean most of the dust off, there was still some trapped in corners that needed to be brushed, blown and scraped out. For an optical unit, dust is bad!

Step 8: Assemble It

The spinner is held into the top plate with a spacer washer (large inner diameter) and a retaining washer (small inner diameter) and self tapping screw. A small pilot hole was drilled for this screw. This should allow the spinner to rotate without wobbling. The shaft extends above the lid by a small amount to allow for this second washer.


The camera is mounted onto the block with two tiny self tapping screws. There are insulated washers under the screw heads to stop it scraping the PCB surface. The lens of the camera needs be on the optical centre line -- in the STL file there are two grooves added in the sides to show this centre line.

The spinner and lid is dropped in from the top, then the drive gear is inserted in the slot and pinned with a shaft. You can use a 4mm metal shaft, a plastic bolt, or there are now some 4mmx8mm shafts in the STL file!

The exact position of the camera block can only be set once the mirror is attached to the spinner. Thread the camera cable through the slot and rock the block in from the bottom end of the tube.

Set the block so it's as close to the mirror and shroud as possible without catching anything. Check the shroud rotates fully.

Check the view in all three directions to make sure the viewports do not infringe on the edge of the picture. When it's in the right position, a small pilot hole through the sides and front pins the block in place with three more tiny screws.

Step 9: Extras

The lever arms on the microswitches need to be shaped so that they follow the cams correctly, and need to be angled to keep the line of movement at about 90 degrees to the rotation axis.

The position of the switch should be adjusted so that they don't change state when the camera is up to 10-20 degrees off any "straight" direction. Once the camera is transitioning, they should click to indicate a new position is being approached.

Once the ideal spot and angle are found, the switch is bolted onto its ledge with 8BA bolts.

Note: With this switch in place the spinner cannot be removed!

You will note the top of the gear has four small dents. These dents align with a hole in the lid when the camera is pointed "straight" in one of three directions. This allows you to see that the camera is straight when setting it up and aligning the camera block.

You don't need to use this feature, but I built a small mechanism to help feel and lock the position. This uses a small plastic spot LED as a plastic ball-bearing, and a spring in a tube. This will be mounted in the case above the camera, adjusting the distance of the tube sets the spring force to provide just enough effect to give a positive click when the gear is turned.

Step 10: Finishing Up

The white nylon allows light through, and also causes a few white reflections when a glass cover is placed in front of the viewports, which will be part of the main outer case of the computer.


So mask off the driver gear opening, the gears and cams, and the mirror mount area, and prime and paint it matt black. The rough surface of the SLS nylon accepts paint well.

Glue the mirror in place, making sure to get it shiny side up. This mirror is shiny both sides! But only one side is the front!

Finally the square tube can be re-united with superglue along the two long edges, and all the parts assembled.