Projects / Time-lapse camera

Time-lapse camera

Beginner1.5 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. Pi ZeroRASPBERRRASPBERR

    Flash Raspberry Pi OS Lite

    Enable SSH and Wi-Fi in the imager.

  2. Pi ZeroRASPBERR

    Connect the camera

    With the Pi off.

  3. Pi Zero

    Test one photo

    Run the script by hand.

  4. Pi Zero

    Add the cron line

    Every five minutes.

  5. Pi ZeroRASPBERR

    Fix the camera in place

    Steady and level.

  6. Pi Zero

    Let it run a day

    Check the photos and the free space.

  7. Pi Zero

    Make the video

    With ffmpeg.

In short

How do you build a time-lapse camera?

A Pi takes a photo every few minutes for weeks and turns them into a video. You need Raspberry Pi Zero 2 W, Raspberry Pi Camera Module 3, SanDisk microSD card 32 GB (A1, Class 10) and Raspberry Pi 15 W USB-C power supply. It takes 7 steps and about 90 minutes.

Level
Beginner
Time
About 90 min
Parts
4

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
Camera ribbonPi Zero camera connector (contacts toward the board)Camera link (use the narrow Zero cable)
Power supplyPi USB power portPower
SD cardPi microSD slotRaspberry Pi OS Lite

Code

Raspberry Pi OS (Bookworm or newer) with Python 3. Use the Lite version without a desktop, which uses less power. Save the script as shot.py in your home folder, make it executable, and add it to cron with crontab -e and a line such as */5 * * * * /usr/bin/python3 /home/pi/shot.py, which takes a photo every five minutes. Fixing white balance and, if the light is steady, exposure, stops the flicker you see when automatic settings jump between shots. Over weeks the card fills, so check the space: a 5 megapixel photo is a few megabytes. To make the video, put all the photos in one folder on a computer and run ffmpeg -framerate 24 -pattern_type glob -i 'timelapse/*.jpg' -c:v libx264 -pix_fmt yuv420p out.mp4. Use a good power supply, because brown-outs corrupt the card, and keep the camera dry and out of direct sun. Do not point it at places where people expect privacy.

#!/usr/bin/env python3
# Takes one photo and names it by time. Run from cron every few minutes.
import datetime, os, time
from picamera2 import Picamera2

OUT = os.path.expanduser("~/timelapse")
os.makedirs(OUT, exist_ok=True)
cam = Picamera2()
cam.configure(cam.create_still_configuration())
cam.set_controls({"AwbEnable": False, "ColourGains": (1.8, 1.6)})   # fixed white balance stops the colour flicker; tune the gains
cam.start()
time.sleep(2)                       # let the exposure settle
name = datetime.datetime.now().strftime("%Y%m%d-%H%M%S") + ".jpg"
cam.capture_file(os.path.join(OUT, name))
cam.stop()

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Run by handOne JPG appears
After an hourTwelve photos
Colour from shot to shotSteady, no flicker
VideoPlays smoothly at 24 frames per second

If it does not work

No camera found

Check the ribbon and that the camera is enabled.

Colour flickers

Fix white balance and exposure.

Photos stop

Check the card is not full and the power is steady.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the time-lapse camera?

Raspberry Pi Zero 2 W, Raspberry Pi Camera Module 3, SanDisk microSD card 32 GB (A1, Class 10) and Raspberry Pi 15 W USB-C power supply.

How long does the time-lapse camera take to build?

About 90 minutes for a beginner maker, in 7 steps.

How do I know the time-lapse camera works?

Run by hand: One JPG appears. After an hour: Twelve photos. Colour from shot to shot: Steady, no flicker.

No camera found: what should I check?

Check the ribbon and that the camera is enabled.

Colour flickers: what should I check?

Fix white balance and exposure.

Photos stop: what should I check?

Check the card is not full and the power is steady.