6101

A $400 GoPro has Time-Lapse… so does this $25 Raspberry Pi Zero! Tiny, lightweight, and incredibly versatile. Mount it anywhere—from rooftops to construction sites. Even risk it in harsh weather without worrying about an expensive camera. Capture days, weeks, or months of change—one frame at a time.

                      Time lapse timed photography on Raspberry Pi_Zero Ver-2   

Introduction: We previously developed a time-lapse photography system based on the MaixCam platform, which performed remarkably well in terms of functionality and features. However, one significant limitation remained—its inability to sustain prolonged operation on battery power.

To address this drawback, we present a modified version of the time-lapse camera built on the Raspberry Pi Zero 2 W platform. This version offers extended battery operation of up to 10–12 hours on a single 18650 Li-ion cell, making it highly suitable for real-world time-lapse applications. Mounted on an inexpensive yet sturdy selfie tripod, the setup is both practical and aesthetically pleasing. The total cost of the project is INR:2500.

For reference, the earlier MaixCam-based project can be accessed here: 

Advantage of Pi_Zero Timelapse over MaixCam Timelapse: The Sipeed MaixCam is undoubtedly a powerful platform. It features a 1 GHz RISC-V/ARM A53 processor, a secondary 700 MHz core, a 1 TOPS NPU for AI acceleration, 256 MB DDR3 RAM, a built-in TFT touchscreen, microphone input, SD card support, a 5 MP camera, and Wi-Fi connectivity. Priced at approximately INR 7314 [robu.in], it is well-suited for AI and vision-based applications.

In comparison, the Raspberry Pi Zero 2 W offers a 1 GHz quad-core processor, 512 MB RAM, built-in Wi-Fi, and the flexibility of a full Linux operating system—all at a significantly lower cost of around INR 1730. Adding a Raspberry Pi 5M Camera Module (approximately INR 340) completes the setup.

Both platforms are capable of performing the intended time-lapse photography task effectively using Python-based implementations. However, the Raspberry Pi Zero stands out in two key areas:

Cost Efficiency: Substantially lower overall system cost [INR:7314 Vs INR:2500 ]
Power Consumption: More suitable for extended battery-powered operation

The primary limitation of the Pi Zero setup is the absence of an integrated display, such as a TFT screen. This makes it slightly less convenient to verify camera alignment and framing during setup. Nevertheless, this drawback can be managed with careful positioning or temporary external display support during initialisation. In summary, while the MaixCam excels in performance and integrated features, the Raspberry Pi Zero offers a more economical and power-efficient alternative for long-duration time-lapse photography. This makes it particularly attractive for portable and battery-operated deployments.

BOM:
  1. Raspberry Pi_Zero 2W [01] - [ https://robu.in/product/raspberry-pi-zero-wireless-wh-pre-soldered-header/  ]
  2. 5M camera [01] - [ https://robu.in/product/raspberry-pi-camera-module/  ]
  3. Push-to-on push buttons [03], wires, jumper wires etc. [robu.in]
  4. I2C OLED [1.3” ~ 1.54”] [https://robu.in/product/1-3-inch-i2c-oled-display-module-4-pin-white/]
5.   Power supply [5V, 2Watt] - Any standard mini-USB phone power supply will be able to power the device.


Working principle & data input: Leveraging the capabilities of the Raspberry Pi Zero 2 W, a compact and efficient time-lapse photography system has been developed. In this setup, the user can configure three key parameters using external push buttons:

• Max Time (T): Total duration for which the time-lapse session will run
• Lapse Time (L): Interval between consecutive image captures
• Start Button :  Start / Pause / Shut down the device. 


These parameters can be adjusted prior to starting the session through dedicated buttons. If no changes are made, the system operates using predefined default values. Once configured, pressing the START button initiates the capture process. During operation, real-time status information is displayed on the connected OLED screen, including:

• Selected lapse time and total duration [the values rotate for selection]
• Remaining time [the values rotate for selection]
• Number of images captured
• A visual progress indicator for intuitive monitoring


Unlike the earlier touchscreen-based MaixCAM interface for the timelapse camera, this design uses a minimal, power-efficient display. As a result, all controls are implemented through hardware inputs. The information shown on the display is intended solely for user reference and is not embedded in the captured images.

At the end of the configured cycle duration, the system enters an internal processing mode, where all captured snapshots are converted into two video files—timelapse_timestamp.mp4 and timelapse_timestamp.avi—and saved in the /snapshot directory. 

Here the main python file [timelapse_camera_makevideo.py] begin executing a series of shell commands.

All these commands are put in a single file - makemovie_timestamp1.sh
Then make it executable by ‘chmod +x makemovie_timestamp1.sh’

Once processing is complete, the system automatically restarts the application with network connectivity enabled and displays the device’s IP address for remote access.

The generated video includes a timestamp overlay at the top-left corner of each frame. To retrieve the video, simply log in to the Pi Zero and download the files using:

$> scp bera@1.2.3.4:/home/bera/snapshot/timelapse_timestamp.* .
A sample output video can be viewed here: https://www.youtube.com/watch?v=BkssRTqg-uE01

Caution note: Since this is a long-duration application, it is strongly recommended to run the program directly on the Raspberry Pi rather than relying on SSH sessions. Running the script via SSH may lead to unintended termination if the connected host system enters sleep mode or loses network connectivity.

      For maximum reliability, the script should be configured to run automatically at boot using system services (e.g., systemd) or local startup scripts. This ensures uninterrupted operation, independent of network status or external devices.


Boot start: For reliable operation, configure the script to run automatically at startup using a system service (systemd). This ensures the program starts on boot and continues running independently of network connectivity.   $> sudo systemctl enable timelapse.service

Alternatively, a simpler method is to place the script inside the .profile file in the home directory and configure the Raspberry Pi Zero 2 W for CLI auto-login. In this case, the Python program will execute automatically each time the system boots.

It is important to note that Wi-Fi is not required for camera operation. It is used only for tasks such as file transfer or remote access. Images can also be stored directly on a USB flash drive; in such cases, the drive can be removed and used separately for processing the captured .jpg files into a time-lapse video. 

Log in to home: Also to ensure that every time the Pi_zero boots, it must log into the user home.

sudo raspi-config
Go to ‘System Options’ 
Select ‘Boot / Auto Login’
Choose ‘Console Auto login’


Main Content of .profile file: The .profile file may contain several configuration entries; however, the key section responsible for automatically starting the time-lapse program is shown below:



# Auto start timelapse
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
    echo "SSH session detected - skipping autostart"
else
    sleep 2
    python3 /home/bera/timelapse_camera_makevideo.py
    fi


This logic ensures that the script runs automatically during local boot, while preventing execution when the system is accessed via SSH. The short delay allows the system to stabilize before the program starts.

Operating System: The Raspberry Pi Zero 2 W runs a full Linux-based operating system (Raspberry Pi OS), providing a flexible and stable environment for long-duration applications. Key features include:

• Native support for Python scripting and automation
• Built-in Wi-Fi and SSH for remote access
• Compatibility with standard Linux tools and libraries
• Reliable handling of long-running processes

This makes it well-suited for time-lapse photography as well as other embedded and automation projects. SDCard of 32GB to 64GB is recommended for this project.  


Software to be installed: These are all open source softwares therefore, no string attached. Here’s the list of free softwares you need to install.

1.Python packages: 
pip3 install numpy opencv-python-headless luma.oled

2. GPIO Library for hardware interface:
    sudo apt update
    sudo apt install python3-rpi.gpio

3. Enable I2C interface:
     sudo raspi-config 
     Navigate to “Interface Optons” -> I2C -> Enable
     You may need to restart Pi_zero board.

4. Install supporting packages:
     sudo apt install i2c-tools python3-smbus
     i2c-tools is used for scanning & debugging I2C devices
     python3-smbus  is used for Python-based I2C communications

5. Install OpenCV dependencies
    sudo apt install libatlas-base-dev libjpeg-dev libtiff5 libopenjp2-7


For Uploading of code: 
Once the Pi is connected to the network, files can be transferred via SSH using scp:
$> scp timelapse_camera_makevideo.py bera@<IP_ADDRESS>:/home/pi/ 
$> scp makemovie_timestamp.sh bera@<IP_ADDRESS>:/home/pi/ 

Or you can do an ssh
$> ssh bera@<IP_ADDRESS>    #when asks for password give it. Then in the right directory
$> nano timelapse_camera_makevideo.py
and paste the code. Save it by ctrl+o and the exit by ctrl+x
$> nano makemovie_timestamp.sh
and paste the code. Save it by ctrl+o and the exit by ctrl+x
$> chmod +x makemovie_timestamp.sh #this makes the file executable
You are now ready for the camera for action.

Converting to Video file: The video files [timelapse_timestamp.avi and timelapse_timestamp.mp4] is done automatically by the code. Both these video files and all the jpg files will be kept at /snapshot directory. You have to download them using ssh.  The picture resolution possible maximum - 1024x768 once in 30 seconds tested successfully on Pi_zero board for as long as 4 hours.
• Ensure sufficient storage space before processing large image sets

Typical use of this project but not the least: 

1. Plant growth & monitoring: Shrinking time duration between events like plant growth & blooming for botanist to understand plant life cycle. 

2. Construction site monitoring: Documenting progress of building projects over days, weeks & months which results in a compressed visual summary for stakeholders & project review.

3. Landscape & weather changes: Record shifting of skies, sunrises, sunsets, cloud formations or storms thus producing stunning visuals & helping meteorologists to analyse patterns.

4. Traffic & Crowd flow analysis: Track vehicles or pedestrian movements in urban setting or during festive or special events to assist in urban planning, traffic control and event management.

5. Industrial process documentation: Monitor automated machinery, production lines or testing processes for trouble shooting, Quality audits and training materials.

6. Wildlife census / observations: Record animal behaviours in natural habitat without human presence thus helping biologists to study overtime or count the census.

7. Environmental and climate studies: Track glacier retreat, deforestation, river flow or pollution spread providing a visual proof for research, education and advocacy.


Attachment: timelapse_camera.py, makevideo.sh, .myprofile  & pictures are attached.

Aftermath: Time-lapse photography has traditionally been considered a domain of advanced photography. However, with the availability of affordable and capable platforms like the Raspberry Pi Zero 2 W, along with open-source tools and simple programming, it is now well within reach of hobbyists and enthusiasts.

                            This project demonstrates how a low-cost, power-efficient system can be used to create compelling visual stories over extended durations. Whether it is capturing the growth of plants, construction progress, or subtle changes in everyday surroundings, the possibilities are vast.

Beyond its visual appeal, the project serves as a practical introduction to embedded systems, automation, and image processing. It encourages experimentation and innovation, enabling users to blend creativity with technology while gaining valuable hands-on experience.

Prototype:   
  
bera@raspberrypi:~ $ cd snapshot/
bera@raspberrypi:~/snapshot $ ls
makemovie.sh   makemovie_timestamp1.sh  makemovie_timestamp.sh  

-rw-r--r-- 1 bera bera   210182 Apr 24 13:39 snap_1777018186.jpg
-rw-r--r-- 1 bera bera   210523 Apr 24 13:40 snap_1777018216.jpg
-rw-r--r-- 1 bera bera   210441 Apr 24 13:40 snap_1777018246.jpg
-rw-r--r-- 1 bera bera   210592 Apr 24 13:41 snap_1777018276.jpg
-rw-r--r-- 1 bera bera   211032 Apr 24 13:41 snap_1777018306.jpg
-rw-r--r-- 1 bera bera   211171 Apr 24 13:42 snap_1777018336.jpg
-rw-r--r-- 1 bera bera   211235 Apr 24 13:42 snap_1777018366.jpg
-rw-r--r-- 1 bera bera   211077 Apr 24 13:43 snap_1777018396.jpg


Bye bye
S Bera