Maker.io main logo

Build a Raspberry Pi Time-Lapse Camera

2023-08-01 | By Don Wilcher

License: See Original Project

Capturing an image series or sequence at set time intervals to create a video can be an ‎incredibly fascinating and fun photography approach. You can easily take part in time-lapse ‎photography with only a Raspberry Pi and a web camera (webcam) or Pi camera module. By ‎building a Raspberry Pi time-lapse camera, you can capture wonderful videos of slow processes ‎such as blooming flowers and moving clouds, or even maker projects like an Arduino-Solid State ‎Relay DC motor controller. In this maker project, you’ll explore how to set up and use a ‎Raspberry Pi, a webcam, and time-lapse software to create a time-lapse camera. ‎

Pioneers of Time-Lapse Photography

English photographer Eadweard Muybridge pioneered the first approach to time-lapse ‎photography from 1870 to 1872. Muybridge created a sequence of photographs capturing the ‎slow construction process of the San Francisco Mint. Using photograph sequences, he also ‎captured the movement of the galloping horse, answering the question of how many horse legs ‎contact the ground while trotting and galloping — the sequence showed that a horse is indeed ‎airborne while in motion.‎

horseinmotion_1

Eadweard Muybridge’s sequence of photographs studying horse movement. Image courtesy of ‎Wikipedia Commons

The term ‘sequence of photography’ was eventually translated to time-lapse photography in ‎‎1897 by Georges Melies, a French filmmaker and cinematographer. Melies used time-lapse ‎photography to create his Carrefour De L’Opera. Within Melies’ motion picture productions, ‎time-lapse photography provided a way to distort and manipulate time to accelerate the ‎natural progression of musical performances.‎

tropvieux_4     tropvieux_3

Georges Melies and a scene from his 1908 film “The Old Footlight Favorite.” Image courtesy of ‎Wikipedia Commons

Raspberry Pi Time Lapse Camera Materials

Like Muybridge and Melies, you too can build a time-lapse camera to explore nature and the ‎construction of your projects. The Raspberry Pi time-lapse concept consists of using a few off-‎the-shelf components:‎

  • A Raspberry Pi 3 or 4B single-board computer (SBC)
  • A USB webcam
  • Time-lapse software

‎Connected, these off-the-shelf components will allow an experimental lab or workshop bench ‎time-lapse camera to create fun and entertaining videos. The time-lapse camera software ‎‎(Streamer) permits the frames-per-second (fps) or the total image numbers and the interval to ‎be established for the photography setup.‎

Raspberry_Pi_Time_Lapse_Camera_Use_Case_Model

A Use Case Model of the Raspberry Pi as Time Lapse Camera

You can adjust the image resolution using the streamer software, which includes a filename for ‎each jpeg taken. The system’s setup is quite easy due to the low part count. Therefore, ‎hardware troubleshooting for the Raspberry Pi Time Lapse camera is minimal.‎‎

Raspberry_Pi_Time_Lapse_Camera_System_Block

The Raspberry Pi Time-Lapse camera system.‎

You’ll insert the webcam’s USB cable into the Raspberry Pi 3 or 4B SBC USB port, and that’s all ‎there is to making the complete Raspberry Pi time-lapse camera! You can use an ordinary ‎webcam in this project and may find the components setup diagram:‎

 

Raspberry_Pi_Time_Lapse_Camera

A typical assembled Raspberry Pi Time-Lapse Camera

Installing the Streamer Software

Two common software packages allow the Raspberry Pi to take still or time-lapse images: ‎Raspistill and Streamer. The Raspistill and Streamer are installed on the Raspberry Pi using the ‎Linux terminal. This project focuses on installing the Streamer software onto the Raspberry Pi ‎and assumes you already have an operating system installed and running on your Pi. You can ‎find a guide here if you need information on how to do this. ‎

The first step in creating a Raspberry Pi time-lapse camera is obtaining the Streamer software ‎using the Linux terminal and the command.‎

Copy Code
sudo apt-get install streamer

Type the command into the Linux terminal and press the enter key.‎

Installing_streamer_software

Installing the Streamer software onto the Raspberry Pi

Streamer_software_packages_installed

Streamer software installed on the Raspberry Pi

You can now install the various video decoder and encoder utility packages supporting the ‎Streamer software. Type or copy each command followed by the enter key into the Linux ‎terminal using the following instructions.‎

Copy Code
sudo sh -c 'echo deb http://vontaene.de/raspbian-updates/ . main>> /etc/apt/sources.list'

Raspbian_updates 

Obtaining Raspbian Updates

Copy Code
sudo apt-get update

Get_all_updates

Getting all updates

Copy Code
sudo apt-get install libgstreamer1.0-0 liborc-0.4-0 gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gstreamer1.0-alsa gstreamer1.0-omx gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-base-apps gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-pulseaudio gstreamer1.0-tools gstreamer1.0-x libgstreamer-plugins-bad1.0-0 libgstreamer-plugins-base1.0-0

Streamer_plugins

Obtaining Streamer plugins

Next, you’ll type or copy this command instruction to verify the streamer’s plugin installations ‎were correct.‎

Copy Code
gst-inspect-1.0 I grep omx

Inspect_streamer_plugins

Final Inspection of Streamer plugin tools

The final streamer plugin inspection will display on your Linux terminal screen. ‎

installed_streamer_plugins 

Successfully installed streamer plugins

Note: Once The installation is complete, you will see the following information displayed in ‎your Linux terminal. ‎

Get_inpsection_streamer_plugins_previously_installed 

gst-inspection of streamer plugins installed successfully

Testing the Raspberry Pi Time Lapse Camera

After you have successfully installed the streamer software and plugins, the final step is testing. ‎Find an interesting object that is in motion to test the sequencing feature of the Raspberry Pi ‎time-lapse camera. An Arduino SSR DC motor controller with a flashing LED was used here as ‎the testing device. The DC motor’s rotating fan and flashing LED provided an opportunity to test ‎the Streamer software’s ability to sequence the movement of each operational component in ‎motion.‎

Arduino_SSR_DC_Motor

The Arduino SSR DC motor controller and Blinking LED test device

You’ll use the following command instruction to start capturing the image frames of your ‎moving test object.‎

Copy Code
streamer -t 14 -r 0.4 -s 1280x720 -o timelapse0000.jpeg

The command instruction setup parameters consist of the following: t is the number of frames, ‎r is the frame rate in frames-per-second, s is the resolution, and the filename is the initial ‎timelapse.jpeg photo beginning at 0000. In this setup, Streamer will take 14 images at a frame ‎rate of 0.4 frames-per-second — with a value of 0.4, a picture will be snapped every 2.5 ‎seconds. The pixel count of 1280x720 is the image resolution, and the higher the pixel count or ‎resolution, the better the picture image quality. Upon successful execution of the command ‎instructions, 14 images will be stored in the home/pi directory. You can then move these files ‎to a Windows directory using a file-sharing software package like WinSCP. Each image will be ‎sequenced in order during the device movement pattern.‎‎ ‎ ‎

Arduino_SSR_DC_Motor_Controller_timelapse

The Arduino SSR DC Motor Controller with Flashing LED images sequenced

To see the time-lapse video of your sequenced images, you may use Time Lapse Creator ‎software and can download the software here. Upload the complete sequenced image folder to ‎the Time Lapse Creator software, and once complete, click the play button to view the time-‎lapse video. You can keep final video copies by clicking the SAVE button on the control panel. ‎View the time-lapse Arduino SSR Motor Controller with Flashing LED here.‎

Congratulations on building your Raspberry Pi Time Lapse camera! Have a fun and entertaining ‎time with your maker tool, using it to explore nature or animated projects in your lab or ‎workshop bench. You, too, can become a time-lapse pioneer at school or in the local ‎makerspace using your Raspberry Pi time-lapse camera.‎

制造商零件编号 SC0130(J)
SBC 1.4GHZ 4 CORE 512MB RAM
Raspberry Pi
¥203.50
Details
制造商零件编号 SC0022
SBC 1.2GHZ 4 CORE 1GB RAM
Raspberry Pi
¥284.90
Details
制造商零件编号 SC0073
SBC 1.4GHZ 4 CORE 1GB RAM
Raspberry Pi
¥284.90
Details
制造商零件编号 SC0193(9)
RASPBERRY PI 4 B 2GB
Raspberry Pi
¥366.30
Details
制造商零件编号 SC0194(9)
RASPBERRY PI 4 B 4GB
Raspberry Pi
¥447.70
Details
制造商零件编号 SC0195(9)
RASPBERRY PI 4 B 8GB
Raspberry Pi
¥610.51
Details
Add all DigiKey Parts to Cart
TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum