Pointless Waymarks Software

Software from the Desert Southwest

Pi Sliced-Day Photos and Timelapse Helper

Created by Pointless Waymarks CMS on 9/19/2024. Updated on 12/23/2024.

Pi Sliced Day Photos is a .NET Core (C#) program designed to be run on a Raspberry Pi that can take photographs at Sunrise, Sunset, a number intervals in-between and at custom times specified either by clock time or minutes +/- from sunrise/sunset. This program was written specifically to support scheduling that I did not find easily available in other programs.

The Pi Sliced Day Photos Timelapse Helper Windows Desktop GUI and command line program create Timelapse Videos from the photographs created with the Pi Sliced Day Photos by using FFmpeg. These programs understand the naming conventions of the Pi Sliced Day Photos program and make sorting and filtering based on different cameras and schedules easy. These programs also have some interesting options like combining photos from different cameras into a single video.

Photos captured on a Raspberry Pi with the Pi Sliced Day Photos program and assembled with the Pi Sliced Day Photos Timelapse Helper.
2024 December Pi Sliced Day Photos Timelapse Helper Solstice Full Year
2024 December Pi Sliced Day Photos Timelapse Helper Solstice Full Year.

Pi Sliced Day Photos Downloads

Pi Sliced Day Photos Timelapse Helper - Windows Desktop Gui - Downloads

Pi Sliced Day Photos Timelapse Helper - Commandline - Downloads

Photos captured on a Raspberry Pi with the Pi Sliced Day Photos program and assembled with the Pi Sliced Day Photos Timelapse Helper.

Pi Sliced Day Photos

The inspiration for this program is living 6,000' below and 5 miles west of a mountain peak. This program allows us to input sunrise and sunset times that match when the sun comes over the ridge to the east and when it sets over the various mountains on the western skyline. With sunrise/sunset times so influenced by topography 'halfway thru the available sunlight for the day' becomes a much more interesting scheduling option than a photo taken at a certain clock time or sun angle.

The sunrise/sunset times for the program must be provided as a CSV file - this requires some extra work but leaves you free to use any times you want. A great way to use this is by generating sunrise/sunset times based on the topography around the camera site (see the notes below) - in many cases the sunrise time on an imagined horizon is not photographically useful or interesting, the sunrise time when the sun emerges from behind a mountain peak is much more interesting!

The image below was created with the Pointless Waymarks Utilitarian Image Combiner by combining the output of this program from 3 Raspberry Pi 3 A+ computers with Wide Angle Camera Module 3 cameras - the cameras face, approximately, west, north and east

2024 February Pi Sliced Day Photos Combined with the Utilitarian Image Combiner
2024 February Pi Sliced Day Photos Combined with the Utilitarian Image Combiner.

Program Requirements

Sunrise and Sunset are always photographed - you can also specify:

SunriseAndSunset.csv

This program uses a file of Sunrise/Sunset times to allow you to input any sunrise/sunset times that you want - a strong use case for this is generating topography compensated Sunrise/Sunset times for your location. For example, today at my house we didn't see the sun come over the mountains to the east until 40+ minutes after the sunrise time calculated for the 'true' (imagined) horizon...

The SunriseAndSunset.csv file should be formatted like the sample file included with the program:

DAY, SUNRISE, SUNSET
2023-01-01,08:15:00-0700,17:23:00-0700
2023-01-02,08:15:00-0700,17:24:00-0700

If you are interested in generating Topography compensated Sunrise/Sunset times for your location try:

Settings File

DaySlices - Takes an integer and determines the number of photos taken between sunrise and sunset.

NightSlices - Takes an integer and determines the number of photos taken between sunset and sunrise.

PhotoStorageDirectory - The path to where the photos are written.

SunriseSunsetCsvFile - The name (including extension) of the csv file of Sunrise and Sunset times.

PhotoSeriesName - Postfix for the photo name - this defaults to the machine name if not present.

LogFullExceptionsToImages - The assumption is that this program will run largely unattended and that most of the time the only thing you will see is the photographs. The program will try to alert you of errors by writing exception information to an image file in the PhotoStorageDirectory. This setting determines whether the program writes all of the exception information or only an abbreviated message. This option exists because writing full exception information may leak information about your setup!

LibCameraParameters - Day/Night/Sunset/Sunrise - command line parameters for libcamera-still.

CustomTimes - Custom times can be specified either as clock times (3:45 pm) or as minutes before/after sunset (sunset +10). Each custom time also gets LibCamera parameters.

"CustomTimes": [
    {
      "Time": "Sunset+10",
      "LibCameraParameters": "--autofocus-mode manual --lens-position 0 --awb auto --metering average --denoise cdn_hq"
    },
    {
      "Time": "Sunrise-10",
      "LibCameraParameters": "--autofocus-mode manual --lens-position 0 --awb auto --metering average --denoise cdn_hq"
    }
  ]

Setup Notes

Suggested setup on the Pi - this is here for convenience and was last updated July 2024. As OS and Pi details change some/most/all of this might become irrelevant, or even harmful, and this by no means covers all the details needed to run a Pi securely and appropriately. The setup below is pretty basic, but use at your own risk!

mkdir PiSlicedDayPhotos
mkdir SlicedPhotos
chmod +x PiSlicedDayPhotos/PiSlicedDayPhotos
nano PiSlicedDayPhotos/PiSlicedDaySettings.json
nano PiSlicedDayPhotos/pisliceddayphotos.service
sudo cp PiSlicedDayPhotos/pisliceddayphotos.service /etc/systemd/system/
sudo systemctl daemon-reload
 sudo systemctl enable pisliceddayphotos --now
journalctl -u pisliceddayphotos -f

I like to disable the LEDs to make sure that the glass covering the lens opening won't pick up any light from the LEDS - How To Easily Disable Status LEDs On RaspberryTips

sudo nano /boot/firmware/config.txt

Add the following lines to the end of the file:

#Disable Power LED (Red)
dtparam=pwr_led_activelow=off
#Disable Activity LED (Green)
dtparam=act_led_trigger=none
dtparam=act_led_activelow=off
#Disable LAN LEDs
dtparam=eth_led0=14
dtparam=eth_led1=14

My preference is for Automatic/Unattended Upgrades - do this long enough and something unexpected will break, but I would rather stay up to date and have something break sooner rather than later. Secure your Raspberry Pi by enabling automatic software updates – Sean Carney and UnattendedUpgrades - Debian Wiki

sudo apt-get update
sudo apt-get install unattended-upgrades
sudo dpkg-reconfigure --priority=low unattended-upgrades

If you've worked in years gone by with the Pi Camera and C# you might know the very useful techyian/MMALSharp: C# wrapper to Broadcom's MMAL with an API to the Raspberry Pi camera - unfortunately without choosing an older version of Raspberry Pi OS that library no longer works. The Pi has moved on to libcamera. I didn't find a C# wrapper for libcamera and since I didn't need to do anything other than write stills to the Pi's storage calling libcamera-still 'command line style' seemed to be the best option.

I didn't find a single great place for libcamera-still documentation - frustrating until I figured out that (beyond 'getting started' content) running 'libcamera-still --help' was really the best single source of information.

July 2024 Update

I have been running 3 Raspberry Pi 3 A+ computers with the Wide Angle Camera Module 3 cameras for over 6 months now - the PiSlicedDayPhotos program and Pis have run without issues or attention needed! However, a few things have come up:

Backstory

For a number of years my wife and I used a previous (now-archived) project - cmiles/PiDropLapse - and a Raspberry Pi 4 Model B to take periodic photographs and sensor readings to monitor an area inside our house.

Since moving to a more rural property I have wanted to do a similar project but outside and solar powered - Raspberry Pi shortages, never quite finding an in-stock dedicated Pi solar setup that I loved and other house projects delayed that idea...

Recently we installed a 24V/100aH solar system near our parking area. The main purpose of this system is to power the rodent deterrent lights for our trucks - but luckily it has more than enough power to also power several Pis for photo purposes!

2024 July Pi Sliced Day Photos Mostly Recycled Camera Enclosure
2024 July Pi Sliced Day Photos Mostly Recycled Camera Enclosure. 7/22/2024.

My Setup with Notes

Most of the gear below was purchased mid-2023, but I have added a few mid-2024 updates. I hope to keep my current setup running for a very long time so I won't be constantly updating this list with the latest and greatest gear - but I will try to update with improvements, notes, failures and successes.

Other Projects

Fundamentally this project is just taking photographs with the Raspberry Pi which is not hard to do and you can find other great free projects and code to take stills, timelapses and more! One of my favorites is GitHub - thomasjacquin's allsky: A Raspberry Pi operated Wireless Allsky Camera - I hope to build on of these in the future... Also see Roll Your Own All-Sky, Raspberry Pi Camera - IEEE Spectrum and the Hacker News discussion.

Tools and Libraries

This program would not be possible without the amazing resources available for creating Free software! Used in this project:

Tools:

Core Technologies:

Libraries:

2024 December Pi Sliced Day Photos Combined Example
2024 December Pi Sliced Day Photos Combined Example.

Tags: