Skip to content
Justin Cano edited this page Aug 2, 2014 · 28 revisions

Welcome to the raspberry-pi-camcorder wiki!
GitHub Page

This Raspberry Pi dedicated device was developed for the University of California, Riverside Entomology Department in order to successfully capture footage of insect eggs in remote urban and agriculture environments to look for natural predators of the Brown Marmorated Stink Bug. This repository contains four (4) modules intended for use: a camcorder to continuously record hour-long .h264 video clips (day/night) and a time-lapse camera to continuously capture still .jpg images in 10 second-long intervals (day/night).


Abstract

This wiki assumes the user is capable of accessing the Raspberry Pi environment and is intended for documentation of hardware and software components, or for use by anyone who wants to build their own Raspberry Pi camcorder system.

This system is intended to be used as a plug-and-play dedicated device. Once turned on, the Pi will start recording and save videos/images to an external USB NTFS hard drive or to /media/usbhdd if the hard drive is unavailable.

The day and night modes are configured to work in harmony with each other. Each program checks sunrise_sunset_tables.csv (a log of sunrise and sunset times from the year 2013) and turns its camera on/off accordingly. The day programs turn their camera on a half hour before sunrise and turn it off a half hour after sunset; the night programs turn their camera on a half hour before sunset and turn it off a half hour after sunrise.

If the Pi is configured to record/capture images at night, an infrared LED and a 220 Ohm 1% Resistor must be connected in series from GPIO 17 (pin #11) to ground.

To learn how to build your own Raspberry Pi Camcorder, please visit the Build your own section.

Parts

  1. Raspberry Pi w/ Raspbian & power supply
  2. PiCamera(day)/NOIR PiCamera w/infrared LED & 220 Ohm 1% Resistor (night)
  3. RTC Clock Module by Abel Electronics
  4. An external USB hard drive (formatted as NTFS)

Change camera program

The system uses the /etc/rc.local boot script to check for internet connection, load/set the RTC module (depending if there is an internet connection), and start the appropriate camera program.

To change which camera program for the Pi to run, first make sure the Pi is turned off and remove the camera and USB drive. Next, power up and log on to the Pi (locally or through SSH).

Open up the /etc/rc.local boot script by running the following command (we will be using the Nano text editor because it comes installed on Raspbian):

sudo nano /etc/rc.local

At the end of the script, right above the line that says exit 0, there should be four lines: three that have a # sign in front, and one that doesn't, e.g.:

python /home/pi/raspberry-pi-camcorder/time-lapse-day.py &
#python /home/pi/raspberry-pi-camcorder/time-lapse-night.py &
#python /home/pi/raspberry-pi-camcorder/camcorder-day.py &
#python /home/pi/raspberry-pi-camcorder/camcorder-night.py &

Note: if you are building this system from scratch, you probably only have your desired program listed. For more information, please see the Build your own section.

The above is an example from the system that's configured to run the time-lapse-day program. To change which program for the system to run at boot, simply move the # from the program you want to run to the program to which it has been previously configured for. For example, to configure our ongoing example to record hour-long clips during the day:

#python /home/pi/raspberry-pi-camcorder/time-lapse-day.py &
#python /home/pi/raspberry-pi-camcorder/time-lapse-night.py &
python /home/pi/raspberry-pi-camcorder/camcorder-day.py &
#python /home/pi/raspberry-pi-camcorder/camcorder-night.py &

Close, save, and exit the editor by pressing CTRL+X, y, then Enter. Shut down the Pi and it should run your desired camera program next time it turns on.

sudo shutdown now

Note: please wait a moment before unplugging the Pi after executing the above command to ensure a proper shut down.

Change recording length/time-lapse delay

We can easily change the recording length/time-lapse delay of the camera programs by editing a single line in any of the program files. First, move to the directory containing the source:

cd ~/raspberry-pi-camcorder

Next, choose which file to you want to change and open it, e.g.:

nano camcorder-day.py
or
nano time-lapse-night.py

If you are editing a camcorder program, scroll down until you find RECORDING_LENGTH, and assign it your desired value in seconds. Note: default is 3600 seconds (or one hour).

If you are editing a time-lapse program, scroll down until you find DELAY, and assign it your desired value you in seconds. Note: default is 10 seconds.

Close, save, and exit the editor by pressing CTRL+X, y, then Enter.

Clone this wiki locally