Skip to content

kevinabrandon/sunsetpi

Repository files navigation

sunsetpi - A Raspberry Pi powered, automated time-lapse project

Photos are taken regularly throughout the day. At the end of the day a 4k time-lapse is generated and uploaded to YouTube.

Currently running at Nipomo Sunset Pi on YouTube.

Future Plans

  • Add configuration to save data to an external drive.
    • Daily backup to a network drive.
  • Use localized sunrise/sunset times to start and stop the time-lapse.
  • Slow down the time-lapse around the sunset.
    • Make a separate sunset-only time-lapse without affecting the day-long time-lapse.
  • Automatically add title and end screens
    • Uses a photo with a Ken Burns effect with the date and music information in the subtitle.
    • Make the title photo a picture of the daily sunset.
  • Make the YouTube thumbnail be about 15 minutes before sunset.
  • Automatically add royalty free music to the videos.
    • Would be cool to automatically scrape the YouTube audio library.
    • More likely I'll download a bunch of music, put it into a folder and cycle through them. (this is what I did)
  • Add image stabilization to remove wind shaking.
  • Make long term time-lapses of solar noon, and of each sunset showing how the sun moves across the horizon as the seasons pass.
    • Automatically make a monthly time-lapse.
    • Make a yearly time-lapse.
    • Make multi-year time-lapses.
  • Automatically maintain monthly playlists on YouTube (August 2020, September 2020, etc.).
  • Make the latest video always the featured video on the channel.
  • Integrate with weather API to show daily high and low teperatures and daily rainfall.
  • Add an AI voice over and shorten the title
  • Add links to previous year's videos
  • Automatically upload monthly time-lapses

Dependencies

Recommended Hardware

Installation Instructions

  1. Setup a Raspberry Pi (preferably in headless mode, but not required)
  2. Install an external hard drive and edit fstab so that it always mounts to the same location.
    • This may be optional if you don't care to save the raw data.
    • Carefully follow the instructions found here.
  3. Install dependencies:
sudo apt install ffmpeg
sudo apt install imagemagick
sudo apt install python3-pip

# I like to have an alias that forces the python3 and pip3... so that's what I do:
echo 'alias python=python3' >> ~/.bash_aliases
echo 'alias pip=pip3' >> ~/.bash_aliases
source ~/.bashrc

# install a virtual environment to install all the YouTube specific stuff we need
cd
pip install virtualenv
python -m virtualenv youtube
source youtube/bin/activate
python -m pip install google-api-python-client
python -m pip install oauth2client
deactivate
  1. clone this project:
cd
git clone https://github.com/kevinabrandon/sunsetpi.git
  1. Download the NOAA Solar Calculations for the year
    • Go to the NOAA Solar Calculator and enter in your gps location
    • Click the "Create Sunrise/Sunset Tables for the Year" button
    • Using the mouse select the text of each table and copy and paste them into a spreadsheet program (I used google sheets).
    • Export each table as a csv file called:
      • YYYY-sunrise.csv
      • YYYY-sunset.csv
      • YYYY-solarnoon.csv
    • Make the YYYY the current year
    • Save the csv files into ~/sunsetpi/solar-tables/
  2. setup crontab:
crontab -e

Add the following lines to the contab:

# trigger the camera every minute:
* * * * * . $HOME/sunsetpi/config.sh; $SUNSETPI_PATH/trigger_cam.sh
# trigger the camera on the 15, 30 and 45 seconds of each minute for the sunset portion:
* * * * * . $HOME/sunsetpi/config.sh; $SUNSETPI_PATH/trigger_cam.sh 15
* * * * * . $HOME/sunsetpi/config.sh; $SUNSETPI_PATH/trigger_cam.sh 30
* * * * * . $HOME/sunsetpi/config.sh; $SUNSETPI_PATH/trigger_cam.sh 45

# trigger the daily time-lapse creation at 9:15 pm every day:
15 21 * * * . $HOME/sunsetpi/config.sh; $SUNSETPI_PATH/make_daily_timelapse.sh
  1. Setup your project on Google API Console
  2. From the Google API Console create oauth2 credentials and put them in ~/sunsetpi/credentials.json
  3. After the first day of photos manually run the make_daily_timelapse.sh so that you are able to follow the youtube authorization instructions in the console.
  4. For now on the auth is saved and the make_daily_timelapse.sh can be run via cron each day.

About

An automatic timelapse project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published