I have the camera module for the raspberry pi. I need to know, how do I program the pi to take an image every 30 seconds and save the images to the inserted 64gb SD card.
One way is to create a bash script and cron job.
Create a bash script inside
/home/pi directory using your favourite text editor and name it
takephoto.sh for example.
#!/bin/bash DATE=$(date +"%Y-%m-%d_%H%M") raspistill -o /home/pi/stills/$DATE.jpg
Then when you saved it you need to set the execute flag on the file with the following command.
chmod +x takephoto.sh
Create a directory, like
/home/pi/stills, the same as in the bash script. Now from
/home/pi you can test the script by executing it using
You should have an image created inside the still folder with the timestamp.
Now you can setup a cron job to execute the script with the interval you require.
You could just use the raspistill's built in timelapse option:
raspistill -t 30000 -tl 2000 -o image%04d.jpg
That will take a picture every 2 seconds over a total period of 30 seconds with the files named image1.jpg, image0002.jpg...image0015.jpg. The %04d will be changed into a four-digit number with leading zeros added. I.e. %08d would give you an eight-digit number.