Page 1 of 1

Camera module not recognised by raspberry pi

Posted: Sat Sep 24, 2016 1:28 pm
by jamesfutcher
I am trying to set up my Raspberry Pi camera module on my raspberry pi (c) 2011.12. I am first of all trying to get my pi to display me a preview of the camera image using python 3. I am following the tutorial on this page: https://www.raspberrypi.org/learning/ge ... worksheet/ And the code I am using is:

Code: Select all

from picamera import PiCamera
from time import sleep

camera = PiCamera()

camera.start_preview()
sleep(10)
camera.stop_preview()
When I run it the shell gives me this error:

Code: Select all

Traceback (most recent call last):
  File "/home/pi/Desktop/camera.py", line 4, in <module>
    camera = PiCamera()
  File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 488, in __init__
    self.STEREO_MODES[stereo_mode], stereo_decimate)
  File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 526, in _init_camera
    "Camera is not enabled. Try running 'sudo raspi-config' "
PiCameraError: Camera is not enabled. Try running 'sudo raspi-config' and ensure that the camera has been enabled.
I have tried running 'sudo raspi-config' and enabling the camera as well as enabling it in the the preferences menu, I rebooted the pi and tried it all again but it still gave me the same error!
Any help on this would be great!

Re: Camera module not recognised by raspberry pi

Posted: Sat Sep 24, 2016 4:59 pm
by DougieLawson

Re: Camera module not recognised by raspberry pi

Posted: Sat Sep 24, 2016 6:44 pm
by 6by9
DougieLawson wrote:viewtopic.php?f=43&t=160611
That link is only applicable to Pi Zero, although the OP doesn't say exactly which board revision he has ( (c) 2011.12 implies an early board - my PiZero1.3 certainly has (c)2015 on it).

Try "vcgencmd get_camera". If supported is not 1 then you haven't enabled the camera. If detected isn't 1 then the GPU can't talk to the camera, so check and double check all connections.
I'd also recommend trying to use raspistill or raspivid for basic tests instead of your own otherwise untested Python app.

Re: Camera module not recognised by raspberry pi

Posted: Sat Sep 24, 2016 8:20 pm
by jamesfutcher
6by9 wrote:
DougieLawson wrote:viewtopic.php?f=43&t=160611
That link is only applicable to Pi Zero, although the OP doesn't say exactly which board revision he has ( (c) 2011.12 implies an early board - my PiZero1.3 certainly has (c)2015 on it).

Try "vcgencmd get_camera". If supported is not 1 then you haven't enabled the camera. If detected isn't 1 then the GPU can't talk to the camera, so check and double check all connections.
I'd also recommend trying to use raspistill or raspivid for basic tests instead of your own otherwise untested Python app.
Where abouts would I enter this line of code in my python program? I am a bit of an amateur :)

Re: Camera module not recognised by raspberry pi

Posted: Sat Sep 24, 2016 8:24 pm
by rpdom
jamesfutcher wrote:
6by9 wrote:Try "vcgencmd get_camera". If supported is not 1 then you haven't enabled the camera. If detected isn't 1 then the GPU can't talk to the camera, so check and double check all connections.
I'd also recommend trying to use raspistill or raspivid for basic tests instead of your own otherwise untested Python app.
Where abouts would I enter this line of code in my python program? I am a bit of an amateur :)
You don't put that line in your Python program.

You type it in at the command line (LX Terminal) prompt, and then copy/paste the output into you next reply.

Re: Camera module not recognised by raspberry pi

Posted: Sun Sep 25, 2016 6:45 am
by jamesfutcher
I have tried typing 'vcgencmd get_camera' and it gave me this:

supported=1 detected=2

I also have gone back and rechecked all the connections and rebooted the pi! Will have a look at raspistill and raspivid as well though...........

Re: Camera module not recognised by raspberry pi

Posted: Sun Sep 25, 2016 7:01 am
by MaggPi
I was able to get my camera to work with raspistill then when I tried the following Python code (similar to yours)
-----------------------
from picamera import PiCamera
from time import sleep

camera = PiCamera()

camera.start_preview()
sleep(10)
camera.stop_preview()
-------------------------
I get a very similar traceback error to yours( see below) , did you resolve your camera problem? I have tried the debugging steps listed above and none work. THx
-----------------------------------
Traceback (most recent call last):
File "/home/pi/cameratest.py", line 4, in <module>
camera = PiCamera()
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 488, in __init__
self.STEREO_MODES[stereo_mode], stereo_decimate)
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 620, in _init_camera
prefix="Camera component couldn't be enabled")
File "/usr/lib/python3/dist-packages/picamera/exc.py", line 191, in mmal_check
raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Camera component couldn't be enabled: Out of resources (other than memory)
>>>

Re: Camera module not recognised by raspberry pi

Posted: Sun Sep 25, 2016 7:53 am
by 6by9
Something is very wrong if it has detected more than are supported. At a guess you've got a very old firmware revision. Try downloading the latest Raspbian image and trying again.

Re: Camera module not recognised by raspberry pi

Posted: Sun Sep 25, 2016 8:03 am
by jamesfutcher
I have recently just reset my raspberry pi last wednesday and installed the latest edition on Raspbian OS!

Re: Camera module not recognised by raspberry pi

Posted: Sun Sep 25, 2016 8:35 am
by 6by9
"vcgencmd version" then to confirm.

I'm not aware of a way for detected to be greater than supported, so you've certainly found a quirky one.