Is there a terminal command or other way to compltely turn off a Raspberry Pi camera?

2

I have a Raspberry Pi camera and use my Raspberry Pi a lot, but the camera has a tendency to overheat. Is there a terminal command to turn off the camera and to turn it back on when I need it?

It is not controlled via USB, but the CSI camera connector.

Jacob

Posted 2015-12-05T22:13:58.077

Reputation: 31

3

You may be more likley to get an answer at http://raspberrypi.stackexchange.com/

– DavidPostill – 2015-12-05T22:20:00.067

1Which model Raspberry Pi? – Ben Voigt – 2015-12-06T20:20:33.657

@BenVoigt I am using the RPi 2 Model B V1.1 – Jacob – 2015-12-06T21:17:16.253

Based on the schematic the power pin for the camera connector is not switched, nor is there any reset pin. So you're looking for some software reset function through the Broadcom-proprietary driver stack.

– Ben Voigt – 2015-12-06T21:22:21.173

Answers

3

The RPI does not have a PCI bus, so we cannot use the standard Linux command to turn off the onboard camera. Just for the sake of completeness, I will show you how to do both things, in a RPI an in a normal pc.

RPI

The RPI camera can be turned off at boot. There's a file, /boot/config.txt, where you will need this setting:

start_x=0             

while setting start_x=1 turns it on.

If you want to do this on the run, you may try (I do not have one to try this on) the following at a pyhton prompt:

 import picamera
 from time import sleep
 sleep(500)

and see whether this actually solves your overheating problem. Of course, you will need to have installed

  sudo apt-get install python-picamera

Pc with PCI bus

The command is

 echo 0 > /sys/bus/usb/devices/1-1.3/bConfigurationValue

to turn it off, and of course echo 1 > ... to turn it on again. The only problem is that the bus address 1-1.3 is correct for my pc. You find your address by looking at the output of

 # lsusb -t 
  ...............
  :  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M                                                                                                                                                                                                             
     |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M                                                                                                                                                                                                                    
     |__ Port 2: Dev 4, If 0, Class=Wireless, Driver=btusb, 12M                                                                                                                                                                                                             
     |__ Port 2: Dev 4, If 1, Class=Wireless, Driver=btusb, 12M                                                                                                                                                                                                             
     |__ Port 3: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M                                                                                                                                                                                                            
     |__ Port 3: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M  

You see in this output a Class=Video object, located at Bus 1, dev 3. Now you can go to

 # cd /sys/bus/usb/devices/; ls 
 1-0:1.0  1-1.2      1-1.3      2-0:1.0  2-1.5      2-1.6:1.0   2-1.6:1.2  2-1.6:1.5  2-1.6:1.8  3-2      3-3:1.0  4-0:1.0  usb3

The only 1-3 device is 1-1.3. You enter the directory and double check that this is your video cam by

# cat id{Vendor,Product}
   1bcf
   288e

which you can compare with the output of

 # lsusb 
  ................
  Bus 001 Device 003: ID 1bcf:288e Sunplus Innovation Technology Inc. 

A Google search shows that 1bcf is indeed a VideoCam. 1-1.3 is the code to insert in the command above.

MariusMatutiae

Posted 2015-12-05T22:13:58.077

Reputation: 41 321

2What if this isn't a USB device, but instead attached by a ribbon cable? – Jacob – 2015-12-06T19:55:32.047

@MariusMatutiae why do I need to import picamera to use sleep(500)? Is there anything missing in your python code? – AtomHeartFather – 2017-01-21T21:34:53.193