Skip to content

andreaheilrath/TimelapseRecorder

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Time Lapse Recorder

This code provides a framework for recording and displaying a timelapse for windows or unix systems (including Raspberry PI).

Materials

A 3D model of the setup can be found here

Using USB Camera on Raspberry PI

USB cameras may be tricky on the PI in combination with opencv.

IMPORTANT: MAKE SURE THE CAMERA IS PLUGGED INTO AN USB 2.0 PORT. USING USB 3.0. WILL THROW AN ERROR!

To check the available resolutions, use the following console command: v4l2-ctrl -V

Since USB 2.0 is not capable to transfer uncompressed images of high resolution, MJPG encoding has to be used. This happens in the python code during the setup of the opencv capture: self.cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc('M', 'J', 'P', 'G'))

GPIO Buttons as Keyboard

It is possible to link gpio inputs to keyboard strokes. This can be realized using the device tree. I learned about this through the Blogpost by Martin Strohmayer.

To realize this, add these lines into the /etc/rc.local file, just before the line exit 0.

sudo dtoverlay gpio-key gpio=2 keycode=30 label="a" gpio_pull=2 
sudo dtoverlay gpio-key gpio=3 keycode=31 label="s" gpio_pull=2
sudo dtoverlay gpio-key gpio=4 keycode=32 label="d" gpio_pull=2
sudo dtoverlay gpio-key gpio=17 keycode=17 label="w" gpio_pull=2 
sudo dtoverlay gpio-key gpio=27 keycode=18 label="e" gpio_pull=2
sudo dtoverlay gpio-key gpio=22 keycode=1 label="Esc" gpio_pull=2
sudo dtoverlay gpio-key gpio=10 keycode=408 label="reboot" gpio_pull=2

Autostart on Raspberry PI

To start the python program automatically at the startup, I used the "Traditional System Method (All Users)" as mentioned in the forum post STICKY: How to use Autostart - Raspberry Pi OS (Desktop)

Raspberry Pi OS uses the /etc/xdg/autostart directory to start some background apps. You can use this directory to start apps or scripts which will apply to all users. Note that autostart is a directory and not a file. This method does not use an autostart file. It uses filename.desktop files instead.

To start the timelapse.py script, create a file timelapse.deskop in the /etc/xdg/autostart folder, containing the following:

[Desktop Entry]
Name=File Manager
Exec=pcmanfm
Type=Application

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%