Although the lens on the Raspberry Pi camera board is nominally fixed-focus, we’ve found that with a bit of hackery, you can gently unscrew it from its mount and change the focal depth. This isn’t what the package is designed to do, so if you do break yours doing this, it’s at your own risk and you won’t be able to send it back for a replacement. But if you’re careful, you’re unlikely to break anything, and you’ll get some really impressive results.
Here’s Gordon (who is too shy to speak on camera, so he’s doing the demo in stoic silence while Rob and I narrate) showing you how it works. Look out for the incredibly sharp image of the little balls of solder that fit between the processor and RAM chips.
The lens is attached to the rest of the unit by a screw thread, and glue is applied to the thread in the factory that makes the lens/sensor package to keep it in place. (We buy these as a sealed unit which we then mount on the camera board; they’re the same as the business end of camera unit you might find on a mobile phone camera.) The glue that is used is quite brittle, so you can break it out of place with care, and the lens unit will then move freely on the screw thread. We used pliers for the initial unscrewing, but we have heard from people in the community who have pressed down on the top of the lens unit with a soft pencil eraser, and twisted, which has applied enough gentle force to snap the dried glue.
When you’ve released the unit from the glue, just screw it out so that the lens is as far from the sensor as you can get it. You’ll notice that anything that isn’t very, very close to the lens will be blurry, but you’ll be able to get a very sharp picture of anything you hold it close to. And the resolution’s fantastic.