I need to know how to remotely detect whether an 8mp or a 5mp camera module is connected to the rpi for implementation in an embedded project.

Any help?


None of the above.

Take advantage of the v4l driver (modprobe bcm2835-v4l2), and either use the v4l2-ctl command from the CLI, or, if you want to get fancy, use the v4l2 libraries from python or C:

# v4l2-ctl --list-formats
        Index       : 0
        Type        : Video Capture
        Pixel Format: 'YU12'
        Name        : Planar YUV 4:2:0

(much more output)

# v4l2-ctl --list-framesizes=YU12
        Size: Stepwise 16x16 - 2592x1944 with step 2/2
  • The actual question is apparently how can I get V412-ctl? With me it just says "no such file or directory". "Unable to locate package v412-ct" Without this information the answer is incomplete. – Albert van der Horst Mar 17 at 16:36

None of the above worked for me. With Raspbian Stretch (June 2018 Version, Kernel 4.14), Python 3.5 and picamera 1.13 I used:

import picamera

with picamera.PiCamera() as cam:

If you're happy coding C, have a look at the relevant lines in raspistill which uses the new MMAL_PARAMETER_CAMERA_INFO to look up the type of camera attached.

If you're not so happy with C, you'll need to wait a week or so while I finish off picamera 1.11 which will have a new PiCamera.model parameter you can query for the same information (this will return a string containing the sensor name as returned by MMAL_PARAMETER_CAMERA_INFO).

Update As EdMc2's answer neatly shows, I wound up calling this PiCamera.revision rather than model!

  • Thanks for the update! This post shows up first in a search for 'picamera get model' so I'm grateful for the breadcrumbs – Mike McCabe Sep 25 '18 at 18:45

EdMc2's answer worked for me--but cam.revision only display camera sensor name. So I did find maximum resolution like this:

import picamera

with picamera.PiCamera() as cam:

You can save the file (for example, picamera.py) and execute it like this:

python3 picamera.py

My result is 2592x1944 which is 5MP camera.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.