1

I bought a Raspberry Pi camera (https://www.raspberrypi.org/products/camera-module/) and it works great.

My problem is that there's no way to build a good-looking device with that camera. I've seen camera cases but the wire is uncovered and it's ugly (If anybody knows a good-looking, cheap solution, nice ... but my question here is about other cameras)

So I've been working with standard USB cameras.

I've done a complete update/upgrade:

sudo rpi-update
sudo apt-get update
sudo apt-get upgrade

I've change some params as other forums suggested, to change config.txt and add

start_file=start_x.elf
fixup_file=fixup_x.dat

and check gpu_mem is above 128 (mine is 256)

But when I plug the camera (and the camera works because I've tested in PC computers) and I try to access it, it does not work:

pi@raspberrypi ~ $ raspistill -o /tmp/a.jpg
mmal: mmal_vc_component_create: failed to create component 'vc.ril.camera' (1:ENOMEM)
mmal: mmal_component_create_core: could not create component 'vc.ril.camera' (1)
mmal: Failed to create camera component
mmal: main: Failed to create camera component
mmal: Camera is not detected. Please check carefully the camera module is installed correctly

the camera is not detected

pi@raspberrypi ~ $ vcgencmd get_camera
supported=1 detected=0

but it's there !

pi@raspberrypi ~ $ lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 004: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
Bus 001 Device 005: ID 0c45:612a Microdia PC Camera (SN9C325)             << THIS ONE !
Bus 001 Device 006: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter

I've tried also unplugging the raspberry Pi camera on board, and leave just my USB camera, changing settings in raspi-config of board camera to on and off ...

Also I've tried with 4 different USB cameras (all working in PC's) ... Trust, Logitech, ...

Question 1: what is the problem ?

In a page says: "Is your power supply sufficient? The camera adds about 200-250mA to the power requirements of your Raspberry Pi."

Question 2 : How can I measure this ? How can I know what is my power (I got a B+), and how much power each one of the USB ports are consuming ?

5
  • What does elinux.org/RPi_USB_Webcams say about the cameras you are using?
    – joan
    Aug 19, 2015 at 15:55
  • They are not listed there :-(
    – FlamingMoe
    Aug 19, 2015 at 16:10
  • That's a pity. They can't be very popular.
    – joan
    Aug 19, 2015 at 16:23
  • The command you're using (raspistill) is specifically for the Raspberry Pi's camera module (same for raspivid, raspiyuv, and the picamera library) - they won't work with USB cameras. For those you can usually use standard V4L2 interfaces or higher level things like OpenCV (you can use these with the Pi's camera module too with the V4L2 driver)
    – Dave Jones
    Aug 19, 2015 at 21:08
  • On the subject of cases which neatly enclose the camera: have a look at the Nwazet case and the Proto-armour case. The former is cheaper (but still functional) while the latter is much more heavy duty and includes a standard tripod mounting plate.
    – Dave Jones
    Aug 19, 2015 at 21:09

3 Answers 3

2

as @DaveJones said, the raspistill command is only for cameras plugged in via the header on the rpi board. for standard usb camera, you can either use opencv or python pygame. your best option, though would be to use the fswebcam package, which you can install with:

sudo apt-get install fswebcam

you can then take a picture with

fswebcam /tmp/a.jpg

more info here.

3
  • I am new with python, I have some code that uses picamera: with picamera.PiCamera(resolution=(640, 480), framerate=30) as camera: You think I can use python pygame instead?
    – Shilan
    Aug 26, 2020 at 20:11
  • I’m sorry, this post is about webcams not picamera. I would suggest looking at some picamera python examples to make sure you’re using all the necessary code and commands Aug 26, 2020 at 21:33
  • Thanks for your reply. But that’s exactly what I meant. I have a snippet code written for picamera, however I have a usb camera, that should use pygame.
    – Shilan
    Aug 28, 2020 at 8:24
1

Using OpenCV to access any Webcam

Using any USB video device (webcam) on a Pi you can use OpenCV to take pictures or video etc. In OpenCV, you can connect as many USB cameras as you want, and reference them by 'index', from 0 -> n'th camera.

For my example: `

import cv2
cam = cv2.VideoCapture(0) # This is your first video camera at index'zero'
s, img = cam.read()
picName = 'pic.png'
cv2.imwrite(picName, img)`

VideoCapture is nice and general, and works with videos, webcams and image files.

Note on what wasn't working:

User @Dave Jones comment is correct for explaining your problem -

The command you're using (raspistill) is specifically for the Raspberry Pi's camera module (same for raspivid, raspiyuv, and the picamera library) - they won't work with USB cameras. For those you can usually use standard V4L2 interfaces or higher level things like OpenCV (you can use these with the Pi's camera module too with the V4L2 driver) – Dave Jones

0

I've successfully used 'motion' https://motion-project.github.io/ which is nicely packaged in many distributions.

Right now its running on a pi2 reading a logitech camera at work, while I'm at home on C19 lockdown. I don't own a pi-cam though

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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