User Tools

Site Tools


using_gphoto2_to_control_a_dslr_camera

This is an old revision of the document!


Remote Fire Camera via GPIO

June 2017

This page is work in progress, this message will be deleted when this page is complete!


Introduction


I am looking to buy a new DSLR camera body this year, and one of the grievances I have seen with the model I want, is that it only has a single card slot. Not a problem for me, but for some people who want backups of what they shoot, they see it as an issue (to be honest, most DSLRs have not had this feature, only in the last couple of years, and you never got this with film!)

Anyway, gphoto2 allows you to control your camera via the USB port, the amount of control you get varies between the make and model of camera that you are using.

You can use gphoto2 to take photos (great for making your own intervalometer, which we will try here, but you can also use gphoto2 to pull the images from your camera, and store them on a storage device attached to the Raspberry Pi, this is what I am really interested in.


Overview


For this guide I am using the following:

  • Raspberry Pi Zero
  • Raspbian (I am using Jessie, this should work on any version)
  • 8GB SD Card (will expand this when I am happy that gphoto2 does everything I need)
  • Canon 700D
  • Canon 5DMk2
  • USB type A to USB Mini A Cable (most devices now use the Mini B, like your mobile does, Canon uses the older type)


Now I generally shoot with 16GB cards, I don't see the point in using really large cards, if a card goes bad you can lose so much. So my aim is to use a 128GB storage device on my Raspberry Pi, and have the Raspberry Pi backup the cards periodically (as well as eventually having a manual button).

I do occasionally fill a 16GB card on a day out, but not very often. So having the ability to backup up to 8 cards is pretty good, and even if I was shooting a wedding, or doing some sports photography, I doubt I would fill more than two or three cards.


Topics

Live Capture

IMPORTANT! After failing to capture images, I discovered this little gem: gphoto2 is configured by default to capture files to your camera's RAM. You need to set it to capture to the SD Card.

Type in the following from the terminal.

  gphoto2 --get-config capturetarget


You will most likely get the following:

Label: Capture Target Type: RADIO Current: Internal RAM Choice: 0 Internal RAM Choice: 1 Memory card

Here we can see that the capture target is set to Current: Internal RAM and we want it to be Memory Card

Enter the following:

  gphoto2 --set-config capturetarget=1


Now when we check, we should get the following:
Label: Capture Target Type: RADIO Current: Memory card Choice: 0 Internal RAM Choice: 1 Memory card

Now we are set to record captures to the Memory Card

Now, this depends on your camera, and whether gphoto2 supports it on your model. To get the capabilities of your camera, use the following command:

  gphoto2 --summary


Now on my 700D, I see the following:

Camera summary:
Manufacturer: Canon Inc.
Model: Canon EOS 700D
  Version: 3-1.1.3
  Serial Number: 46ff2aa38fba41f88d84eccb8eba8ada
Vendor Extension ID: 0xb (1.0)

Capture Formats: JPEG
Display Formats: Association/Directory, Script, DPOF, MS AVI, MS Wave, JPEG, CRW, Unknown(b103), Unknown(bf02), Defined Type, Unknown(b104), Unknown(b105)

Device Capabilities:
        File Download, File Deletion, File Upload
        No Image Capture, No Open Capture, Canon EOS Capture, Canon EOS Shutter Button

Storage Devices Summary:
store_00020001:
        StorageDescription: SD
        VolumeLabel: None
        Storage Type: Removable RAM (memory card)
        Filesystemtype: Digital Camera Layout (DCIM)
        Access Capability: Read-Write
        Maximum Capability: 31678529536 (30211 MB)
        Free Space (Bytes): 31375130624 (29921 MB)
        Free Space (Images): -1

Device Property Summary:
Property 0xd402:(read only) (type=0xffff) 'Canon EOS 700D'
Property 0xd407:(read only) (type=0x6) 1
Property 0xd406:(readwrite) (type=0xffff) 'Unknown Initiator'
Property 0xd303:(read only) (type=0x2) 1
Battery Level(0x5001):(read only) (type=0x2) Enumeration [100,0,75,0,50] value: 100% (100)


Importantly, I see the following section:

Device Capabilities:

File Download, File Deletion, File Upload
No Image Capture, No Open Capture, Canon EOS Capture, Canon EOS Shutter Button

So my 700D does not allow gphoto2 to capture files. There are two methods that you can use to try, and they are:

  gphoto2 --capture-image
  
  gphoto2 --capture-image-and-download


gphoto2 –capture-image takes a photo and stores it on the SD card. gphoto2 –capture-image-and-download takes a photo and stores it on the SD card and downloads it.

On some cameras the takes a photo and stores it on the SD card takes the image, but does not store it on the SD card (like on my 700D) so you can use gphoto2 –capture-image-and-download and the camera will take the photo and gphoto2 will download it, but it will still not be store on the SD card (does not work on my 700D)

So in summary, I have been able to download files from my camera(s) but not capture from them. So I can make a decent backup solution using gphoto2, but not an intervalometer.

Cameras tested so far:

Canon EOS M (the original)
Canon EOS 550D
Canon EOS 700D
Canon EOS 5DMk2




gphoto2 Trigger Capture

using_gphoto2_to_control_a_dslr_camera.1498395222.txt.gz · Last modified: 2023/03/09 22:35 (external edit)