Internet Control of Raspberry Pi Camera

         - including Time-Lapse Photography

The following assumes that a website hosted by a nginx server has been set up as described in the associated page.  The owner of the website is referred to as <newuser>.  It requires the use of 'ssh' which is enabled on Raspbian by default.  Port-forwarding of ssh to the Raspberry Pi must be set up on the router to allow control via the internet.

The 'Raspberry Pi' camera must be installed and enabled.  (The following instructions do not  apply to USB cameras.)

Only members of the 'video' group are able to run the camera software.  Add <newuser> to the video group with 'usermod -a -G video <newuser>' . 

Test the setup locally via ssh by logging in as <newuser> and control the camera with something like '  raspistill -o /usr/share/nginx/www/camera.jpg ' .  This will write an image to a file named camera.jpg in the website root directory; this can be viewed with a browser locally or remotely.  (And it can be included in an html page of course)

The  raspistill or raspivid commands can now be issued using ssh from a remote location, and the camera.jpg image viewed on a remote browser.  Precede the command with nohup to start a sequence of repeated images without hang-up when the terminal/shell is closed.

For time-lapse photography we need a large amount of memory to store the .jpg images, and it is convenient to use a usb stick plugged into the Raspberry Pi.   Create a mount point for the stick by creating an empty directory, e.g. /media/usbstick.  Mount the drive with <newuser> as owner with 'sudo mount -o uid=<newuser> /dev/sda /media/usbstick.  Make an empty directory '/media/usbstick/camera'.

Now run raspistill with something like ' nohup raspistill -q 15 -o /media/usbstick/camera/image%04d.jpg -tl 10000 -t 7200000 '.  This will run for 2 hours and place 600 consecutive numbered images on the usb stick.

After completion, fetch the filled image folder from the Raspberry Pi  using FTP.   For compiling the time-lapse video, 'Time Lapse Assembler' (for Mac) works well.