Raspberry Pi Timelapse
This weekend, Byers Imports unveiled the new Jaguar F-Type Coupe and invited people to autocross for free. I set up a Raspberry Pi at the start line to record a picture every 10 seconds. It managed to capture every car that autocrossed and a pretty cool view of the moving clouds.
Connect the camera
The folks over at Raspberry Pi have created a nice tutorial of how to setup the camera and connect it to Pi.
Enable the camera
I will assume that you know how to start up a Raspberry Pi running Raspbian and connect a monitor and keyboard/mouse to it. If not, some quick google searches should help you get there.
Open a LXTerminal in Pi and open
Enable camera and hit
Enter, then go to
Finish and you will be asked to reboot.
raspistill command is used to take pictures along with various configuration flags.
This will place a
test.jpg file in your home folder. The ‘raspistill’ command takes about six seconds to take a picture.
I wrote a simple python script to take a picture every ten seconds.
The code is pretty well commented, but I will delve into the actual capture image part. I have included some flags with the
raspistill command, and they are described below.
|-o||output file name||/path/to/file.jpg|
|-awb||auto white balance||auto|
More detailed flag specifications are available here.
Automatic startup on boot
In order to make the Pi start taking pictures when it was powered on, I added a cron job to the crontab.
Navigate to the home directory in Pi using
cd. Then, use
crontab -e and add the following command to the crontab.
Make sure you shutdown.
This will ensure that your
timelapse.py script will start running every time you reboot the Pi.
Making the Video
mencoder package that converts all the pictures into a video.
Then, navigate to your directory that has all the pictures and execute the following commands
Now you can copy the
timelapse.avi file from the Pi using a FTP client or from the SD card itself. Enjoy your video!
BONUS! - Pi Remote Access
Instead of having to keep connecting the Pi to the monitor and keyboard and switching out the SD card every time I needed to copy files, I bought a USB wireless dongle and added it to a USB port on the Pi. The dongle is very easy to install and connect to WiFi using the Raspbian Desktop environment.
Once it was online, I found out the hostname for the Pi using this command:
This should give you an address that looks something like
Now, using a Mac/Linux terminal or Putty on Windows, you can create an ssh connection directly to the Pi.
If you set up a different username, you can replace ‘pi’ with that username. Now, you should be able to access your Pi remotely and copy files over using an FTP client like FileZilla or a bash command like