Friday, March 15, 2013

RPi as a Remote Control for a Canon DSLR - Part 1

In the quest to play with more gadgets, and to get better image quality for my birdcam, I am going to try and integrate my Canon 500D with a Raspberry Pi.   The RPi will provide a wireless remote capable of motion detection and also for populating a web server with captured images.

I am going to base this on gphoto2 with the help of a Python binding that I found here.  The first step is to get gphoto2 working on the RPi in it's command line state.  Then I will download the Python binding and see if it works.

So, first, here is a condensed version of the build process from the various bits and bobs that I found across the above (and other) sources:
  1. Download the tarballs for libgphoto2 and gphoto2 from the gphoto2 website and expand them on the RPi.
  2. Install the precursor software that you will need automake, autoconf, gettext, (pkgconfig, make on Arch) for the builds
  3. The following should also be installed:      libusb-1.0-0-dev, libexif-dev, libpopt-dev, libfuse-dev, mono-devel, monodoc-base, mono-gmcs, python-pyrex, libtool, [libusb on Arch].
  4. Build libgphoto2 (./configure --prefix=/usr/local, make, sudo make install).  There are switches that will allow you to pick cameras to include.   If you just take the default for all cameras you can have a cup of tea during the make step!
  5. Now install the precursor software that you will need for the build of gphoto2 (assuming you are want the client even though most folks can not seem to get it to work (more later on my work around)!   Note that libpopt-dev, which is needed to the build here, was not found on Arch Linux?
  6. And build it (autoreconf -is, ./configure, make,  sudo make install).  Note that the instructions for building from the tarball did not say that you needed to do the autoreconf but I found it necessary.
  7. But...don't go and try and run gphoto2 unless you want to get this error message: "gphoto2: error while loading shared libraries: libgphoto2.so.6: cannot open shared object file: No such file or directory".   Edit /etc/ld.so.conf and add the line "/usr/local/lib" then run ldconfig as root.
  8. At this point you should be able to run "gphoto2 --auto-detect" and have it find your camera, or, "gphoto2 --capture-image-and-download" to take a picture.
I got through all of the above and then got an error doing a capture that I believe is due to the infamous RPi USB issues discussed at length on the Raspbery Pi Forums.

There are some references to possible work arounds on the web so I am going to do  some investigation.

Here are apt-get command lines for the precursor needs on wheezy:
sudo apt-get install -y automake autoconf gettext
sudo apt-get install -y automake autoconf  gettext libusb-1.0-0-dev libexif-dev libpopt-dev libfuse-dev mono-devel monodoc-base mono-gmcs python-pyrex libtool

No comments:

Post a Comment