How I time lapse with Raspberry Pi

I use Raspberry Pi Model A cause it uses less energy than other models.

This is is how i do it:
Download latest raspberry image from https://downloads.raspberrypi.org/raspbian_lite_latest

Do not unplug SD card! Pepare wifi interfaces profile and copy to boot partition.
This will allow to connect your pi via internal home network.

Plug screen and keyboard and boot the pi

Overwrite network settings:
sudo cp /boot/interfaces /etc/network/interfaces
Extend filesystem, enable ssh and enable camera:
sudo raspi-config
When it prompts for restart then cancel it and shut down system instead:
sudo poweroff
Now plug camera and wifi dongle and turn on pi

Use putty and log in into the pi with default username pi and password raspberry.

Now it is time to upgrade system:
sudo apt-get update -y & sudo apt-get upgrade -y
Test camera with
raspistill -o test.jpg
Use WinSCP or something like to download and view image

If the screen is upside down then use:
raspisstill –hf –vf -o test.jpg
Create camera.sh script that will automatically take picture and generate filename based on time:
nano ~/camera.sh
Paste this content:
#!/bin/bash
DATE=$(date +"%Y-%m-%d_%H%M")
raspistill -hf -vf -o /home/pi/timelapse/$DATE.jpg
For custom screen size use -w and -h switch:
raspistill -w 1280 -h 720 -hf -vf -o /home/pi/timelapse/$DATE.jpg
create directory where the images will go in:
mkdir -R ~/timelapse
Set the script executable:
chmod +x camera.sh
Configure scheduled task to run every minute:
sudo crontab -e
At the bottom of this file add:
* * * * * sh /home/pi/camera.sh 2>&1
Restart scheduled task service:
sudo /etc/init.d/cron restart

No comments: