RICOH THETA API Over USB Cable - (S, V, SC models)



When you say, plug in USB, are you plugging the camera into a wall adapter, NOT your computer? I know the THETA won’t work with WiFi when plugged into a computer, but I didn’t know that the WiFi stopped working when plugged into a wall adapter.

Current Timelapse Test:

  • 7 hours continuous
  • 1109 pictures in single session
  • 4.1 Gig of data

I’m planning on stopping it soon in order to modify the code.


Appears NOT to lose the wifi connection if you plug it into a power plug.
It DOES lose connection if you plug it into your computer. Potentially this
means that you have a powered THETA S run through the smartphone app,
setting interval shooting, continuing for very long periods of time.


It would be interesting to test the WiFi API connection over long periods of time and also how to reset the WiFi connection if the WiFi connection is cut. I think this would be needed for industrial applications.

Also, does the THETA need to be in range of the smartphone for interval shooting? I think that there’s an internal setting for interval shooting and that the THETA can take interval shooting without WiFi. You would still need to download and delete the pictures in the THETA every 1,600 pictures.

For the sample USB timelapse app, we have it set to delete the picture on the camera after every shot. It downloads it to a local computer.

I am thinking of writing a program to then upload it to the RICOH Cloud and delete it from the local disk. Do you know if the RICOH Cloud has a storage limitation during the Beta period. I’d like to store about 50GB of 360 image data to start with, but might need more.

The other feature I need is to reset the USB port in the event of failure. I found several fascinating articles on this subject.


As part of this test, I took a small sample of about 440 pictures outside using the USB cable. Each picture is 5376 x 2688. My son then ran a test using Adobe Premier Pro with their new VR features to combine the 440 pictures into a 15 second clip. The resulting video should be viewed at 4K for test viewing.

The test also shows the use of Mettle SkyBox, a plugin for After Effects, to manipulate text in 360 videos. He’s using the trial version for the test and the logos are visible. As we’re not big 360/VR hobbyists, I don’t think we’ll pay the $99, but it was cool to test the placement.


The case for the touchscreen and Raspberry Pi came.

This is what is looks like:

This is the back with the Raspberry Pi exposed. There’s a cover for it to hide it. The Raspberry Pi on the left is shown with a CP2102 USB 2.0 to UART TTL serial adapter. This is a $5.44 (free shipping) part that allows the Raspberry Pi to be connected to any computer through the USB port, enabling the RPi to be programmed from the computer. Although the touchscreen is nice, it is expensive. I hope to get a Raspberry Pi Zero rigged with a cheaper interface to control the camera. In the meantime, I’m using the touchscreen interface to test the Raspberry Pi with the THETA.


Here’s a link to the CP2102 board.

There’s a cheaper version available as well. I paid $2 more for the testing lights. There’s one that is about $2.50.

Another shot of the device.


Using gphoto2 on a Raspberry Pi to control the RICOH THETA Over a USB Cable

I have gphoto2 working on the Raspberry Pi. This is installable with apt and is easier to use than ptpcam.

In the example below, I set the shutter chirp to 30% of sound volume and then verify that the setting in correct.

pi@raspberrypi ~/Development/libptp2-1.2.0 $ gphoto2 --set-config=502c=30
pi@raspberrypi ~/Development/libptp2-1.2.0 $ gphoto2 --get-config=502c
Label: PTP Property 0x502c
Type: MENU
Current: 30
Choice: 0 0

In the next example, I download three files to my local disk

pi@raspberrypi ~/Development/gphoto2 $ gphoto2 --get-file 1-3
Downloading 'R0011757.JPG' from folder '/store_00010001/DCIM/100RICOH'...
Saving file as R0011757.JPG
Downloading 'R0011758.JPG' from folder '/store_00010001/DCIM/100RICOH'...
Saving file as R0011758.JPG
Downloading 'R0011759.JPG' from folder '/store_00010001/DCIM/100RICOH'...
Saving file as R0011759.JPG
pi@raspberrypi ~/Development/gphoto2 $

Download thumbnails

pi@raspberrypi ~/Development/gphoto2 $ gphoto2 --get-thumbnail 4-6
Downloading 'R0011761.JPG' from folder '/store_00010001/DCIM/100RICOH'...
Saving file as thumb_R0011761.jpg
Downloading 'R0011763.JPG' from folder '/store_00010001/DCIM/100RICOH'...
Saving file as thumb_R0011763.jpg
Downloading 'R0011764.JPG' from folder '/store_00010001/DCIM/100RICOH'...
Saving file as thumb_R0011764.jpg
pi@raspberrypi ~/Development/gphoto2 $

Components I Used

  • Raspian Jessie
  • gphoto2
  • Raspberry Pi 2
  • THETA plugged into Raspberry Pi with USB cable


Showing installed gphoto2 version with apt-cache

pi@raspberrypi ~ $ apt-cache show gphoto2
Package: gphoto2
Version: 2.5.4-1
Architecture: armhf
Maintainer: Debian PhotoTools Maintainers <pkg-phototools-devel@lists.alioth.deb>
Installed-Size: 802
Depends: libaa1 (>= 1.4p5), libc6 (>= 2.4), libcdk5, libexif12, libgphoto2-6 (>= 2.5.2), libgphoto2-port10 (>= 2.5.2), libjpeg8 (>= 8c), libncurses5 (>= 5.5-5~) , libpopt0 (>= 1.14), libreadline6 (>= 6.0)
Suggests: gtkam, gthumb
Priority: extra
Section: utils
Filename: pool/main/g/gphoto2/gphoto2_2.5.4-1_armhf.deb
Size: 169204
SHA256: 71baeac776e762229ad31c550a493a82a8fd5f2a435dd65a674d0030d14f8991
SHA1: 7018ffe0a8432ffcfbb08887f27b2ae22224b2fd
MD5sum: a522290cef04bf1cf7c6cdb4d0cf37d5
Description: digital camera command-line client
The gphoto2 library can be used by applications to access various
digital camera models, via standard protocols such as USB Mass Storage
and PTP, or vendor-specific protocols.
This package provide the gphoto2 command-line frontend.

Showing installed OS on Raspberry Pi

pi@raspberrypi ~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION="8 (jessie)"


Right now, I get this error when I first step the Raspberry Pi. I haven’t bothered to disable gvfs-gphoto2-volume-monitor at boot yet. I’ll figure this out in the future.

pi@raspberrypi ~ $ gphoto2 --about

*** Error ***
An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (Device or resource busy). Make sure no other program (gvfs-gphoto2-volume-monitor) or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device.
*** Error (-53: 'Could not claim the USB device') ***

It looks like I can prevent the daemon in /usr/lib/gvfs/gvfsd to run. In the meantime, I’m going to kill the processes before I start the tests.

You can find the process to kill with ps aux |grep gvfs

I also killed the spawner. In my test this morning, I needed to kill this in addition to gvfs-gphoto2-volume-monitor

Test it

pi@raspberrypi ~ $ gphoto2 --about
About the camera driver:
PTP2 driver
(c) 2001-2005 by Mariusz Woloszyn <>.
(c) 2003-2014 by Marcus Meissner <>.
This driver supports cameras that support PTP or PictBridge(tm), and
Media Players that support the Media Transfer Protocol (MTP).


Remove gvfs-gphoto2-volume-monitor

As I do not plan to mount the THETA as a storage device from the Raspberry Pi, I removed gvfs virtual filesystem.

Remove gvfs-backends

pi@raspberrypi ~ $ sudo apt remove gvfs-backends
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:

Test to make sure it still works.

pi@raspberrypi ~ $ gphoto2 -l
There is 1 folder in folder '/'.                                               
 - store_00010001
There is 1 folder in folder '/store_00010001'.


gphoto2 now works after reboot without having to kill the processes.

pi@raspberrypi ~ $ gphoto2 -l
There is 1 folder in folder '/'.                                               
 - store_00010001
There is 1 folder in folder '/store_00010001'.
There is 1 folder in folder '/store_00010001/DCIM'.
 - 100RICOH
There are 0 folders in folder '/store_00010001/DCIM/100RICOH'.

Ricoh theta usb cable

@orikoon verified that video control for start and stop works with the USB API on Ubuntu 14.10 using libptp2 1.2.0.


Great example of using the USB API by @khufkens


The photosphere project combines a Rico Theta S and a raspberry pi with a custom outdoor housing into a rugged 360 (outdoor) time-lapse camera. In my application I track changes in leaf development in a North-Eastern US forest. You can visit the project website at However, other applications are possible (hints on how to do nighttime images through the USB API are welcome).

The housing is made of standard PVC fittings, sitting on top of a garden fence post. The optics are covered by a glass lamp shade to provide optimal transmission and limited deformation (acrylic globes can be used as well). The only custom part is the plate on which the camera is mount using 1/4" steel thread. This plate is cut out of 3mm acrylic plastic. A vertical support also holds the raspberry pi to keep things tidy (see cad files). I use two 3mm plates extra rigidity (glued together). You can also use a 6mm top plate and a 3mm vertical plate. The inside of the “lens cover” is spray painted matte black to limit reflections.

Constructed and placed in the forest the camera looks like a garden lamp (see figure). Here the blue wire is the ethernet cable which runs to a nearby hub, and serves as the internet and power connection. The yellow wire is the ground wire for the surge protector, to protect the camera from voltage spikes due to nearby lightning strikes.


To install the software clone the project onto a raspberry pi and run the install script.

git clone

You will have to edit the crontab manually to add the server argument (for now).

Parts List

I assume that common items such as screws and glue (pvc, silicone) are available to makers.

Item Price ($)
Ricoh Theta S $350
Raspberry pi 2 $36
6-60V - 5V 3A UBEC $19
24V POE injector $10
APC surge protector $18
200ft / 50m Cat5e cable $13
8" glass globe lamp cover $35
4" (10cm) PVC pipe $20
4" (10cm) PVC coupler $2.5
3.5" Wooden Fence post $5
36" ground anchor $30
3mm Plexiglass sheet $5
1/4" stainless steel rod $1
1/4" (coupling) nuts $1
1/4" washers $1
TOTAL ~$550

NOTE: Information below added by theta360developers

Information on the WiFi and USB APIs is available in the Unofficial API Guide.

Discussion for this project is available on the site.

Theta S now shuts down when plugged in. :/
Sept 27 Meetup - RICOH THETA 360° Integration in Products, Photosphere Navigation, and 360° Video on Drones!

There is more discussion and links to other blogs in the topic below.


To simplify things I’ve written a script that will convert shutter speeds to the hex format needed for ptpcam -R. Here’s an example.

$ ./ -s 0.25
HEX Shutter speed: \x01\x00\x00\x00\x04\x00\x00\x00

Or send the output to a bin file for ptpcam.

$ ./ -s 0.25 -b shutter.bin
$ ptpcam -R 0x1016,0xd00f,0,0,0,0,shutter.bin


This is awesome. Thank you.

November featured developer!


Thank you for this great tutorial.
Maybe I’ve missed something, but how did you solve the problem that ptpcam cannot find the device?
I’ve followed your steps, and now I am able to find the device using gphoto2 --auto-detect, and execute the command gphoto2 -L -f /store_00010001/DCIM/100RICOH and get the list of files. But I cannot capture an image using the gphoto2 --capture-image command. Nor can I get the device info using ptpcam -i.
Another question is, how do you connect the camera to your computer? I tried connect it via usb, but the blue light automatically turned off. Am I supposed to connect it in live stream mode?


The blue light needs to be on. The camera should be in image or video mode not streaming. Your computer may be auto-mounting the camera. Unmounted the camera and try the test. What OS version are you using?

Remove gvfs-backend from your system.


It’s running Ubuntu 16.04, and it does auto-mount the camera.
However, I tried unmount and remove gvfs-backends. It’s still not working.
Only the power led is on, red. Perhaps it has something to do with the usb port?


The light should be blue. There are pictures of what the camera needs to look like if you scroll up in this thread. I’m not in front of my computer now. Did you try plugging the theta in when it is off then turning it on to image mode while it is plugged in? I can try to replicate this problem tomorrow. Most people are using Ubuntu or raspian. I think you’ll get it working once you overcome the connection problem.


Turn the THETA on and then connect it.

Here is the THETA connected to Ubuntu 16.10. The front blue dot and the camera icon are blue.

The side button is red.

craig@linux-cube:~$ lsusb
Bus 002 Device 002: ID 8087:8000 Intel Corp. 
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 003: ID 05ca:0366 Ricoh Co., Ltd 

Detect Device with gphoto2

craig@linux-cube:~$ gphoto2 --auto-detect
Model                          Port                                            
USB PTP Class Camera           usb:003,003 

Taking Picture with gphoto2

craig@linux-cube:~$ gphoto2 --capture-image
New file is in location /store_00010001/DCIM/100RICOH/R0011887.JPG on the camera

Download All Images and Videos

craig@linux-cube:~$ gphoto2 -P
Saving file as R0011758.JPG                                                    
Saving file as R0011759.JPG                                                    
Saving file as R0011761.JPG                                                    
Saving file as R0011763.JPG                                                    
Saving file as R0011764.JPG                                                    
Saving file as R0011765.JPG                                                    
Saving file as R0011766.JPG                                                    
Saving file as R0011767.JPG                                                    
Saving file as R0011768.MP4                                                    
Saving file as R0011771.JPG                                                    
Saving file as R0011772.JPG                                                    
Saving file as R0011773.JPG                                                    
Saving file as R0011774.JPG  

Take Picture, Download to Ubuntu, Delete from Camera

craig@linux-cube:~/Development/ricoh/usb-api$ gphoto2 --capture-image-and-download
New file is in location /store_00010001/DCIM/100RICOH/R0011888.JPG on the camera
Saving file as R0011888.JPG                                                    
Deleting file /store_00010001/DCIM/100RICOH/R0011888.JPG on the camera

List Files and Folders on THETA

craig@linux-cube:~/Development/ricoh/usb-api$ gphoto2 --list-files
There is no file in folder '/'.                                                
There is no file in folder '/store_00010001'.
There is no file in folder '/store_00010001/DCIM'.
There are 114 files in folder '/store_00010001/DCIM/100RICOH'.
#1     R0011758.JPG               rd  3904 KB 5376x2688 image/jpeg
#2     R0011759.JPG               rd  3956 KB 5376x2688 image/jpeg
#3     R0011761.JPG               rd  3869 KB 5376x2688 image/jpeg
#4     R0011763.JPG               rd  3903 KB 5376x2688 image/jpeg
#5     R0011764.JPG               rd  3939 KB 5376x2688 image/jpeg
#6     R0011765.JPG               rd  3829 KB 5376x2688 image/jpeg
#7     R0011766.JPG               rd  3858 KB 5376x2688 image/jpeg
#8     R0011767.JPG               rd  3885 KB 5376x2688 image/jpeg
#9     R0011768.MP4               rd 50123 KB 1920x1080 video/mp4

Check Battery Level of THETA

craig@linux-cube:~/Development/ricoh/usb-api$ gphoto2 --get-config=batterylevel
Label: Battery Level                                                           
Type: TEXT
Current: 67%

Check whitebalance of THETA

craig@linux-cube:~/Development/ricoh/usb-api$ gphoto2 --get-config=whitebalance

Label: WhiteBalance                                                            
Current: Automatic
Choice: 0 Automatic
Choice: 1 Daylight
Choice: 2 Unknown value 8001
Choice: 3 Unknown value 8002
Choice: 4 Tungsten
Choice: 5 Unknown value 8020
Choice: 6 Unknown value 8003
Choice: 7 Unknown value 8004
Choice: 8 Unknown value 8005
Choice: 9 Unknown value 8006
Choice: 10 Unknown value 8007

Get Capture Mode

craig@linux-cube:~/Development/ricoh/usb-api$ gphoto2 --get-config=capturemode
Label: Still Capture Mode                                                      
Current: Single Shot
Choice: 0 Single Shot
Choice: 1 Timelapse
Choice: 2 Unknown value 8002
Choice: 3 Unknown value 8003
Choice: 4 Unknown value 8004

Set Capture Mode to Timelapse

craig@linux-cube:~/Development/ricoh/usb-api$ gphoto2 --set-config capturemode=1
craig@linux-cube:~/Development/ricoh/usb-api$ gphoto2 --get-config capturemode
Label: Still Capture Mode                                                      
Current: Timelapse
Choice: 0 Single Shot
Choice: 1 Timelapse
Choice: 2 Unknown value 8002

Show Info on Specific Image

craig@linux-cube:~/Development/ricoh/usb-api$ gphoto2 --show-info 2

Information on file 'R0011759.JPG' (folder '/store_00010001/DCIM/100RICOH'):   
  Mime type:   'image/jpeg'
  Size:        4050247 byte(s)
  Width:       5376 pixel(s)
  Height:      2688 pixel(s)
  Permissions: read/delete
  Time:        Tue Jul 12 18:45:49 2016
  Mime type:   'image/jpeg'
  Size:        3258 byte(s)
  Width:       160 pixel(s)
  Height:      120 pixel(s)
Audio data:
  None available.


Thank you.
It turns out the problem is an outdated firmware. After upgrading, I can now run the gphoto2 commands you have listed, although ptpcam is still not able to connect to the camera.


Great news!!

Thank you for sharing your solution. I forgot to mention that the camera firmware needs to be 01.42 or above. This information will help other people as well.

Additional information for people that need to upgrade firmware:

Regarding ptpcam, I need to jump on some other work right now and can’t fully test it today as the original test configuration I used is on a different machine and I’ll need to compile ptpcam on the machine I used for the gphoto2 test. I had ptpcam working reliably on different Ubuntu test machines and on a Raspberry Pi several months ago.

Here’s one tip.

Community member @orikoon supplied this information:

I'm using Ubuntu 14.10 and libptp2 1.2.0. Actually, my project does not use the video features but I tested the following command and it worked nicely.

First, To set video mode :

ptpcam --set-property=0x5013 --val=0x8002
And start shooting :

ptpcam -R 0x101C
Finally, stop shooting :

ptpcam -R 0x1018,0xFFFFFFFF
I hope this may help you!

I’ve used ptpcam on 16.04, but if you’re having problems, you may want to use ubuntu 14.04 or 14.10 (which is the exact configuration that Orikoon was using) on a test machine.


Hi all, I’m currently running the ricoh S in interval mode plugged into a large USB battery pack, but it seems to turn off on its own randomly between 4 and 8 hours. It never runs out of battery or space for images, so I’m wondering if it’s over heating or something. It sounds like several people have had luck with longer term recording with the Pi. thanks!


There are two very good long-term usage examples with the USB API.

Photosphere by Koen Hufkens has been going for months (I think)

tlapser by Jason Charcalla has been well-tested.

I you want to have it running for months to take several hundred thousand or more pictures, note that there is a problem with unattended remote locations. The USB API does not support turning on the RICOH THETA S. Thus, if there is a power outage, you’ll have to drive to the remote location and turn the camera on. We’ve submitted this feature request to RICOH so that the camera can be used for remote surveillance and image data acquisition.

I’m surprised that the camera turns off after 4 to 8 hours when you have it plugged into the battery. Do you have a battery that is outputting 1.5 amps? You may be able to stabilize the camera by using a battery with higher amperage output. You can test this theory before you spend any money by plugging the camera into a wall charger (like your phone or tablet or kindle charger) that is capable of putting out 1.5 amps and see if the camera turns off overnight. I suspect that the battery you are using is not sufficient enough to keep the battery charged.

I’m interested to learn more about your usage.

If you go with the USB route (which is what I would do), suggest you read through the thread and consider running an earlier version if you have problems with libptp.

I did my tests with both a raspberry pi running Jessie and an Ubuntu laptop. I ran into a problem with stopping video. Another community member mentioned that they had the video stop working with Ubuntu 14.04. That’s the reason I was thinking of testing Wheezy (older version of Raspian). The raspian archive is here