Time lapse photography
First of all you need to activate your camera if you haven't done so already. You can do that through:
Test your camera with
raspistill -vf -hf –o test.jpg
This command will take a picture with your camera and you can check the picture at your home directory through file manager. Once you know that your camera is working properly you should create a directory to store your pictures.
Now we need to create a very simple bash script for our pictures and we are going to name it capture.sh
sudo nano capture.sh
In the editor just type
raspistill -o /home/pi/timelapse/$DATE.jpg
This is going to allow us to save our pictures named with the time stamp in the timelapse folder. We will have to give permission to our capture.sh to be executed, we will do that with:
sudo chmod a+x /home/pi/capture.sh
For the next step we are going to use cron (a scheduling tool), to set the exact time when we want to take our pictures. Type:
We are not going to go into too much detail about cron, just change the last line to
*/5 * * * * sudo home/pi/timelapse/capture.sh
What this does is that it takes a picture every 5 minutes. To take a picture every 30 minutes change the value to 30 like this
*/30 * * * * sudo home/pi/timelapse/capture.sh
You can change the asterisks to your liking.
# * * * * * command to execute
# ┬ ┬ ┬ ┬ ┬
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ └───── day of week (0 - 6) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
# │ │ │ └────────── month (1 - 12)
# │ │ └─────────────── day of month (1 - 31)
# │ └──────────────────── hour (0 - 23)
# └───────────────────────── min (0 - 59)
Once you have all the pictures you need you should change the crontab to what it was otherwise your camera will keep on taking pictures forever (unless that's what you want).
All we have to do now is copy our pictures to a computer and use a video editing software to import the images and make the time lapse according to the software we are using.