The Raspberry cam is smaller than the original webcam sensor I used. On the plus side, there is no need for a massive lense in front of it so it should integrate better with the housing.
One of the issues is that the camera is connected through a flat cable to the camera port of the pi. That cable is short and I haven't found any other provider for the pi zero (one end is narrower than for the normal-sized pi). So that means I'll need to house the pi zero and the camera in the housing instead of externalising everything and keeping only the sensor in the wearable part of the Logpi as in prototype #1.
(the camera port is on the right)
As I'll need to house more in the wearable port of the Logpi, I might as well try to include the battery so there is no cable sticking out. The battery is a bit big so I'll need a biggish box for it.
It took again a long time to find a suitable box. Eventually, I thought of a glasses box. One of the many that live in my drawers is nearly exactly the size of the battery,
I drilled a hole for the camera lens (7mm) which fits snuggly. No need for glue to keep it there. I had a few problems with the USB cable that connects the battery with the pi: the connectors were too long to fit well in the box so I had to cut out the base of the cables and remove the protecting plastic.
With everything in the box, it doesn't look to tight.
I'll hang it around my neck instead of using a safety pin (it's a bit heavy for that).
For the software, I simply wrote a script that takes a photo every 30 seconds and starts with the system. One thing that complicated things a little bit: the pi doesn't have a persistent clock so when it's running offline it will start without time. I had to add a persistent counter to add to the file names so that there is no clash after multiple restarts.
INTERVAL=30 # Time between captures, in seconds
WIDTH=3280 # Image width in pixels
HEIGHT=2464 # Image height in pixels
QUALITY=85 # JPEG image quality (0-100)
DEST=/home/cedric/webcam # Destination directory (MUST NOT CONTAIN NUMBERS)
PREFIX=img # Image prefix (MUST NOT CONTAIN NUMBERS)
mkdir -p $DEST # Create destination directory (if not present)
while : # Forever
# echo $OUTFILE
raspistill -n -w $WIDTH -h $HEIGHT -q $QUALITY -th none -t 250 -o $OUTFILE
COUNT=$(($COUNT + 1))
echo $COUNT > count.dat
A few test photos:
- Shutdown can damage the card. Ideally, it would be good to wire a switch.
- There is no way to know the battery is flat. Ideally, porting the activity light of the pi to the edge of the case would solve the problem.
- The battery is a bit large. Switching to a 3.7v drone one with power up would help reduce the size of the case needed. Lifetime of the battery could become an issue since I've only found 1000mA or less ones.
These might be solved in prototype #3.