neptune3nl
Posts: 2
Joined: Sun Nov 24, 2013 5:58 pm

Logitech USB Webcam

Sun Nov 24, 2013 6:07 pm

hi there,

I am considering buying the official RPi camera module but then I realized,
I got 2 Logitech USB webcams. I connect either of them to one of the USB ports of the RPi.
One is an old model from the 90's. The other is a Quickcam from 2009.
I updated the firmware and did apt-get update and apt-get upgrade.
I also enabled the camera in raspi-config.
lsusb recognizes them. However, when I want to capture an image with raspistill -v -o test.jpg, it says:

mmal_vc_component_create:failed to create component 'vc-ril.camera' (1:ENOMEM)
mmal_component_create_core: could not create component 'vc.ril.camera' (1)
Failed to create camera component
main: Failed to create camera component
Camera is not detected. Please check carefully the camera module is installed correctly.

Any ideas?
Should I connect the camera to a powered USB-hub?
Many thanks in advance for your help.
Kind regards,

User avatar
DougieLawson
Posts: 35381
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Logitech USB Webcam

Sun Nov 24, 2013 11:44 pm

You need to update motion-mmal.config to stop it trying to use the RPi camera and get it to use /dev/video0.

Code: Select all

--- mmal-bits/motion-mmalcam.conf	2013-07-24 08:12:54.000000000 +0100
+++ mmal-bits~/motion-mmalcam.conf	2013-11-24 16:16:03.974725000 +0000
@@ -17,7 +17,7 @@
 
 
 # Use a file to save logs messages, if not defined stderr and syslog is used. (default: not defined)
-logfile /home/pi/mmal/motion.log
+logfile /home/pi/motion.log
 
 # Level of log messages [1..9] (EMR, ALR, CRT, ERR, WRN, NTC, INF, DBG, ALL). (default: 6 / NTC)
 log_level 5
@@ -31,7 +31,7 @@
 
 # Videodevice to be used for capturing  (default /dev/video0)
 # for FreeBSD default is /dev/bktr0
-#videodevice /dev/video0
+videodevice /dev/video0
 
 # v4l2_palette allows to choose preferable palette to be use by motion
 # to capture from those supported by your videodevice. (default: 17)
@@ -82,10 +82,10 @@
 rotate 0
 
 # Image width (pixels). Valid range: Camera dependent, default: 352
-width 640
+width 1024
 
 # Image height (pixels). Valid range: Camera dependent, default: 288
-height 480
+height 576
 
 # Maximum number of frames to be captured per second.
 # Valid range: 2-100. Default: 100 (almost no limit).
@@ -152,7 +152,7 @@
 ############################################################
 # OpenMax/MMAL camera support for Raspberry Pi
 ############################################################
-mmalcam_name vc.ril.camera
+#mmalcam_name vc.ril.camera
 #mmalcam_control_params
 #mmalcam_raw_capture_file /home/pi/motion-mmal.capture
 
@@ -262,7 +262,7 @@
 # Picture with most motion of an event is saved when set to 'best'.
 # Picture with motion nearest center of picture is saved when set to 'center'.
 # Can be used as preview shot for the corresponding movie.
-output_pictures off
+output_pictures on
 
 # Output pictures with only the pixels moving object (ghost images) (default: off)
 output_debug_pictures off
@@ -390,7 +390,7 @@
 # Draw a user defined text on the images using same options as C function strftime(3)
 # Default: Not defined = no text
 # Text is placed in lower left corner
-; text_left PiCam %t
+; text_left CAMERA %t
 
 # Draw the number of changed pixed on the images (default: off)
 # Will normally be set to off except when you setup and adjust the motion settings
@@ -430,7 +430,7 @@
 
 # Target base directory for pictures and films
 # Recommended to use absolute path. (Default: current working directory)
-target_dir /home/pi/m-video
+target_dir /srv/www/httpi/pics
 
 # File path for snapshots (jpeg or ppm) relative to target_dir
 # Default: %v-%Y%m%d%H%M%S-snapshot
@@ -512,7 +512,7 @@
 ############################################################
 
 # TCP/IP port for the http server to listen on (default: 0 = disabled)
-webcontrol_port 8080
+webcontrol_port 8880
 
 # Restrict control connections to localhost only (default: on)
 webcontrol_localhost on
You WILL need to use a powered hub, I crashed my RPi trying a webcam (got about 20 pictures captured then it died).
Note: Having anything remotely humorous in your signature is completely banned on this forum.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: Logitech USB Webcam

Sun Nov 24, 2013 11:50 pm

My Pro 5000 works quite nicely on the Pi without a powered hub.
I'm not sure if raspistill is designed to work with USB webcams you might need something like fswebcam to capture images instead.

Richard S.

gordon77
Posts: 4003
Joined: Sun Aug 05, 2012 3:12 pm

Re: Logitech USB Webcam

Mon Nov 25, 2013 4:54 am

You don't need to enable the USB camera in config, and raspistill won't work with USB cameras, both are for the pi camera only.

Try something like fswebcam to see if the camera works or in python try this code

Code: Select all

import pygame, sys
from pygame.locals import *
import pygame.camera
pygame.init()
pygame.camera.init()
cam = pygame.camera.Camera("/dev/video0",(352,288))
cam.start()
image= cam.get_image()
pygame.image.save(image,'101.bmp')
cam.stop()
Try changing the 352,288 to larger numbers eg 640,480 if it works

Or this to display as well

Code: Select all

#!/usr/bin/python
import pygame, sys
from pygame.locals import *
import pygame.camera
import time

pygame.init()
pygame.camera.init

count = 0
while count < 10:
   width = 640
   height = 480
   cam = pygame.camera.Camera("/dev/video0",(width,height))
   cam.start()
   pygame.display.set_caption("saved as /home/pi/" + str(count)+ '.jpg')
   windowSurfaceObj = pygame.display.set_mode((width,height))
   image = cam.get_image()
   catSurfaceObj = image
   windowSurfaceObj.blit(catSurfaceObj,(0,0))
   pygame.display.update()
   cam.stop()
   pygame.image.save(image,str(count ) +'.jpg')
   time.sleep(1) 
   count +=1
Gordon77

neptune3nl
Posts: 2
Joined: Sun Nov 24, 2013 5:58 pm

Re: Logitech USB Webcam

Mon Nov 25, 2013 9:17 pm

hello there,

Tried all the options mentioned apart from connecting the webcam to a powered hub.
I get files written in /home/dev but without any pictures.
fswebcam generating errors though.

Eugene
Posts: 4
Joined: Fri Nov 22, 2013 5:16 am

Re: Logitech USB Webcam

Mon Nov 25, 2013 9:25 pm

Discussed many times in different topics and in blogs. Just google it.

Here is one simple solution (yet not he only one):
http://www.raspberrypi.org/phpBB3/viewt ... 87#p457887

User avatar
DougieLawson
Posts: 35381
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Logitech USB Webcam

Mon Nov 25, 2013 10:19 pm

That's a good link. I think a lot of the OP's problem is lack of a powered hub.
I got my webcam (which magically appeared as /dev/video0 when I plugged it in) working with mmal/motion. Until the lack of a powered hub shot the RPi dead (needing a reboot, the SDCard was OK).

So
Rule #1 is use a powered hub.
Rule #2 is plug in the webcam and use 'dmesg | grep usb' to see if it got recognised, if a device driver got loaded and what device it's addressed as.
Then when we know that we can start playing with python or mmal or whatever.
Note: Having anything remotely humorous in your signature is completely banned on this forum.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Fonzi
Posts: 2
Joined: Mon Jul 07, 2014 8:34 am

Re: Logitech USB Webcam

Mon Jul 07, 2014 8:36 am

Hi,

Is it possible to have the camera board AND an USB camera connected at the same time?
It seems that Motion MMAL internally tries to link vc.ril.camera to /dev/video0

So, it a USB camera gets the device video0, we have a problem.

I'm also using a logitech camera, and works great with standard version of motion.
I can also get the camera board to play nicely with MMAL version of motion. But can't use both at the same time.

Thanks!

Return to “Camera board”