Using this setup it is possible to achieve a number of things that cannot be achieved by using a motion detection system based solely on the webcam.
- The GoPro camera has much better resolution and clarity than the cheap webcam used here.
- Burst mode on the GoPro has rates of up to 30 frames per second, great for photographing wildlife.
- The motion detection area can be different to the area where the photograph is taken. The arrangement below used during testing shows a system that is triggered by the cat (Phoenix) coming up the stairs, but the GoPro is situated in a slightly different location. Imagine the webcam being used to detect motion in the area around a bird feeder, with the GoPro focussed entirely on the bird feeder.
|Test setup, the Raspberry Pi and cheap webcam (left) detect the cat as it reaches the top of the stairs. The Raspberry Pi then triggers the GoPro (set in burst mode) to take a quick succession of photographs as the cat walks past.|
For this project I used the Raspbian Linux distribution on the Raspberry Pi but similar instructions will apply on other distributions. For setting up the project connect the Pi to a wired network as both USB ports are used (one for webcam, the other for the WiFi adaptor).
These assume you are running a *nix system.
- Turn on the GoPro and enable its WiFi functionality (GOPRO APP).
- Connect the WiFi adaptor to the Raspberry Pi. Connect to the Raspberry Pi from your computer (ssh -X email@example.com) and configure the Pi to connect to the GoPro's WiFi network (easiest way is to run wpa_gui).
- Install the motion application and php: sudo apt-get install motion php5-cli
- Make it so motion can run without errors: chmod +r /etc/motion/motion.conf
- In the /etc/motion/motion.conf file change the following lines:
on_start_event php /home/pi/goprophp.php SHOOT
- Download and extract the GoProPHP tool into your home directory (or clone the project using git).
- You can test that everything is setup correctly by putting the GoPro into burst mode:
php /home/pi/GoProPHP/goprophp.php BURST
- To launch motion when the Pi is powered on add motion after the comments in /etc/rc.local
- Plug in the webcam and restart the Raspberry Pi. If all goes well you have your motion-detecting camera working.
Here is the first photo of Phoenix taken using the setup illustrated above, obviously potential for better lighting but it illustrates how the two-camera solution may be useful.