Learn how to build a Raspberry Pi time-lapse camera for at home or a compact rig for travelling. Timelapse photography is a fantastic way to capture the passage of time. It adds the dimension of time to videos that we do not see with our naked eyes and therefore these are immediately captivating.
The problem with time-lapse photography is that it requires leaving a camera in one place for a long period of time. You then need to monitor it in order to ensure that it doesn’t run out of battery or get stolen!
What if I told you that for around $50 you could construct a fully remote time-lapse rig using a raspberry pi, a camera module and (optionally) a battery pack. Hopefully, that last addition will get your mind excited!
Raspberry Pi Time-lapse Video
Things to buy:
- RASPBERRY PI 3 MODEL B+: Mini Computer with 1.4GHz Quad Core ARM Cortex-A53, 1GB LPDDR2 RAM, Broadcom VideoCore IV GPU, 4 Full Size USB Ports (Shared Bandwidth), USB 2.0 Gigabit Ethernet Port, HDMI 1.3 Port, 3.5mm AV Port (Composite Video Out + Stereo Out), MicroSDHC Slot, MIPI CSI Connector for Cameras, MIPI DSI Connector for Displays, 40 Pin GPIO Header, MicroUSB Power Connector
- AMAZING PERFORMANCE: Blazing Fast Quad-Core 64-bit CPU and Faster GPU opens a new realm of possibilities and applications limited only by your creativity
- REQUIRED ADDITIONAL COMPONENTS NOT INCLUDED: Certified 2.5A Power Supply and Properly Flashed MicroSD Card required for operation!
- PROPER POWER AND SOFTWARE: If the red LED on the board blinks or turns off at any time, your power supply is not providing adequate voltage. Without properly flashed MicroSD card, the board will not display anything on HDMI. The processor is 64-bit and can run Raspbian which is a 32-bit operating system.
- Ideal for recording 4K UHD video: Samsung MicroSD Evo is perfect for high res photos, gaming, music, tablets, laptops, action cameras, dslr’s, drones, smartphones (Galaxy S10, S10+, S10e, S9, S9+, Note9, S8, S8+, Note8, S7, S7 Edge, etc.), Android Devices and more
- Ultra-fast read write speeds: Up to 95MB/S Read and 20MB/S Write Speeds; Uhs Speed Class U1 and Speed Class 10 (Performance may vary based on host device, interface, usage conditions, and other factors). Operating Voltage: 2.7-3.6V
- Built to last reliability: Shock proof memory card is also water proof, temperature proof, x ray proof and magnetic proof
- Extended compatibility: Includes full-size adapter for use in Cameras, Laptops and Desktop Computers
- Tested with all versions of the Raspberry Pi including the Pi 2, Pi 3 and Pi 3 B+
- UL Listed
- 5-feet cable with integrated noise filter
- Micro USB plug
- Output: 5V DC / 2.5A Regulated Input: 100 - 240VAC
As an option, you can also pick up a Pi Zero for a more compact build. They are powerful enough.
Note: As an Amazon Associate this site earns a small commission from qualifying purchases.
Other things you’ll need (Headless Install):
- Network Cable
For the first (headless) set up I will just use a Mac connected to my home network. I didn’t have an additional keyboard or a mouse.
The only problems that arose for me were when I didn’t input the code exactly correctly. So make sure to double check everything. The total time for this build was around 3 hours but you can hopefully do it much faster by reading through this quick tutorial.
Remember this is just a guide to get you going. At the end, you will have a working time-lapse rig that you can install wherever you like. You will need to arrange some sort of case and get the location, permissions etc.
Note: copy the code below inside but not including the “quotes”. Or your code won’t work 🙂.
Method One: Headless Set-Up Guide
Use this method if you like coding, or you have no additional screen, mouse or keyboard.
1. Install raspbian on your micro sd card using your computer.
Unzip the package by double-clicking on it in your Downloads folder.
Double-click the file to unzip it and insert the micro SD card into the mac using a dongle or adapter. Format the SD as a FAT32 drive. On a mac, this is denoted as MS-DOS (FAT) disk within the disk utility app.
Launch Terminal on your mac and type “cd Downloads” this will navigate to your Downloads directory. You can type “pwd” to confirm this. See below for a list of handy terminal commands if you are not familiar with basic bash commands.
Now type “df -h“
Identify which of the disks is the one that is your SD card. It will be “dev/disk1s1” or “dev/disk2s1”
Now you want to unpack the distro.img onto the SD card. This will take some time and you will have no feedback until the process is done. You must wait for the cursor prompt to return (i.e. no progress bar).
Run the following commands making sure to substitute the question marks with the number of your drive. Note: Be bloody careful as a little mistake here will cause your mac to become useless!
“sudo diskutil unmount /dev/disk?s1“
“sudo dd bs=1m if=./2016-05-10-raspbian-jessie.img of=/dev/disk?s1“
“sudo diskutil eject /dev/rdisk?s1“
In this instance, the disk is named disk2s2. Remember that this process will take a long time. You’ll need to wait 15-30 min …. or more. You could learn how to make your own Instagram filters in Lightroom to pass the time.
2. SSH into your Pi to complete the set up
Put the SD card into the Pi connect it to the router with the ethernet cable and finally plug in the power. Give it a minute to power up.
Open another terminal box and type in “arp -a”. This will list off all of the devices connected to your router. You should be able to pick out the IP address of the Pi by looking at the various hostnames. It will be something like “192.168.1.??”. Replace the question marks with the last two digits of your IP address.
Type in “ssh firstname.lastname@example.org.??” remembering to replace the question marks with the number you see above. If you have the wrong IP address it will not proceed. Try again with another IP until you see it asking for a password. Here you will enter “raspberry” as the default password.
Once you see that you’re connected to the Pi type in “sudo raspi-config”. Navigate to expand the file system, hit enter. Navigate to finish, hit enter. Select yes, hit enter. You will then be kicked out of your SSH session as the Pi is rebooting. Wait a couple of minutes to proceed.
SSH back into the Pi. Hint: you can do this pretty fast by pushing the up arrow in the terminal to show the last commands. When you see the SSH command just hit enter and it will re-run it. Run the following commands to ensure that your Pi is up to date:
“sudo apt-get update“
“sudo apt-get upgrade“
Note: This may take some time to complete the update so again just check out my youtube channel to pass the time 🙂
Once complete type “sudo shutdown -h now” and wait for the green light to stop flashing. This will end your ssh session.
3. Set up the camera and make a little script
Unplug everything. Install the camera module into the raspberry pi. I am using the noIR version. Lift up the tabs, slide in the ribbon cable in with the metal parts facing away from the usb ports. Press the plastic tabs down to lock it in place. Plug in all the pi cables again.
SSH back into your Pi using the steps above. Enter the password “raspberry”.
Enter the “sudo raspi-config” command again. Navigate to the camera, hit enter. Enable the camera then navigate to finish to reboot the Pi. This will end your SSH session.
SSH back into the Pi. Take a second to familiarise yourself with the directories. This will help you navigate around. The following commands are essential to the bash command prompt. These will help you navigate through the file structures:
Type “pwd” to understand which directory you are in. Type “ls” to list all of the files and folders in the current directory. Now to check the camera type “raspistill -o photo.jpg“. To confirm that it worked, type “ls” again and review to see if there has been a file generated named photo.jpg.
Viewing this file inside an SSH session is kind of tricky but here is how to copy them to your local computer to view. The best is to copy the picture to your mac to view it.
Open up a new terminal on your mac. Do not SSH into the Pi. If you are currently connected via SSH type “Exit” to end the session. Type in “scp email@example.com.??:/home/pi/photo.jpg /????/????/??????“. Replace the question marks with the folder path to a location on your mac. e.g. desktop is /Users/MyName/Desktop. MyName is whatever your computer name is. You will then be promped for the password and then the download will begin.
Hint: You can copy the path of any folder on a mac by holding down the option key, two finger clicking the file then selecting copy file path. Open the file to view your first Pi shot!
The next step is to make a small script that will take a picture with a time stamp and put it into a separate folder. Make sure you are back in the Terminal that is SSHed into the pi. Start my making another folder to store the photos. Type “mkdir photos”. To confirm type “ls” to see what comes up. Now navigate to that directory using the command “cd photos”.
Now we need to make a small script that when we run it it will take a photo each time it is run. The terminal has an inbuilt text editor that we can use to make this script. It is called nano. Create the script and open nano in one command with “sudo nano photo.sh”. Take the code below (without “quotes”) and paste it into the text editor window.
“raspistill -o /home/pi/photos/$DATE.jpg”
When finished push “control+x” on the keyboard and hit “y” and return to save.
To make sure that it works you’ll need to run the script. Type “sh photo.sh”. To check that it worked you can hit “ls” and see if there is a photo with the current date in the folder. If so pat yourself on the back. You have almost finished this!
4. Set up the automation to make the time lapses happen
We want to make it capture pictures every X seconds or X minutes or whatever you want. So let’s make that happen. Linux (raspberry pi) has something built in called the cron tables that manage repeating tasks. It sounds difficult but it really isn’t.
Type in “sudo crontab -e” this will open up the cron tables. From here select “nano” the text editor that we used before. Once open use the arrow keys to scroll right to the very bottom.
Paste in the following piece of code:
*/5 * * * * sh /home/pi/photos/photos.sh
This will take a photo every 5 minutes. If you would like it to run every minute then just change the 5 to a 1. Likewise 10 minutes or 30 min etc. The positioning of spaces and the number of stars is vitally important here.
When finished push “control+x” on the keyboard and hit “y” and return to save.
To check that it is working we can use the “watch” command to monitor the folder and list any changes. Type “watch ls” to list all of the changes to the folder. Let it sit for however many minutes you typed in (my case is 5 min) and if another photo with a different timestamp pops up then viola you have done it! You can press “option c” to stop the watch command.
If you want to stop taking the photos just remember you can remove the line from the crontab by following the steps above and just deleting the line of code.
Download the photos onto your computer by using the tutorial above but replace it with the following commands “scp -rp firstname.lastname@example.org.??:/home/pi/photos /????/????/??????”. Remembering to replace the question marks with the destination path.
Congratulations!! You’ve done it.
The new time lapse is running now I am doing a 2 month time lapse of Autumn beginning. As soon as it’s finished I will post it here. Stay tuned.
Follow the tutorial above and make yourself a time-lapse video. It is possible to compile the photos on the raspberry pi but it does take a loooong time. Look at different software options. I use “time lapse assembler” on the mac. But it is also possible using photoshop or a video editor such as Final Cut Pro X.
Get inventive with your timelapse and post it up on youtube. Add a link to the comments below for the world to see.
As always if you are having any troubles getting this setup, I am here to help. You can drop me a comment in the box below, or message me on any of the social channels. I am always happy to help!
We have a lot of articles from the best film cameras to developing film at home.