Skip to content

rainbowbreeze/RaspiCam-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 

Repository files navigation

RaspiCam-server

A server + utils to manage a Raspberry Pi Camera

Installation

To run the server, please refer to Picamera install guide. But, in theory, the system should be already configured to run the server

For the additional commands (capture an image using a cronjob, backup of images), the following packages are required
curl, rsync

Base logic

The scipt create a server streaming camera video using M-JPEG format. It can be reached via http://%server_ip%:8000 In addition, visiting the url http://%server_ip%/capture.html captures the current frame on a file

Start the streaming server as a linux server

A systemd Service concept is used to start the streamer at reboot

Create /etc/systemd/system/raspicam-server.service file

[Unit]
Description=RaspiCam Server
After=network.target

[Service]
Type=simple
Restart=always
ExecStart=python3 %Your_script_dir%/cam-streamer.py --folder %folder_where_download_pictures%

[Install]
WantedBy=multi-user.target

Enable the server:

sudo systemctl enable raspicam-server.service

The command output should look like Created symlink /etc/systemd/system/multi-user.target.wants/raspicam-server.service → /etc/systemd/system/raspicam-server.service.

And, finally, start the server:

sudo systemctl start raspicam-server.service

To check the status:

sudo systemctl status raspicam-server.service

TODO: run the service with non-priviledged user. Potentially, using this tutorial https://indomus.it/guide/come-installare-e-configurare-home-assistant-su-un-raspberry-pi-gia-in-uso/#autostart

Capturing images at given time

In order to capture images at a given time (for example, for a timelapse), create a cronjob for the given interval.

First, check the script has execution permission

chmod +x %Your_script_dir%/capture_frame.sh

Then, edit the crontab (user or root, up to you to decide)

crontab -e  

And add this command

# Runs at every 15th minute past every hour from 7 through 18 on every day-of-week from Monday through Saturday.
*/15 7-18 * * 1-6 %Your_script_dir%/capture_frame.sh

Some links on how to manage cronjobs

About

A server + utils to manage a Raspberry Pi Camera

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published