Timelapse Pi Mk3

Simple Raspberry Pi timelapse camera. Updated!

raspberry pi timelapse camera Mk3

from 3D model to first 3D-printed prototype

The code is pretty similar, and still extremely simple.

But for this one I opted to focus on form and features.

The Essentials

Install headless OS on Raspberry Pi Zero W I had laying around.

Create bash script to take still photos (named mine "run-timelapse.sh"):

#!/bin/bash
while : #infinite loop to just take photos!
do
    echo "taking still photo"
    libcamera-still -o /home/pi/timelapse/ --datetime -q 95 --width 1920 --height 1080 --nopreview
    sleep 120 #in seconds
done

Make script executable:

sudo chmod a+x FILENAME

Set script to run on reboot with:

sudo crontab -e

by adding this line to the end of the file:

@reboot /home/pi/timelapse/run-timelapse.sh

Then ssh to the pi and navigate to the directory where the pictures should be. If new images show up every two minutes, you're good to go!

ssh pi@timelapsepi

Copy photos to local computer

From the terminal on the local machine using rsync instead of scp:

rsync -azP pi@timelapsepi:timelapse/ /Users/joelgaeddert/desiredlocation

Make the video using ffmpeg:

ffmpeg -framerate 12 -pattern_type glob -i "*.jpg" FILENAME.mp4

1 picture every 2 minutes = 30 pictures / hr = 720 pictures / day

720 frames x 12 frames / sec = 60 sec video

So to make a video of April 14:

ffmpeg -framerate 12 -pattern_type glob -i "*0414*.jpg" 2022-4-14.mp4

Delete files after copy

This needs to be scripted to prevent user error. Because remember that one time I deleted 42,000+ files on my computer accidentally? Including all my wedding photos? We don't want that.

Note: it's all good--luckily my backup systems worked as designed. But it was honestly one of the most nerve-racking few hours of my life.

Preview camera for initial setup

Start the camera and open a preview window, indefinitely:

libcamera-hello -t 0

-t = time, 0 = indefinitely

Connect with RealVNC

The simplest solution for connecting to the Pi in a headless setup. Both Mac / iPhone apps.

RealVNC

That pretty much covers the basics. Plug it in and pictures start being taken right away!

3D printer laying down first layer of filament


Next time:

Take the extra 2 minutes to swith out the 3d printer filament!

The green color is hideous.

Take the time to model all the screws.

The only real design mistake I made was putting one screw too close to edge of the case, which meant that it couldn't be screwed in all the way. It's a tiny error, but easily preventable and quite frustrating when you want to get it right!

Better process documentation.

I only took a couple photos during this build, and a short video clip. Should have documented things better as I went along. Especially during the 3D modeling process.