My original plan for its reuse was as a DAC; the Pi's lackluster native sound handling being bolstered by adding a HiFiBerry DAC. There's a DAC+ for the Model A+ and B+ and a DAC that works with Model As and Bs with a P5 connector, '...that old Revision 1 versions don't have'. What luck, I have an early Revision 1 Model B. On to Plan B, then.
Second Stage Lensman
For some time I've owned a Raspberry Pi camera which recently has been stored in its box on the same shelf as the Pi. Many and great are the applications for which people have used this device; my requirements, to use it as a webcam, were somewhat humbler. It's trivial to do this - typing:
raspistill -w 800 -h 600 -o /home/pi/webcam/picture.jpg
into the terminal causes a jpeg image called picture.jpg 800 by 600 pixels to be output to the folder /home/pi/webcam. And if the following line is added to crontab:
*/10 * * * * raspistill -w 800 -h 600 -o /home/pi/webcam/picture.jpg
the image is output every 10 minutes.
By increasing the rate the picture is taken and then streaming the image you can use it as a simple security camera.
There were two reasons I hadn't continued to use the camera; firstly, I had issues with it running with Weewx, possibly because I have an early version of the Pi, with only 256Mb of memory (in fairness I had similar problems with a Logitech C270 webcam). Secondly, as you can see from the picture below, the design of the camera is pretty basic; in essence it's just a lens and sensor on a small PCB attached to a short ribbon cable. This makes it awkward to use as it stands: its surface mounted components are unprotected and the ribbon cable is too short. Again, to be fair, the camera is meant to be used in projects, rather than be a finished consumer item.
A Raspberry Pi and its Camera |
I realised that to use the camera for any length of time without damage it would be sensible to find a way of mounting it; the blob of Blu-tack I had been using just wasn't up to the job. A search for 'Raspberry Pi camera mount' didn't bring up a huge number of novel and innovative products, surprisingly. The cheapest, simplest and arguably the best is the Pimoroni mount (£3, plus £3 postage - what!), which is essentially two bits of plastic and four plastic screws. At the other end of the scale is the all-in-one Pi and camera enclosure from Nwazet - a snip at £25.
The Nwazet gave me the idea that I could adapt the case I already had. This is a cheap, clear plastic object - unpretentious, but has fulfilled its purpose perfectly. And indeed I wasn't the first to have this idea with the very same type of case. Instead of double-sided tape (good grade!) I decided to use screws to fix the camera to the lid. Using the camera as a template I marked the position for four holes, then drilled them. Here's the first two:
First two of four holes drilled in case, top left. |
Square holes are more trouble than they're worth |
They were a tight fit, but fit they did and I tightened them carefully so I didn't crack the case. The finished result isn't too shabby: the camera is protected and is now a single unit with the Pi itself, making it look not unlike a digital camera.
The Golden Age of British engineering is still with us. |
No comments:
Post a Comment