Coder Social home page Coder Social logo

pi-timelapse-boot's Introduction

Raspbery Pi Zero W Timelapse Boot

This is a modified version of Jeff Geerling's Pi Timelapse project. The script is run as a service at startup and is altered to output to a specific directory rather than current working directory.

  1. Follow Jeff's great setup on his page linked above, including all dependencies.
  2. Following this guide by Matt, next we will create a configuration file (aka a unit file) that tells systemd what we want it to do and when :
sudo nano /lib/systemd/system/timelapse.service

Add in the following text :

[Unit]
Description=Timelapse V1
After=multi-user.target

[Service]
Type=idle
ExecStart=/usr/bin/python /home/pi/pi-timelapse/timelapse.py

[Install]
WantedBy=multi-user.target

You can save and exit the nano editor using [CTRL-X], [Y] then [ENTER].

This defines a new service called “Timelapse V1” and we are requesting that it is launched once the multi-user environment is available. The “ExecStart” parameter is used to specify the command we want to run. The “Type” is set to “idle” ensures the ExecStart command is only run when everything else has loaded. For my GPIO based scripts the default type of “simple” didn’t work.

Note that the paths are absolute and fully define the location of Python as well as the location of our Python script.

In order to store the script’s text output in a log file you can change the ExecStart line to :

ExecStart=/usr/bin/python /home/pi/pi-timelapse/timelapse.py > /home/pi/pi-timelapse/bootlog.log 2>&1

The permission on the unit file needs to be set to 644 :

sudo chmod 644 /lib/systemd/system/timelapse.service
sudo systemctl daemon-reload
sudo systemctl enable timelapse.service

Reboot the Pi and your custom service should run :

sudo reboot

Step 4 – Check status of your service.

You can check the status of your service using :

sudo systemctl status timelapse.service

Once the service is running, I use WinSCP to SSH into my Pi to check the photos as the service is running.

pi-timelapse-boot's People

Contributors

nabontra avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.