Usb webcam randomly connects and not connect on startup to octopi

What is the problem?
When I startup octoprint,
sometimes the USB webcam will connect and show the video
and other times (mostly) it will not show anything other than message "Webcam stream loading..."

What did you already try to solve it?
Restarting octoprint.
Restart system
Connect the webcam to a different usb port on octopi
Change power supply

Logs (octoprint.log, serial.log or output on terminal tab, browser error console ...)
octoprint 190904.log (68.6 KB)
webcamd.log (350.5 KB)

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ...)
OctoPrint version = 1.3.11
OctoPi version = 0.16.0
printer - wanhao i3
firmware = Marlin bugfix-2.0.x
browser = chrome

Pi model - Raspberry Pi 3 Model B Plus Rev 1.3
Webcam = Logitech QuickCam Pro 9000

I saw a little undervoltage going on there. You didn't mention which Pi you're using.

Raspberry Pi 3 Model B Plus Rev 1.3
Webcam = Logitech QuickCam Pro 9000

yeah I noticed sometimes there is a solid under voltage symbol appears but it is not flashing to indicate a current problem.

I have tried switching power supplies including using an apple charger but there is not much I can do about that issue.

I checked lsusb and it indicated my usb webcam is connected

pi@octopi:~ $ lsusb
Bus 001 Device 004: ID 046d:0809 Logitech, Inc. Webcam Pro 9000
Bus 001 Device 005: ID 1d50:6029 OpenMoko, Inc.
Bus 001 Device 006: ID 0424:7800 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Right now my octoprint is showing the video stream and there is no under voltage symbol showing.

But the problem is it randomly works and doesn't work.

Here's my webcam log when it was not working
webcamd.log (350.5 KB)

Does it maybe not work if you don't power on your printer before you power on your pi or if you shut it down while the pi is stil running?

If that's the case try this

Are you saying put tape on the 5V pin of the usb cable that is attach from the 3D printer to the pi
to prevent 3D printer drawing power from the pi and this is the cause of the under voltage?

  • ie the 3D printer LCD screen drawing the power from the pi which then causes the pi to not get enough volts/power etc.

As far as I am aware the only thing that the pi can power is the LCD screen of the 3D printer
since no stepper motors run until I turn on the power switch of the 3D printer..

BTW just for extra info I got both my pi and 3D printer connected to a double adapter
so that I can just turn on one switch of my power board.

yep that is what I'm saying. Not every printer is drawing too much from usb when powered by usb but some do - my ender 3 pro for example does it.
If I turned it off while the pi was on some of my usb devices even stopped working.

So they turn on at the same time? Well I don't know maybe the printer turns on a bit earlier and causes this problems. Just try to power the printer on first and see if the problem remains :smiley:

Btw if you scroll up the thread from my quote above you will see a person who had that exact problem :smiley:

yeah but I also tested it by powering them on separately (ie no double adapter) and the problem still occurred..

So the pi should be powered on first before the printer?

so basically this problem is due to the initial undervoltage at the start
which causes the usb device/webcam to not get enough power
which then causes it to fail the detection/connection to octoprint?

yeah I did scroll up that thread..

I will see if testing your method will work

No the printer first. Sry I read it wrong at the first time

Exactly. I don't know if the problem is caused by the pi or the camera itself but yeah if the printer draws too much it can happen.

I cross my fingers for you :slight_smile:

edit: read the first quote wrong

I have the same Logitech Quickcam 9000 pro and the same issue. from what I can tell it sometimes works. My last thinking is, it is caused by undervoltage. I tried a powered usb hub between the pi and the webcam and it worked for 2 out of two boots. I do not even have the printer connected at all for testing.

I failed to get it working with the powered hub. FWIW the webcam just works on my windows pc

i decided to give up and ordered a new c920.

But you tried the thing with the tape, right?

Actually I did not but I did try several power adapters, cables, pi 3, pi 4 ... all without even connecting the printer at all.

I see.
Well that's everything you can do :man_shrugging:

Hi,

Hope you found your solution. I had the same problem for a few days too. I realized that this is a very simple problem to solve. Just restart webcamd

sudo systemctl restart webcamd

You can use too command v4l2-ctl command before for choose your device:

v4l2-ctl --help ; for Help menu

v4l2-ctl -D ; for view info about driver

v4l2-ctl -d 0 ; For choose your device instead of /dev/video

ex. control:

v4l2-ctl -c focus=143 ; This command set focus (0-255)

etc.

It seems the camera is a bit slow to initialize on startup. After that, it is easy to redo this command via SSH or just in a script when starting octoprint.

Regards,

2 Likes

Thank you do so much, your solution worked, been at this all day. Thank you soo much again.

I set:
v4l2-ctl -d 1
and restarted with the cmd.

use
v4l2-ctl --list-devices
to see all devices.

UPDATE: Camera randomly stopped working again and the above didn't work this time. This logitech camera is going in the bin,. ordered a £10 cam from amazon and it has better picture quality, resolution and worked instantly.

Just had another idea.

You could try a boot delay if you're using a pi:

boot_delay wait for given number of seconds in start.elf before loading kernel. Default 1

add boot_delay 5 to your config.txt for a 5 seconds boot delay.

Not sure if it helps, but it's worth a try.