Want to take photo of your room with Raspberry Pi if you are not at home ? It is possible with just few lines of code. This is my way to do it. I am using WDCloud to store images on my Windows drive available from anywhere. It is thanks to WD Cloud connected to my network. But you can store images on your local Raspberry Pi Sd Card and see them later. It is up to you. Jump in to my short article of how to take photo with raspberry pi at given time . For example every 5 minutes or so.
Take Photo with Raspberry Pi at Given Time
First of all , create directory to store your images with simple terminal command like
This is directory where you will store all your photos. That’s simple right ?
Another thing is to create sh file that contain terminal command to take photo
you can give it executable permission like that
chmod +x /home/pi/script.sh
now we can edit it like that
In you .sh file add this line
sudo raspistill -o /home/pi/mycctv/$(date +'%m%d%y%k%M%S''.jpg') -t 200
That command above will take the photo . You can test it in your termial. Image will be saved in /home/pi/mycctv as we mentioned in our command. Funny % and letters will give name to the file according to current date time including sceonds and extension will be .jpg . Simple right ?
Save the file (Ctrl+O , Ctrl +X)
Now it is time to exit cron file to run above command automatically .
sudo crontab -e
Add this line at the bottom of the file and save it (Ctrl+O, Ctrl+X)
*/5 * * * * /home/pi/script.sh
What is does mean ? It as cron to run file script.sh every 5 minutes