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.
For more detail: Raspberry PI Camera Spinner 3D Print