Trouble setting up Arducam B0390

Camera model

ArduCam B0390 - 8 MP IMX219

What is the problem?

I believe the problem is somewhere between libcamera and webcamd but I don't know for certain.

I can take still pictures with my camera using libcamera-still -o test.jpg if I sudo systemctl stop webcamd first, but the live feed doesn't show up in /#control or /webcam/, for example:

What did you already try to solve it?

Tweaking configs, following the various sets of instructions for my camera and cameras that were similar. Mainly here and here.

Logs (/var/log/webcamd.log, syslog, dmesg, ... no logs, no support)

octoprint-systeminfo-20220724215040.zip (73.6 KB)

Additional information about your setup (OctoPrint version, OctoPi version, ...)

pi@octopi:~ $ vcgencmd get_camera
supported=1 detected=0, libcamera interfaces=1

I installed a nightly for 2022-07-24 due to ArduCam saying they need Debian Bullseye. At one point I had tried taking the stable version of ArduCam and rolling it forward to Bullseye but I ran into configuration issues with haproxy mainly.

But here's what it says on startup:

OctoPrint version : 1.8.1
OctoPi version : 1.0.0

Thanks for reading and I appreciate any and all help :slight_smile:

Doesn't that same guide give you the steps to configure octoprint? I vaguely remember reading it.

Ah, different guide...

Or probably closer

Thanks @jneilliii I've seen that first one, the second one might be new to me. I'm unsure though because this camera is described as "Stock Lens Fixed Focus" so it doesn't have autofocus of zoom capabilities. I'll give it a shot and let you know

The guide is for different camera version I think, the imx519, but I figure the changes would be similar for you since it's also in the imx family.

Unfortunately those instructions don't work either. The repository only supports the imx519 family and a variant of the 64mp camera:

Supported packages:
        imx519_kernel_driver_low_speed
        64mp_pi_hawk_eye_kernel_driver
        libcamera_apps
        libcamera_dev
        imx519_kernel_driver
        kernel_driver

Even trying out the directions using the non-imx519 drivers didn't work -- when I restarted libcamera-still failed to take a picture. I'm currently rolling back to a version I saved before this experimentation...

I would have thought the IMX219 sensor would work fine on a stock OctoPi image (without libcamera), since it is the same as the official RPi camera. Maybe Arducam added something else to complicate things.

mjpg_streamer is not compatible with libcamera, so if this camera requires that you will have to use ArduCam's forked version of webcamd/mjpg streamer in the guide for the IMX 519.

Have you tried enabling the legacy camera (in raspi-config) stack and using the old raspistill type commands to use the camera?

I didn't realize that the IMX219 should work stock. I have an extra SD card so I'm going to try installing the latest stable version of OctoPi on there and see if I can get that working with raspistill. All the instructions for this camera say to use libcamera and a newer version of Debian but I'm wondering if that's strictly necessary, based on what you're saying

You are aware that OctoPi 1.0.0 is a release candidate and some features may not work properly?

You are aware that OctoPi 1.0.0 is a release candidate and some features may not work properly?

Yes. The quick start guide that came with my camera claims that Debian 11 is needed. (that link is the same as above)

That being said, if the IMX219 sensor can operate with raspistill and webcamd on Debian 10 (which 0.18.0 is) then that's probably preferred, which is why I'm pursuing that path with a second SD card.

1 Like

Stable build update:

After setting up a static IP and a few niceties, I'm getting the following:

vcgencmd get_camera
supported=1 detected=1

In /var/log/webcamd.log:

Starting up webcamDaemon...

--- Configuration: ----------------------------
cfg_file:      /boot/octopi.txt
camera:        auto
usb options:   -r 640x480 -f 10
raspi options: -fps 10
http options:  -w ./www-octopi -n --listen 127.0.0.1

Explicitly USB device:
-----------------------------------------------

Found video devices:
/dev/video0
/dev/video10
/dev/video11
/dev/video12
/dev/video13
/dev/video14
/dev/video15
/dev/video16
/dev/video18
raspi
config file='/boot/octopi.txt':USB device was not set in options, start MJPG-streamer with the first found video device: /dev/video0
<13>Jul 25 21:07:09 root: Starting USB webcam
Checking for VL805 (Raspberry Pi 4)...
  - It seems that you don't have VL805 (Raspberry Pi 4).
    There should be no problems with USB (a.k.a. select() timeout)
Running ./mjpg_streamer -o output_http.so -w ./www-octopi -n --listen 127.0.0.1 -i input_uvc.so -r 640x480 -f 10 -d /dev/video0
MJPG Streamer Version: git rev: 5554f42c352ecfa7edaec6fc51e507afce605a34
 i: Using V4L2 device.: /dev/video0
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: 10
 i: Format............: JPEG
 i: TV-Norm...........: DEFAULT
UVCIOC_CTRL_ADD - Error at Pan (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Tilt (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Pan Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Pan/tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Focus (absolute): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Pan (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Tilt (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Pan Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Pan/tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Focus (absolute): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at LED1 Mode: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at LED1 Frequency: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Disable video processing: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Raw bits per pixel: Inappropriate ioctl for device (25)
 o: www-folder-path......: ./www-octopi/
 o: HTTP TCP port........: 8080
 o: HTTP Listen Address..: 127.0.0.1
 o: username:password....: disabled
 o: commands.............: disabled
libv4l2: error turning on stream: Invalid argument
Unable to start capture: Invalid argument
 i: Can't enable video in first time
 i: cleaning up resources allocated by input thread
Done bring up all configured video device

Goodbye...

I tried setting the video device to raspi as it kinda seemed like the output was hinting at that and got:

Starting up webcamDaemon...

--- Configuration: ----------------------------
cfg_file:      /boot/octopi.txt
camera:        raspi
usb options:   -r 640x480 -f 10
raspi options: -fps 10
http options:  -w ./www-octopi -n --listen 127.0.0.1

Explicitly USB device:
-----------------------------------------------

Found video devices:
/dev/video0
/dev/video10
/dev/video11
/dev/video12
/dev/video13
/dev/video14
/dev/video15
/dev/video16
/dev/video18
raspi
config file='/boot/octopi.txt':Start MJPG-streamer with video device: raspi
<13>Jul 25 21:27:04 root: Starting Raspberry Pi camera
Checking for VL805 (Raspberry Pi 4)...
  - It seems that you don't have VL805 (Raspberry Pi 4).
    There should be no problems with USB (a.k.a. select() timeout)
Running ./mjpg_streamer -o output_http.so -w ./www-octopi -n --listen 127.0.0.1 -i input_raspicam.so -fps 10
MJPG Streamer Version: git rev: 5554f42c352ecfa7edaec6fc51e507afce605a34
 i: fps.............: 10
 i: resolution........: 640 x 480
 i: camera parameters..............:

Sharpness 0, Contrast 0, Brightness 50
Saturation 0, ISO 0, Video Stabilisation No, Exposure compensation 0
Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none'
Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128
Rotation 0, hflip No, vflip No
ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000
 o: www-folder-path......: ./www-octopi/
 o: HTTP TCP port........: 8080
 o: HTTP Listen Address..: 127.0.0.1
 o: username:password....: disabled
 o: commands.............: disabled
 i: Starting Camera
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
camera couldn't be enabled

Camera doesn't work in either configuration, unfortunately. raspistill can't take pictures either:

pi@octopi:~ $ !raspi
raspistill -o asdf.jpg
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates

Any ideas?

raspistill can't interact while the webcamd service as it will lock the camera access I think. Try raspistill after stopping webcamd with sudo service webcamd stop.

Same result. It turns out webcamd isn't even running in the current iteration because setting the video device to raspi was causing it to fail to start.

you could try some other streaming solution, ustreamer seems to be pretty popular drop in replacement.

I would definitely lock the type in mjpgstreamer to USB even if you're using a raspicam.

So what is mmal and now does it relate to raspistill? I'm not sure where it's getting this from, but apparently ENOSPC is an out of space error. I know I'm not out of disk space on my Pi (fresh install on a 32 GB MicroSD card...) but maybe a partition is limited, or it's trying to write to something invalid.

I turned on verbosity but it's not much clearer to me:

pi@octopi:~ $ raspistill -v -o asdf.jpg

"raspistill" Camera App (commit bab9bf8790cd Tainted)

Camera Name imx219
Width 3280, Height 2464, filename asdf.jpg
Using camera 0, sensor mode 0

GPS output Disabled

Quality 85, Raw no
Thumbnail enabled Yes, width 64, height 48, quality 35
Time delay 5000, Timelapse 0
Link to latest frame enabled  no
Full resolution preview No
Capture method : Single capture

Preview Yes, Full screen Yes
Preview window 0,0,1024,768
Opacity 255
Sharpness 0, Contrast 0, Brightness 50
Saturation 0, ISO 0, Video Stabilisation No, Exposure compensation 0
Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none'
Flicker Avoid Mode 'off'
Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128
Rotation 0, hflip No, vflip No
ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates

mmal is the GPU that's on the pi IIRC.

Workarounds: Camera not working - failed to enable component: ENOSPC

Sun Jun 09, 2019 7:02 pm

I had the same ENOSPC problem when using picamera in python3 for single (still) images. I found two workarounds:

  1. reduce the resolution -- it failed at 3280x2464, but succeeded at 1024x768
  2. increase the amount of GPU memory. The default is 128 MB; 192MB permits 3280x2464.
    (do this in the Performance tab of the graphical configuration tool)

JPEG format seems to need less GPU memory than the bitmapped formats (PNG, GIF, BMP). Of course the final JPEG file is also smaller.

These last tests were with just octopi installed, no plugins? I know that the TSD/Obico plugin can overtake the webcam stream if the premium webcam option is enabled.

That is correct. I'll try that plugin and see if it works.

I also tried upgrading to 192 MB for the GPU, no dice. Also tried a resolution at 640x480 and it failed as well.