Trouble setting up Arducam B0390

Using TSD/Obico plugin would make it harder to debug, rather than easier. The less things you have trying to make work, the better.

The errors seem to indicate that there is something not working right with the camera - my guess is that both raspistill & mjpg streamer are having similar issues but they report it differently.

You said originally that libcamera-still worked to take a picture with the webcam. Maybe Arducam made some changes that required that software to work. If you can get it working with libcamera, then steps 4-7 of the link @jneilliii posted above would probably work.

Failing that, contacting Arucam support may be an option - they are well aware of what OctoPrint is and how it works and may know the exact answers - in reality I'm just making guesses...

Hello again! Things got busy so I was not able to continue my journey until last night. I made a lot of progress and I can definitively say that the webcam is working.

I need to document my steps thoroughly and eventually re-run the process to verify that I'm not forgetting anything, but here's what I did from memory (if you're here to help me troubleshoot webcamd feel free to skip the bulleted list):

  • Install a fresh copy of the latest nightly
  • Initial wave of customization
    • Change password (passwd)
    • Add WiFi password (sudo nano /boot/octopi-wpa-supplicant.txt)
    • Change /boot/config.txt according to the quick start guide that came with the camera (same content as in my original post, but here for clarity and edited to reflect my situation:)
    • Instructions said to change camera_auto_detect=1 to camera_auto_detect=0 but it was already set to 0 (I suspect this was an OctoPi change).
    • Underneath that, added dtoverlay=imx219
  • Reboot
  • Install vim and sudo apt update && sudo apt upgrade -y (yeah I'm using vim for these commands but stating nano for simplicity / newcomers who might copy-paste)
  • Install mjpeg-streamer experimental fork from Arducam
    • From ~, mv mjpg-streamer mjpg-streamer-old to back up the old alias
    • git clone https://github.com/ArduCAM/mjpg-streamer.git
    • cd mjpg-streamer/mjpg-streamer-experimental
    • Edit input_libcamera plugin so it always builds:
      • nano plugins/input_libcamera/CMakeLists.txt
        • Delete the line that starts with if (
        • Delete the endif() line
        • Remove leading spaces / tabs from lines in-between
    • Make sure dependencies are installed:
      • sudo apt install cmake libjpeg9-dev gcc g++ libcamera-dev
    • Install new mjpeg-streamer:
      • make
      • sudo make install

From there, I am able to run the following command and view snapshots / stream from another computer:

LD_LIBRARY_PATH=/usr/local/lib/mjpg-streamer /usr/local/bin/mjpg_streamer -i "input_libcamera.so" -o "output_http.so -l 0.0.0.0 -p 8081"

The problem is, this doesn't work with webcamd so I'm still not able to use it for printing. webcamd is just bash so I should maybe eventually be able to figure things out but I haven't been able to thus far. I've hacked a bit on /root/bin/webcamd, even restoring it from the Octopi GitHub repo a couple times (so that makes my instructions less reproducible).

diff --git a/webcamd.original b/webcamd
old mode 100644
new mode 100755
index f2c6dfb..98666f8
--- a/webcamd.original
+++ b/webcamd
@@ -11,8 +11,8 @@
 ### computer.                                                        ###
 ########################################################################

-MJPGSTREAMER_HOME=/opt/mjpg-streamer
-MJPGSTREAMER_INPUT_USB="input_uvc.so"
+MJPGSTREAMER_HOME=/usr/local/bin/mjpg-streamer
+MJPGSTREAMER_INPUT_USB="input_libcamera.so"
 MJPGSTREAMER_INPUT_RASPICAM="input_raspicam.so"

 brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "0458:6006" "1e4e:0102" "0471:0311" "038f:6001" "046d:0804" "046d:0825" "046d:0994" "0ac8:3450")
@@ -155,8 +155,9 @@ function runMjpgStreamer {
     fi

     pushd $MJPGSTREAMER_HOME > /dev/null 2>&1
-        echo Running ./mjpg_streamer -o "output_http.so -w $camera_http_webroot $camera_http_options" -i "$input"
-        LD_LIBRARY_PATH=. ./mjpg_streamer -o "output_http.so -w $camera_http_webroot $camera_http_options" -i "$input" &
+        logger -s "pushd to $MJPGSTREAMER_HOME"
+        logger -s "Running ./mjpg_streamer -o \"output_http.so -w $camera_http_webroot $camera_http_options\" -i \"$input\""
+        LD_LIBRARY_PATH=/usr/local/lib/mjpg_streamer ./mjpg_streamer -o "output_http.so -w $camera_http_webroot $camera_http_options" -i "$input" &
         sleep 1 &
         sleep_pid=$!
         wait ${sleep_pid}

I changed the lines to include logger -s because that's how I could get things to show up in journalctl.

This then required a change from /boot/octopi.txt to get it to output something like what I was testing with, changing the line like camera_http_options to:

camera_http_options="-n -l 0.0.0.0 -p 8081"

With this configuration, I get the following lines of output from journalctl -fu webcamd.service every 2 minutes:

Aug 03 15:33:01 octopi root[15137]: pushd to /usr/local/bin/mjpg-streamer
Aug 03 15:33:01 octopi root[15138]: Running ./mjpg_streamer -o "output_http.so -w ./www-octopi -n -l 0.0.0.0 -p 8081" -i "input_libcamera.so -r 640x480 -f 10 -d /dev/video0"

With both 127.0.0.1 and 0.0.0.0, I can't view the webcam from another computer. URLs I've tried:

  • <ip>:8081
  • <ip>/webcam/ (shows "The webcam server is not currently running" page)
  • Tunneling with ssh like ssh pi@<ip> -L 8080:<ip>:8081 and looking at 127.0.0.1:8080 (which definitely worked when I was running mjpg_streamer myself from the command line)

So that's where I'm stuck at. I'm hoping there's better instructions somewhere for getting webcamd working with mjpg_streamer with input_libcamera because I seem to be treading into unknown territory here.

I've gotten it to work!! I believe the only significant change was switching the port to 8080 and I feel a little silly for having changed it to 8081 in one part of my testing, but the camera's showing up on the control pane!

Sometime in the next week I'm going to rebuild from scratch and make sure I'm not omitting any important steps.

3 Likes

that makes sense, 8080 would be configured in haproxy for redirecting the /webcam/ path in OctoPi's default webcam settings.

Hi there, looking for a solution. Same problem here. Will try that workaround but if that doesn't work help will be very much appreciated