RPi: Time-lapse Photos

The Raspberry Pi doc provides a recipe for the simplest possible time-lapse webcam: fire fswebcam once a minute from a cron job.

The crontab entry looks much like their example:

* * * * * /home/ed/bin/grabimg.sh 2>&1

I put all the camera details in the ~/.config/fswebcam.conf config file:

# Logitech C130 / C510 camera
device v4l2:/dev/video0
input 0
resolution 1280x720
set sharpness=128
jpeg 95
set "power line frequency"="60 hz"

That simplifies the ~/bin/grabimg.sh script:

DATE=$(date +"%Y-%m-%d_%H.%M.%S")
fswebcam -c /home/ed/.config/fswebcam.conf /mnt/samba/webcam/$DATE.jpg

The output directory lives on a Samba-shared USB stick jammed in the back of the Asus router, so I need not putz with a Samba server on the RPi.

Manually mounting the share, which for the moment is the /testfolder/webcam directory on the USB stick:

sudo mount -t cifs -o user=ed //gateway/testfolder/webcam /mnt/samba

I’m pretty sure automagically mounting the share will require the same workarounds as on my desktop box, but this fstab entry is a start:

#-- ASUS router Samba share
//gateway/testfolder/webcam	/mnt/samba	cifs	auto,uid=ed,credentials=/root/.gateway-id 0 0

That requires a corresponding credentials file with all the secret info:


This is mostly a test to see how long it takes before something on the RPi goes toes-up enough to require a manual reboot. Disabling the WiFi link’s power saving mode seems to keep the RPi on the air all the time, which is a start.