14 hours of Time-Lapse!! How to make Time Lapse video by Raspberry Pi & USB Webcam

Posted on Posted in elecProjects

Hello and welcome to Being Engineers.

We came up with a new project this week. Previously, we showed you how to stream live video captured from a webcam in a local network. A subscriber asked us to make a timelapse by Raspberry Pi and USB webcam. So this is the tutorial for it.

The process is very simple and straight forward. Before starting you have to know 2 things:

1. How to install OS in a Raspberry pi.

2.How to use your Laptop Screen a monitor for Raspberry pi.

In order to know how to do it, check our Instructable corner! http://www.instructables.com/member/Being%20Engineers/ 

We want to clarify that the process is not the only process to achieve this result. I am showing this to you because I found this most convenient to the user.

Step 1: Gather the Components

Gather the Components

In this project, you will need the following:

  • Raspberry Pi 3 Model B (Any version will work, but in PI 3 we have the provision for WiFi that can make this server wireless)
  • USB Webcam (I will use my old Logitech Webcam. Use a better camera for better results.)
  • 5V 2A Power Source ( I will use my Honor 13000mah Power Bank )
  • Lan Cable ( RJ – 45 Cable )
  • Minimum 8 GB Class 10 SD Card ( I will use Sandisk 32GB class 10 SD Card )
  • Pen Drive or External Hard Disk ( previously formatted )

If you haven’t installed the Raspbian OS on the SD card, then you will need a memory card reader and check out our tutorial on how to install the OS on Raspberry Pi.

Step 2: Set up Your Raspberry Pi

We assume you have the SD Card with the raspbian OS installed.

Then insert the SD Card in the Pi.

Connect the USB camera to any one of the four available USB port.

Connect the ethernet cable aka LAN cable to your Pi and connect the other end to your router.

Connect the Pen Drive.

Then Power Up the Raspberry Pi.

The next step is only for Raspberry Pi 3 users. Others. go to step 4.

Step 3: Connect your Pi to Internet through WiFi (only for Raspberry Pi 3 users)

Open the desktop of Raspbian and connect to WiFi by putting the correct password.

When the raspbian is connected to the network by WiFi, then shut down the system.

Now detach the LAN cable and restart. Then you must be connected to the Internet via WiFi only.

This will help to move your webcam and the pi anywhere without the RJ-45 cable.

[embedyt] http://www.youtube.com/watch?v=nbZOdffaI9U[/embedyt]

Step 4: Know your Raspberry Pi IP Address

Do the following steps to view Pi IP address.

  1. Open your browser on laptop or mobile. ( laptop or mobile has to be on the same network as the pi )
  2. Go to your Router settings by typing in the default IP address of your router. ( written somewhere on your router.)
  3. Find the list of connected devices.
  4. Find the corresponding IP address of the device named raspberry.

In our case, it is

Step 5: Connect to your Pi by SSH connection ( PUTTY )

Connect to your Pi by SSH connection ( PUTTY )

Open up Putty and type in the IP address of your Pi and connect.

‘pi’ & ‘raspberry’ is the default ‘login as’ and ‘password’ in Raspbian.

It is always a good practice to Update and Upgrades the system as soon as you log in.

To do it, type in the command ‘sudo apt-get update‘ and ‘sudo apt-get upgrade‘ one at a time.

Step 6: Install the Software and Do the Necessary Settings

Type in the command ‘sudo apt-get install motion ‘ to start the installation.

Now to make sure that the camera and the pen drive is correctly detected

Type in the command ‘lsusb‘ and enter. You should see the name of your camera. If it is NOT there, then there is some problem in your camera or the camera is not supported in ‘motion’.

Now type in the command ‘sudo cat /proc/mounts‘. At the end, you can see the name of your pen drive and the directory where the external storage is mounted. ( Follow the Screenshot ). Copy the path for later use.

After this, type in the command ‘ sudo nano /etc/motion/motion.conf ‘ and press enter.

Then you have to change some settings in the .conf file. It might be difficult sometimes to find the settings but use ‘ctrl + w‘ to find it. So follow the steps: (All the steps are not necessary just for time-lapse purpose, but of you do all these steps then you can also stream the video on the local network.

  1. Make sure ‘daemon’ is ON.
  2. Set ‘framerate‘ anywhere in between 1000 to 1500.
  3. Stream_quality‘ should be 100.
  4. Change ‘Stream_localhost‘ to OFF.
  5. Change ‘webcontrol_localhost‘ to OFF.
  6. Set ‘quality‘ to 100.
  7. Set ‘width‘ & ‘height‘ to 1280 & 720.
  8. Set ‘Snapshot_interval’ equals to 10. ( every 10 seconds 1 photo will be taken )
  9. Set ‘target_dir‘ as the path that you have copied earlier.
  10. Press ctrl + x to exit. Type y to save and enter to conform.

Again type in the command ‘sudo nano /etc/default/motion ‘ and press enter.

Set ‘ start_motion_daemon ‘ to yes. Save and exit.

Step 7: Start taking pictures

Start taking pictures

First of all, restart your motion software by this command – ‘sudo service motion restart’.

Again type in the command ‘sudo motion’ and press enter. Now your server is ready.

From now on in every 10 seconds, a photo will be taken and will be saved in the pen drive.

Whenever you think you can power the pi off and take out the pen drive.

Step 8: It’s DONE!!

When you have all the images then join the images to make a video and export that to your desired location. You can find much software to this simple task.

You can watch the timelapse that I created in the given video link on our channel ( 7:10 onwards )!

If you have enjoyed our project and video, then do SUBSCRIBE! It really helps us a lot.

Leave a Reply

Your email address will not be published. Required fields are marked *