Set-up Tutorial
Welcome to the First Edition of the set-up tutorial for the Time-lapse Camera
Basic Overview
The current System consists of 3 systems.
- Camera (Raspberry Pi)
- Server
- Website
The chain of events is as follows:
- The Camera Takes a Timelapse of Photos during the day
- The Camera compresses those photos into a small .mp4 video
- The Camera then Uploads the .mp4 video to the Server
- When the Server gets the uploaded video, it will stick it to the end of the current video
- When the Server has completed that, the video will be viewable on the WebPage
How to Set-up
Camera
Hopefully in the future there will be a Plug n' Play system where when we need another camera we can simply:
- Build the Camera
- Plug in an Image SD Card
- Run Basic Tests
- Ready to be placed (Calibration Testing may or may not also be needed)
However that's not currently the Case
Set-up scripts
We assume that we have a working Pi that has just logged in for the first time
The Pi will first need the timelapse folder. It will be placed in /home/pi directory
This folder will contain the scripts to actually run the program and some testing scripts
Set-up Packages
Here is a list of modules that must be installed in order for the program to work
Modules : ffmpeg, pysftp
To install them you must copy and paste the below commands into the terminal. (you can be at any directory when installing)
Links are provided above for official documentation
https://pypi.org/project/pysftp/
=> 'pip install pysftp'
https://pypi.org/project/ffmpeg-python/
=> 'pip install ffmpeg-python'
Set-up Crontab
Crontab is a default program that allows us to automatically run a script (python file) at a certain time.
Checkout the websites below (the first one has more detail) on how to create a crontab code line
Better Generator https://crontab.guru/
Simplier Generator https://crontab-generator.com/
To edit the crontab file type this into any terminal on the pi
=> crontab -e
An editor will then appear (likely vim) and the following line will need to be inputted and saved
=> */30 8-16 * * 1-5 python3 /home/pi/timelapse/timelapse.py
After changing the crontab file, the Pi will need to be rebooted inorder for the code to take effect
You can use the GUI to Reboot the Pi or you can type
=> systemctl reboot
Server
Set-up Scripts
There are 2 scripting files (as of writing this) that exist on the Server.
combine.py and watch-incoming.sh
These two files should be placed in the highest (/) directory in the server
Set-up Modules
The first module that the server needs is python3 as by default it will not include it
https://www.liquidweb.com/kb/how-to-install-python-3-on-centos-7/
=> yum install -y python3
Next is FFmpeg, a module used for anything video
This Link has instructions as there are a few
https://www.vultr.com/docs/how-to-install-ffmpeg-on-centos/
Next is inotify-tools
https://installati.one/centos/7/inotify-tools/
=> yum -y install inotify-tools
Next is glob, which is used to get all files from a Path
https://stackoverflow.com/questions/42964691/how-to-install-the-glob-module
=> pip3 install glob2
Set-up Files
The server also uses Crontab similar to the
@reboot sudo /watch-incoming.sh
