Focus the Pi High Quality Camera Remotely!

Ever since I started messing about with the Raspberry Pi High Quality Camera I’ve been trying to think of a way to focus it remotely, so that I could just pop it down in the garden and worry about focusing it later – and this weekend I cracked it!

I was sure if I found the right Lego Technic piece I’d be able to drill a hole in it and fix it to the camera lens, and a test part arrived from eBay late last week, a 60 tooth gear. Cutting a lens-sized hole in it was surprisingly easy, and it was an absolutely perfect push-fit.

The Lego compatible continuous servo works perfectly

I ordered a Lego-compatible servo from Pimoroni straightaway, and once it had arrived I spent a pleasant couple of hours rummaging for Lego pieces to make it all fit together. I was really lucky that the little servo cog and the lens cog fitted together so nicely, that could easily have been very tricky.

Testing the remote focus via Real VNC, controls on the right.

Next I made a long, thin focus button menu in GUIzero, so that it’d be visible to the side of the camera preview window, when viewed via RealVNC. This works really well, you can click the focus buttons on the side and see the effect immediately on the previewed image. The beauty of RealVNC is that it works equally well on a phone or tablet, which is extremely handy when keeping an eye on a wildlife trap in the garden.

As a proof of concept it’s a lot of fun, I can imagine adding this functionality to an existing pan/tilt camera bracket, or to a robot that needs to constantly re-focus as it moves around. Of course the best part of all was combining Lego with Raspberry Pi, two of my favourite things!

More details are on Instructables and Hackster, and the code I used for the focus and capture menus is all on GitHub.

New Project! The 1979 Merlin Pi Camera

This broken old Merlin handheld game is now a tactile, practical case for a Raspberry Pi High Quality camera.

The interchangeable camera lens peeps out from what was the battery cover on the rear, and on the front, the matrix of buttons has been replaced by a HyperPixel four inch capacitive touchscreen.

Still, video, timelapse and slow motion modes are all available on the colourful touch menu, as well as the option to bulk-upload the captured photo and video files to Dropbox.

Additional touches include a handy tripod mount in Merlin’s base, and hardware buttons to manually capture images and video.

This build was a lot of fun, the case specifically was lovely to work with, and had plenty of space for components, for once. I did destroy the battery cover and had to make a new camera mount from perspex, but otherwise things went pretty smoothly!

Full details of the project are on Instructables and Hackster, and the code for the touchscreen menu is on GitHub.