Weatherizing a Raspberry Pi Camera with a Microscope slide

Sticking a Raspberry Pi camera exposed to the elements doesn’t do it any good over time, resulting in the hazy crazed lens problem.

Flare on the camera lens after a year in the open
Flare on the camera lens after a year in the open

The solution is to put some glass in front of the lens – and indeed this is exactly what this commercial outdoor spec little lipstick CCTV camera does

it's hard to see, but there is a round glass against an O ring in gront of the camera lens on this weatherpoof camera, which has spent several years outside and still works well
it’s hard to see, but there is a round glass against an O ring in gront of the camera lens on this weatherproof camera, which has spent several years outside and still works well

I discovered this when I took it apart to unscrew the lens a bit to make a close focus. And then cracked the glass refitting it as the lens stuck out too much. If you ever need a flat round piece of glass, search for watch crystal on ebay and they are to be had in lots of diameters. A watch crystal is apparently a term for the glass on a watch as well as the 32,768 Hz timing quartz crystal. A flat watch crystal repaired this camera.

The direct exposure of the camera lens to the elements is the biggest weakness of the now-defunct PICE weatherproof Pi case. But it is easily rectified now, using a piece of flat glass fitted with Sugru or Milliput putty. I used sugru and a cut down microscope slide, since I didn’t want to buy another watch crystal when microscope slides are optically flat and cheaper. It is a lot easier to cut glass under water, and you can remove the viciously sharp edges using a cheap diamond sharpening stone to smooth the cut edge and chamfer the corner.

Microscope slide fitted with Sugru to shed the water and seal the camera from the elements
Microscope slide fitted with Sugru to shed the water and seal the camera from the elements

I smoothed the Sugru using some plastic plumbing fitting, hence the embossed text that I didn’t spot. Hopefully this saves me from the crazed lens problem – this is a time-lapse camera to see how many weed seeds spring from my compost.

Raspberry Pi image of compost and control
Raspberry Pi image of compost and control

The Pi does time-lapse photography easy as falling off a log – basically in crontab

# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
30 13 * * * /home/pi/takestill.sh >> /home/pi/crontest.txt

and takestill.sh is

#!/bin/bash
/usr/bin/raspistill -o /home/pi/image-`date +%g%m%d-%H%M`.jpg

the aim of all that garbage after date is to make the filename carry the date, in a way that will rank properly in a file listing, like

image-150717-1330.jpg

For some reason this wouldn’t work calling /usr/bin/raspistill directly from cron

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *