Skip to content

Instantly share code, notes, and snippets.

@DuncanWilder
Last active August 29, 2015 14:21
Show Gist options
  • Save DuncanWilder/b39e36b42003ef8021b2 to your computer and use it in GitHub Desktop.
Save DuncanWilder/b39e36b42003ef8021b2 to your computer and use it in GitHub Desktop.
Raspberry Pi Timelapse camera script
#!/bin/bash
for number in 1 2
do
# Time of photo
DATE=$(date +"%Y-%m-%d %H:%M:%S")
# Name and location to photo
FILE="/home/pi/camera/$DATE.jpg"
# Set up some variables to change the exposure settings based on time
# Could this be linked to sunrise/sunet? Its quite a guesstimate..
# Depends on where the camera is pointing too..
EX="auto"
ISO="100"
HOUR=$(date +"%k")
if [ $HOUR -lt 6 ] || [ $HOUR -gt 19 ];
then
EX="night"
ISO="400"
fi
# Take the picture (shutter speed is needed to keep exposure constant)
raspistill -ss 1000 -ISO $ISO -ex $EX -t 1 -sh 50 -vf -hf -o $FILE
# Resize and compress to save space
convert $FILE -resize 2600 -quality 90 $FILE
sleep 10
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment