We looked at the case first. None of the off-the-shelf cases were suitable because our case needed a mount for the camera. As we reviewed the Ultimate Box Maker 3D modelling OpenSCAD script last issue, we opted to use that to make the case. It creates a four-part box, with PCB mounts that can hold your Raspberry Pi in place. You can also add holes in the front panel, and we added holes for the power lead and camera ribbon cable. This wasn’t quite everything we needed though, so we exported the STL files and took them into Tinkercad, where we added a mount for the camera. This was just a square to make the case slightly thicker at that point with some 2.2 mm holes (for M2.5 screws). We also added an M6 threaded bolt (by importing this STL model from Thingiverse (hsmag.cc/DXCKq4) which can attach to a standard tripod screw.
I made a few mistakes with this case. The mounting holes for the PCB don’t quite line up properly, as apparently I’m careless with callipers. The tripod mount was also a mistake – I should have mounted the camera lower and used the mounting bolt on the lens mount. The lens weight is significantly more than the weight of the rest of the camera, so putting the bolt where I did puts more stress on the tripod.
Neither of these deficiencies stops the camera working though, so rather than waste more plastic on another revision, I’m going with it. I fully expect to find further problems as I go along, so at some point in the future, I might bundle them all up into a new revision.
Once Raspberry Pi and camera were mounted, I needed a way of taking pictures. My first thought was to have a button and TFT screen, and I started rummaging around my spare parts. I do have a few TFT screens that should work with Raspberry Pi. However, it dawned on me that I carry a far higher-resolution screen with me at all times – my phone. Why not use my phone screen to preview the image?
There’s a fairly comprehensive web app for controlling Raspberry Pi cameras called RPi Cam Control, available from hsmag.cc/EYIGyV. With this, I just need to connect my Raspberry Pi to the WiFi network, and I can control the camera through the web app. It’s got a preview section and the ability to take photos, as well as more advanced features such as the ability to take time-lapses. It’s not the most mobile-friendly interface, but if this camera proves useful, I’ll be able to update the interface in the future.
There is a slight downside in that I need my phone to be connected to the same WiFi network as the camera. In the house, that’s not an issue, but if I take my camera out, I’ll need to set up a WiFi network on Raspberry Pi that I can connect my phone to.
I have been wondering a bit about adding something to the case to slot my phone into, so it’s held in place like the screen on a regular digital camera. This is something I might look at in the future, but in the meantime, a couple of rubber bands do the job.
The battery is the final piece of the puzzle. There are roughly two options for powering a Raspberry Pi via batteries: USB battery packs, and LiPo adapters. This is one of those areas where ‘use what you’ve got’ is a good maxim. I had a spare suitable LiPo, so I ordered a Pimoroni LiPo SHIM to power my Raspberry Pi from it. There’s one slight complication: while you can shut down Raspberry Pi from the web app, you can’t restart it if needed. I put an in-line LiPo switch between the battery and the SHIM. Double-clicking this restarts Raspberry Pi and also makes it easy to access the LiPo battery connection to recharge it between uses, as the LiPo SHIM doesn’t include charging circuitry. I taped the LiPo to the side of the case using duct tape, but if I did another version, I’d consider other ways of mounting it.
There we have it: my personal Raspberry Pi camera. Like many things I write about in this section, it’s not a final product, but one step in the evolution. If it proves useful, you’ll see some further iterations of it here.