Controlling Canon EOS 40D Digital Camera from Raspberry Pi
The raspberry pi camera is great for experiments but not unrivaled in terms of image quality. But you could also use many DSRL cameras connected to your raspberry pi to take pictures. This is how to use a Canon EOS 40D together with a raspberry pi.
I totally love to work with the Raspberry Pi as everywhere computer. There are so many accessories available making it a great platform to experiment with. If you work with photos the standard raspberry pi camera is a well-known and stable tool. At least in most cases. The image quality is of course not that convincing, especially if you compare it to a DSLR or compact camera.
But lucky us we are not the first who have this problem. The solution is called gphoto2. It is a small command line tool which allows you to control DSLR cameras over USB connection. Here you find a list of supported cameras.
The Canon EOS 40D has a Mini-USB port. So you just need to plugin the Mini-USB into the camera and connect it to the USB port of your raspberry pi. That’s all.
But first, we have to prepare the raspberry pi. As for every software installation please bring your raspberry pi up to date:
sudo apt-get update
Now we need some further tools for the USB connection , if they are not already installed:
sudo apt-get install libltdl-dev libusb-dev libexif-dev libpopt-dev
And finally we install the gphoto2 tools:
sudo apt-get install gphoto2
For most DSRL cameras this should already be enough. If you have some trouble and the camera is not reacting on your commands this might help (for Canon EOS 40D you will definetly have to do this steps). Just type in the following commands:
sudo rm /usr/share/dbus-1/services/org.gtk.Private.GPhoto2VolumeMonitor.service
sudo rm /usr/share/gvfs/mounts/gphoto2.mount
sudo rm /usr/share/gvfs/remote-volume-monitors/gphoto2.monitor
sudo rm /usr/lib/gvfs/gvfs-gphoto2-volume-monitor
Restart the camera and the raspberry pi. Now you should be able to use the gphoto2 commands.
If everything went right, the following command should give you a list of detected camera and should show up your model:
pi@raspberry:~$ gphoto2 --auto-detect Model Port ---------------------------------------------------------- Canon EOS 40D usb: pi@raspberry:~$
If you use the following command the camera will take a photo and the image will be downloaded from the camera to your raspberry pi immediately:
Now you could do that every you want with your taken images.