Canon EOS 400D and Linux – Expt1
I was all excited when my new Canon EOS 400D landed in my hands today. I think that it’s a great piece of equipment, although I haven’t yet played around with it enough.
I thought I needed to buy a separate cable to computer-control it, and the USB cable was only a data transfer cable. I casually asked about software for EOS 400D on Linux on ##astronomy on freenode, and I was excited when ‘peerce’ told me that I should’ve got the USB cable for computer-control along with the camera! I ran down and brought the cable and connected the camera to my brother’s system, running Debian (testing).
I didn’t find a good “HOWTO” for the Canon EOS 400D detailing the remote-controlled capture, although I expected that somebody would’ve written one. (I think I should write one when I fully explore it, if someone else hasn’t!)
File transfer was trivially easy:
sudo apt-get install gphoto2 gtkam
gtkam
Select the ‘Add Camera’ option from the ‘Camera’ menu and say ‘Detect’. Then click ‘Ok’. If the camera doesn’t initialize, try restarting the camera 😀 (May not be the right way to do things). If gtkam doesn’t segfault or run into some trouble, you should see a list of thumbnails on the right half of the window, if you select the right thing (the only thing) in the tree on the left pane. Figure out, it’s quite intuitive, and it doesn’t work well 😛 Maybe there are better methods to do this – maybe the konqueror camera:/ kioslave (or whatever it’s called) works better – please let me know in that case.
Now, I want to control my camera. So I look around for documentation. I understand that it is just
gphoto –set-config capture=on
gphoto2 -F <# of frames> -I <interval> –capture-image
That didn’t seem to work. After much experimentation, I tend to think that the camera needs details of how you want to photograph – i.e. focusing, exposure settings etc. (or does it?). Besides, capture=on must be set in the same command as the –capture-image, or so it seems, probably because every gphoto2 command sends a whole bunch of other instructions to the camera as well (isn’t that inefficient???).
So, that means that if I put the camera on Auto Mode using the Mode dial, then I can get away with:
gphoto2 –set-config capture=on -F 1 -I 1 –capture-image
For some reason, the command doesn’t terminate (and consequently, F > 1 doesn’t work) – probably because it wants us to accept the image and save it as well. I still need to figure this out.
One more thing that I see is that if I do a
gphoto2 –list-config
I get only three options:
/main/settings/capturetarget
/main/settings/capture
/main/capturesettings/focuslock
This is expected (after reading the documentation), because the remaining settings that pertain to capture mode are exposed only after we enable capture mode. So do a
gphoto2 –set-config capture=on –list-config
and you get a whole bunch of configurable parameters:
/main/settings/eos-time
/main/settings/capturetarget
/main/settings/capture
/main/imgsettings/eos-iso
/main/imgsettings/eos-whitebalance
/main/capturesettings/picturestyle
/main/capturesettings/eos-aperture
/main/capturesettings/eos-shutterspeed
/main/capturesettings/eos-meteringmode
/main/capturesettings/focuslock
Ahh… so there we go. So, if I wanted a (semi-)successful manual exposure, I should do:
gphoto2 –set-config capture=on –config -F <Nf> -I <Ti> –capture-image
I still need to figure out how to retrieve the file or somehow get the command to complete.
Earlier, my AF exposures would fail, because I was trying to shoot a blank wall, so AF would fail! It took me really really long to realize that!
The following documentation will prove to be sparingly helpful:
- http://gphoto.sourceforge.net/doc/remote/
- http://korrekt.org/page/Running_Canon_EOS_400D_under_Linux
- http://gphoto.sourceforge.net/doc/manual/using-gphoto2.html
- http://gphoto.sourceforge.net/doc/manual/ref-gphoto2-cli.html
Akarsh Simha 4:17 am on March 30, 2008 Permalink | Log in to Reply
Expt 1.0.1
I tried:
~/bin/gphoto2 –set-config capture=on -F 1 -I 1 –capture-image –new
The command still doesn’t terminate.
–new is supposed to get all pictures flagged as new.
Akarsh Simha 2:06 pm on March 31, 2008 Permalink | Log in to Reply
The problem of not terminating correctly is apparently because of some change with the proprietary (and consequently undocumented) Canon PTP (Picture Transfer Protocol or something like that) in the new firmware.
Marcus Meissner has already started working on it and has produced (and commited?) a patch today (an hour ago or so).
Will check if it works later today evening.
akarshsimha 11:11 am on April 6, 2008 Permalink | Log in to Reply
Ok… Marcus Meissner has fixed it and it works for other people. It’s been merged with the trunk. I now need to figure out how to compile gphoto2 from the trunk.
Nick Quinn 1:40 am on April 30, 2008 Permalink | Log in to Reply
After messing around with gPhoto and my 40D for several months, your blog provided me with the ‘hint’ I needed to finally understand how to set the shutter speed! However, if I fire the shutter either from gPhoto or by the camera’s shutter button, no image is stored on the CF card. Did you manage to get any further with your 400D and actually capture an image?
Akarsh Simha 1:43 am on May 13, 2008 Permalink | Log in to Reply
Glad that my blog proved useful. I haven’t got beyond this, because I haven’t found time to recompile gphoto2 from the trunk ever since 😀
Regarding storing on CF card, you’ll have to set capturetarget to CF card. I don’t know what the exact value is, but you can look up the documentation for that.
There’s also a neat ncurses based configuration screen, which you can use to set these parameteres.
Andrew Wyllie 4:36 pm on June 27, 2008 Permalink | Log in to Reply
Thanks for all the information on this. I got the latest version from SVN and it compiled with no problem and works really well.
If you want to capture an image an download it right away, you need to use a command like:
gphoto2 –set-config capture=on -F1 -I 1 –capture-image-and-download
Even cooler is to use a hook-script which allows you to manipulate and or display the image as soon as it’s downloaded.
Here’s my hook-script script which uses ‘display’ from ImageMagick to display the image one it has been downloaded (you could put any command you want there).
#! /bin/bash
self=`basename $0`
case “$ACTION” in
init)
echo “$self: INIT”
# exit 1 # non-null exit to make gphoto2 call fail
;;
start)
echo “$self: START”
;;
download)
echo “$self: DOWNLOAD to $ARGUMENT”
display ${ARGUMENT} &
;;
stop)
echo “$self: STOP”
;;
*)
echo “$self: Unknown action: $ACTION”
;;
esac
exit 0
fred 1:00 pm on August 2, 2008 Permalink | Log in to Reply
Thanks for this useful info… you have put me on the right track. Maybe i can help you with a problem you have…
Perhaps some of your commands haven’t been working because you weren’t typing the “–” correctly at the start?
I cut and pasted some of the commands from this web page and they didn’t work for me. I changed the characters at the start of the arguments to “–” and then they worked.
Eg gphoto2 –set-config capture=on -F 1 -I 1 –capture-image (from this page)
didn’t work for me until i changed the -set to –set and -capture to –capture
This may be of no use to you, perhaps the web page displays the double minus (–) as a single character for some reason
fred 1:03 pm on August 2, 2008 Permalink | Log in to Reply
After publishing my last comment, i now see that it is just the web software that runs together the double minus if it is typed with no space. Be aware if you cut and paste commands from here that look like this
–config
you need to manually edit them to look like this
– -config (but with no space between the minus)
Sorry this info is no use to the owner of this page but any others might be caught by this trap
Akarsh Simha 9:18 pm on September 6, 2008 Permalink | Log in to Reply
Yes, the – seems to be a problem with WordPress.
I’ve still not been able to get gphoto2 from trunk to build and the latest release doesn’t seem to work for me.
jan 7:13 am on November 16, 2008 Permalink | Log in to Reply
Thanks to your article and helpful comments I have managed to get gphoto control my Canon 400D. Everything works with gphoto 2.4.3 and libgphoto 2.4.3 (even capture-tethered).
Akarsh Simha 6:53 pm on February 1, 2009 Permalink | Log in to Reply
I’m now doing astrophotography comfortably with my Canon EOS 400D and Debian laptop, thanks to Marcus Meissner and gphoto2.
I’m using version 2.4.3 of both gphoto2 and libgphoto. This is what I do to get it working:
gphoto2 –set-config capture=true -F -I –capture-image-and-download
It still doesn’t seem to work with the mirror lock up / self timer. That’s something I need to figure out, because astrophotography really needs that!
Noah 12:37 pm on July 18, 2009 Permalink | Log in to Reply
I like the following;
$ mkdir ./photo && cd ./photo
$ gphoto2 -P
That will suck all the photos off the camera into dir photo. Thanks for the remote control info.
Noah
Damien Keffyn 7:56 pm on August 1, 2009 Permalink | Log in to Reply
I have tried with no real success to get my 400D to capture download and preview an image.
is there a change that has relpaced the commands used above?
Here is what I am trying
gphoto2 –set-config capture=true -F -I –capture-image
This returns –>
value true, t 1
New file is in location /capt0000.jpg on the camera
this command fails –>
gphoto2 –set-config capture=true -F -I –capture-image-and-download
this command works –>
gphoto2 –set-config capture=true -F -I –capture-image –get-all-files
It returns the –>
value true, t 1
New file is in location /capt0000.jpg on the camera
Saving file as capt0000.jpg
The issue I have is I would like to be able to use the camera to take the image rather than instigate the capture from the command line.
is this possible?
Cheers,
Damien K
Javier Pais 12:14 pm on December 20, 2009 Permalink | Log in to Reply
gphoto2 –set-config capture=true –set-config eos-time=120 –capture-image-and-download
Javier Pais 12:29 pm on December 20, 2009 Permalink | Log in to Reply
Sorry for my previous post…
There is… if we do a:
$ gphoto2 –set-config capture=on –list-config
this is the result:
/main/settings/eos-time
/main/settings/eos-synctime
/main/settings/capturetarget
/main/settings/capture
/main/imgsettings/eos-iso
/main/imgsettings/eos-whitebalance
/main/capturesettings/picturestyle
/main/capturesettings/eos-aperture
/main/capturesettings/eos-shutterspeed
/main/capturesettings/focuslock
then we can do a…
$ gphoto2 –set-config capture=on –get-config=/main/capturesettings/eos-shutterspeed
obtaining this:
Current: 1/4000
Choice: 0 30″
Choice: 1 25″
Choice: 2 20″
Choice: 3 15″
Choice: 4 13″
Choice: 5 10″ (1/3)
Choice: 6 8″
Choice: 7 6″ (1/3)
Choice: 8 5″
Choice: 9 4″
Choice: 10 3″2
Choice: 11 2″5
Choice: 12 2″
Choice: 13 1″6
Choice: 14 1″3
Choice: 15 1″
Choice: 16 0″8
Choice: 17 0″6
Choice: 18 0″5
Choice: 19 0″4
Choice: 20 0″3 (1/3)
Choice: 21 1/4
Choice: 22 1/5
Choice: 23 1/6 (1/3)
Choice: 24 1/8
Choice: 25 1/10 (1/3)
Choice: 26 1/13
Choice: 27 1/15
Choice: 28 1/20 (1/3)
Choice: 29 1/25
Choice: 30 1/30
Choice: 31 1/40
Choice: 32 1/50
Choice: 33 1/60
Choice: 34 1/80
Choice: 35 1/100
Choice: 36 1/125
Choice: 37 1/160
Choice: 38 1/200
Choice: 39 1/250
Choice: 40 1/320
Choice: 41 1/400
Choice: 42 1/500
Choice: 43 1/640
Choice: 44 1/800
Choice: 45 1/1000
Choice: 46 1/1250
Choice: 47 1/1600
Choice: 48 1/2000
Choice: 49 1/2500
Choice: 50 1/3200
Choice: 51 1/4000
and the pick the desired value…
gphoto2 –set-config capture=true –set-config eos-time=26 –capture-image-and-download
(remember that ‘–‘ are two ‘-‘)
Javier Pais 1:10 pm on December 20, 2009 Permalink | Log in to Reply
Sorry another time…
is not ‘eos-time’… it must be… ‘eos-shutterspeed’
gphoto2 –set-config capture=true –set-config eos-suttherspeed=26 –capture-image-and-download
Luke 4:59 am on April 5, 2010 Permalink | Log in to Reply
Akarsh you wrote:
“I’m now doing astrophotography comfortably with my Canon EOS 400D and Debian laptop”
I`m going to use my eos 400d with a small baloon to take photos from about 50m on archaeological site.
Do you have any idea how to connect the camera with laptop? usb cabel is to short… via radio? How to fix it up with gphoto etc..?
Javier Pais 2:33 pm on April 5, 2010 Permalink | Log in to Reply
Maybe with some thing like this: http://www.byterunner.com/byterunner/product_name=VAD-1120/user-id=/password=/exchange=/exact_match=exact
Luke 6:48 pm on April 5, 2010 Permalink | Log in to Reply
Looks really good and may solve my problem, 150 fits may to be too short, but I may find sth. simillar if I know what am I looking for…
Thanx a lot