Problems with USB cameras

2,104 views
Skip to first unread message

bobgee...@gmail.com

unread,
Apr 30, 2017, 4:56:54 AM4/30/17
to OpenPnP
Hello all,

I am having nothing but problems with my USB cameras.

I have two camera's like this one below:

https://www.aliexpress.com/item/720p-small-170-degee-wide-angle-fisheye-high-quality-endoscope-oem-usb-camera-module-ELP-USB100W03M/2035935319.html?spm=2114.01010208.3.114.FUeiRU&ws_ab_test=searchweb0_0,searchweb201602_4_10152_10065_10151_10068_10130_10084_10083_10080_10082_10081_10110_10136_10137_10111_10060_10138_10112_10113_10062_10156_10114_10179_10056_10055_10054_10059_10099_10078_10079_10103_10073_10102_10096_10070_10148_10123_10147_10052_10053_10124_10142_10107_10050_10143_10051,searchweb201603_1,afswitch_1,ppcSwitch_5&btsid=f458c11c-665d-4710-bc30-1caaaff67681&algo_expid=0e652605-5f2d-4cb8-b8ad-4f526db6d7e6-12&algo_pvid=0e652605-5f2d-4cb8-b8ad-4f526db6d7e6

My machine is ~5m away from my PC so I have active usb extenders (2x USB3.0 and 1x USB2.0). I have 4x USB3.0 and many x USB2.0 ports on my windows 7 PC.

When I was first configuring my machine, I have one of the camera's working in openPNP (I only played with the down cam, but I have both connected to the PC). I could see both cameras in my "devices and printers" showing up as "USB2.0 camera".

Everything was fine, until one day I could see either camera in openPNP (for no apparent reason, I hadn't been messing with the cameras at all). I experiments swapping cables around and in the end, I could only resolve the problem by taking the USB extenders from the back of my PC and plugging them in to the USB's on my front panel.

Worked ok for a few days, but not anymore. The camera's show up in my "devices and printers" view and as far as windows is concerned there is no problem. However, openPNP can't see them and neither can a freewebcam viewer program I installed. I have restarted my machien several times.

One thing I have found a few times when trying to talk to the camera's I have got a warning from windows that there is not enough USB bandwidth and that the camera I am trying to use wants 51% of the bandwith. I have a pretty smart PC and am pretty sure that it can handle a webcam! I have no idea how to maniulate the usb bandwith or where to start with all this really.

I am a bit reluctant to try to resolve this problem by fluke, i.e. swapping cables about until it works becuase the problem will come back again one day.

Is there a more elegant way of using these cameras? I heard some were going to use a raspberrypi to handle the cameras and run the info over ethernet?

I have a load of pi's sitting around.

Could I set one up to have the two usb camera's on it and make them IP cameras?

If anyone has done this, can they share the process?

Any other good suggestions?

Thanks guys!

SMdude

unread,
Apr 30, 2017, 5:19:38 AM4/30/17
to OpenPnP
I had a similar problem with my laptop. Could occasionally get my cameras and smoothie to work together, but it seemed like a fluke! My problem was that all 3 devices were connecting to the same root hub. I did have 2 root hubs, but one was dedicated to my webcam that I never use! I routed that webcam usb to one of my other usbs and now run one camera and smoothie from one root hub, and the other camera from the webcam hub. Since doing this I have not looked back!

Cri S

unread,
Apr 30, 2017, 5:26:42 AM4/30/17
to OpenPnP
Hi,as previous already said, use webcam instead of opencv as driver. Download this program. http://www.uwe-sieber.de/files/usbtreeview.zip
Run it and post a screenshot of it.
If it allows to export the tree as text append that export to the posting.
If you want use RPI instead, as ETH uses USB, you need one RPI for each camera, setup mstreamer and use opwncv/webcam/onif for accessing the stream.

Jason von Nieda

unread,
Apr 30, 2017, 9:44:23 AM4/30/17
to ope...@googlegroups.com
Hi Bob,

Make sure you've read https://github.com/openpnp/openpnp/wiki/USB-Camera-Troubleshooting-FAQ. The host controller issue is the primary issue with the OpenCV driver. As Cri said, you may have some luck with the WebcamCamera, too. 

Jason


--
You received this message because you are subscribed to the Google Groups "OpenPnP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/095f77d1-d717-4598-90b5-21a4db27eb94%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

bobgee...@gmail.com

unread,
May 1, 2017, 2:12:44 AM5/1/17
to OpenPnP
Gentlemen,

Thanks very much for the pointers. Here it is the state of play:

SMdude - Thanks, I will work on this.

Jason - Thanks for the info, that expands on what SMdude says and sort of makes sense.

Cri S - Thanks for that program, I really wish Windows had better utilities built in. Would save us having to find cool stuff like this. Before you sent me that link, I was going to plug a device in every socket and look at its properties to figure out which ports connected to which hubs (what a pain). I ran the utility and think I can make sense of it, see screens below. I will try splitting the cameras over different hubs before I mess with rpi now that it seems the issue is a common one and the solution works for most. I tried to use webcam, but since I have my recent issues, I couldn't any camera to work on any configuration, but that is with both cameras on the same hub. I will now try to split everything up a bit and see how I go.

Could I get anyone's opinion on the following?

I have 2x USB3.0 hubs, 3x "Standard Enhanced PCI to USB Host Controller" and 4x "Standard OpenHCD USB Host Controller"

I have 1x USB2.0 active cable and 2x USB3.0 active cables. Does it matter which way I use these, or do all I need to worry about is splitting them accross the different hubs evenly?

I plan to put one USB3.0 cable on each USB3.0 hub and run the cameras (usb2.0) on those, and and have the smothie on the usb 2.0 cable on one of the PCI USB hubs.

I am guessing pretty much any combination will work, and obviously, since I have 9 hubs, I might as well share everything about as much as possible.

Anyway, I will now play around with it and see how I get on.

Thanks again 



Auto Generated Inline Image 1
Auto Generated Inline Image 2

bobgee...@gmail.com

unread,
May 1, 2017, 3:33:20 AM5/1/17
to OpenPnP
Update - I moved a usb flash drive around and watched the usb tree program.

I figured out which physical ports to use to have three totally separate root usb hubs and setup the machine with those.

I updated openPNP to the latest version.

I deleted all the camera from the machine tree.

I tried to add a webcam - the software didn't complaign, I could see two cameras to choose from, but neither worked (just a black screen).

I removed the webcam and added a openCV camera - no luck

I plugged in a standard webcam I have lying around, openPNP found it, but again, no image.

Starting to worry that I have somehow killed some part of my Windows installation by messing around with these cameras, like now no camera's seem to work on my PC. Does anyone know a simple utility to see the output of a webcam? I have one, but that doesn't seem to work anymore, hence my worries.

I have an old macbook pro (about 5 years old, don't know the spec). I could give that a try but will I hit the hub problems? It's only got three USB ports, I guess on one hub? I have the raspberry pi root to try too.

I am just hoping someone out there has the answer to my problems?

Thanks for your efforts!

Some screens for your amusement:

Note, the middle one has some features on the image.





Auto Generated Inline Image 1
Auto Generated Inline Image 2
Auto Generated Inline Image 3

SMdude

unread,
May 1, 2017, 3:56:53 AM5/1/17
to OpenPnP
Have you tried a restart yet?
I used iSpy to test out my cameras initially and it picked them up fine.
Mine are both working as opencv.

Cheers

bobgee...@gmail.com

unread,
May 1, 2017, 5:23:31 AM5/1/17
to OpenPnP
Been working on it again for last hour and made some progress but not much.

I have tried no end of restarts, closing software, etc.

I have managed to get an old microsoft webcam working in openPNP but not the usb cameras.

I can get the webcam working in iSpy but not my usb cam.

I swapped the usb camera from the usb3.0 cable to the usb2.0 cable and windows detected a new device (although I have connect it that way before too) and it took 2-3 minutes to update the driver. I thought great, it is doing something and it did complete the update process. However it still doesn't work in iSpy or openPNP.

Really can't figure out how I managed to break these cameras, there were working fine using the same setup. It is like Windows has confused itself about these cameras. Does anyone know the correct driver to use, I could try that, but am also a bit worried I make things worse.

Really getting fed up with this now, have been trying to get an image out of a camera for hours, so frustrating. If it never worked, I would just think the camera is broken and move on, but the fact that it did work for a while and now I can;t get anything is so frustrating.

Cheers

SMdude

unread,
May 1, 2017, 5:43:23 AM5/1/17
to OpenPnP
Can you try the usb cams on another computer?
It can be very frustrating when the simplest of things just don't wanna work!

SMdude

unread,
May 1, 2017, 6:08:07 AM5/1/17
to OpenPnP
You might get something useful from this?
Have you tried selecting a different or all possible usb device index?
Be sure to hit apply when your done.
What windows version are you running?

cam driver.JPG
camera settings.JPG

bobgee...@gmail.com

unread,
May 2, 2017, 2:34:34 AM5/2/17
to OpenPnP
SMdude,

Do you use the same kind of camera as me?

https://www.aliexpress.com/item/720p-small-170-degee-wide-angle-fisheye-high-quality-endoscope-oem-usb-camera-module-ELP-USB100W03M/2035935319.html?spm=2114.01010208.3.114.FUeiRU&ws_ab_test=searchweb0_0,searchweb201602_4_10152_10065_10151_10068_10130_10084_10083_10080_10082_10081_10110_10136_10137_10111_10060_10138_10112_10113_10062_10156_10114_10179_10056_10055_10054_10059_10099_10078_10079_10103_10073_10102_10096_10070_10148_10123_10147_10052_10053_10124_10142_10107_10050_10143_10051,searchweb201603_1,afswitch_1,ppcSwitch_5&btsid=f458c11c-665d-4710-bc30-1caaaff67681&algo_expid=0e652605-5f2d-4cb8-b8ad-4f526db6d7e6-12&algo_pvid=0e652605-5f2d-4cb8-b8ad-4f526db6d7e6

I can't be 100% which one I have, but it looks like this.

I tried a few USB index but not all. Sometimes it hangs a bit so takes a while. I do click apply. I can't get the cameras to work at all on my computer in othersoftware either so reluctant to try all 20 something usb index. When it used to work it was 0/1.

I am running windows 7.

Cri gave me some other software to try out tonight. I migth also try another machine. The worry I will have, is that if they work on another machine, will they work for long? It worked ok on this computer and I didn't touch the camera at all, but one day it just stopped. I don't want to go through this again on another machine.

Might start looking at the pi solution as I have a load of them lying around. I can image the sd card when it is working and no matter what happens recover the situation easily by burning a new sd card. Easier than when windows decides to forget what driver to use etc.

Please let me know what camera you have so I can think about the driver screenshot you sent me.

Thanks

Matt Brocklehurst

unread,
May 2, 2017, 3:26:25 AM5/2/17
to ope...@googlegroups.com
Something as simple as Skype will verify if the cameras are working or not

If your doubting the windows install why not flatten it and start again it will only take a couple of hours - maybe put a decent (*nix) os on it instead lmao! 

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "OpenPnP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.

SMdude

unread,
May 2, 2017, 3:57:05 AM5/2/17
to OpenPnP
I purchased these cameras from this seller.
I also purchased a lens pack so I could find the best lenses for my setup.
I remember UVC being one of the key things that a camera must have to have it work easily.

http://www.ebay.com/itm/HD-720P-1MP-CMOS-OV9712-MJPEG-30fps-UVC-USB-Camera-Module-8mm-Lens-Free-Driver-/222069273104?hash=item33b45c3210:g:AVUAAOSwUuFW0MQm


" The worry I will have, is that if they work on another machine, will they work for long? It worked ok on this computer and I didn't touch the camera at all, but one day it just stopped. I don't want to go through this again on another machine."

Cross that bridge when you come to it! You really just want the other machine to confirm that the cameras actually do still work, which then points you to a software/driver problem on your win7 pc.
When you plug in your camera, what does it show up as in device manager?

Cheers!

Paul Jones

unread,
May 3, 2017, 7:49:13 AM5/3/17
to ope...@googlegroups.com

I have two cameras streaming from a Rpi 2 – a USB camera (looks like the same ELP camera in your link) and a Rpi camera.

On the pi I have a program called mjpeg-streamer[1] which takes the mjpeg stream from both cameras and makes it available as a http stream.

I use systemd on the pi to start mjpeg-streamer at boot.

On openpnp I have created a new camera type[2] that uses the webcam-capture library to connect to the two ip cameras on the pi. You’ll have to edit the code to change the hard-coded ip addresses to suit your setup.

 

Here are some config files to help you:

 

/etc/systemd/system/camera-streaming.service

[Unit]

Wants=network-online.target

After=network-online.target

 

[Service]

ExecStart=/root/camera-streaming

Type=forking

 

[Install]

WantedBy=default.target

 

 

/root/camera-streaming

#!/bin/bash

export LD_LIBRARY_PATH=/home/pi/mjpg-streamer/mjpg-streamer-experimental/

/home/pi/mjpg-streamer/mjpg-streamer-experimental/mjpg_streamer -o "output_http.so -w ./www -p 8080" -i "input_uvc.so -r 960x720 -d /dev/video0" -i "input_raspicam.so -x 1600 -y 1200 -fps 10 -quality 50" &

 

 

[1] https://github.com/jacksonliam/mjpg-streamer

[2] https://github.com/PeeJay/openpnp/commit/508c63bf4fa299bd4700a6d71503564babc3a178#diff-d2dfbe04d83f026de69f43cea76281f6R83

 

 

dzach

unread,
May 3, 2017, 8:54:34 AM5/3/17
to OpenPnP
Paul's MjpegIPCamera driver and mjpg-streamer is the best way I found to run my two 1280x1024 on the same USB2 hub with the motion controller and a few other USB devices, @15fps. It's not yet included in openpnp, but will be, soon enough I guess.

bobgee...@gmail.com

unread,
May 21, 2017, 2:36:48 AM5/21/17
to OpenPnP
Hey guys,

Apologies for dissapearing for a couple of weeks, my wife has been giving me loads of work to do lol!

I was also a bit bewildered at all the different avenues to persue to try to fix my problem, although I don't want to sound ungrateful. I really appreciate all the suggestions and they have helped me progress. I also had a bit of a issue in that to plug the camera in to my old pc, I needed to move a ridiculous mount of stuff around in my work room which prompted me to do a load of tidying, did I mention my wife had me working?

Anyway,

I used:

http://www.uwe-sieber.de/files/usbtreeview.zip


to figure out which USB are on which hub etc.

I unplugged all USB devices.

I connected one of the cameras to my old XP machine and skype could see it straight away so I knew the camera worked. I noted the driver XP used and returned to my win7 machine.

I plugged the camera in to a different USB port and it took a minute to install the default driver (different one on Win7 but that is to be expected).

Before I started trying to mess around with trying to install the XP driver, I thought I would give openPNP a quick try again.

OpenPNP wanted to update itself as soon as I started it so I let it do that.

I then proceeded to add a camera to the head, expecting to have the same problems as before, and to my suprise (and delight) it worked as an openCV camera but not as a webcam.

I had done nothing but:

Removed all USB devices (but I had done that before too and not fixed the problem)
Plugged the camera in a different USB
Plugged the camera in to a different machine (possibly affecting the camera itself?)
Updating OnenPNP (but only from a recent version).

Not sure which of these actions did the trick, but I am sure I will get some clue when I manage to break it again!

The OpenCV camera only has resolution 640x480 (webcam doesn't work at all), see below:



What I found strange is that in "iSpy" I can get 1200x??? pixels and the camera sees more see below:




There are ~19 squares accross for the 1200 mode compared with ~12 for the 640 resolution.

It is a very spherical lens so can't gain much from these numbers, i.e. I can't see if the resolution is linear with field of view, but it is clear the field of view of the camera is affected by which resolution you ask the camer for. I hadn't expected this.

In all screenshots the view is of a sheet 5mm squared paper and I haven't moved the camera etc.

Below (for completeness) is the same resolution openPNP uses (640x480) but viewed in iSpy and it shows the same as openPNP so I guess this curious behaviour is more down to the camera than the software I am using to view it.




If I was going to try to resume my machine build with a long term view, I would continue to persue the resolution issue by trying some of the other suggestions for fixing these camera as webcams, such as new operating system, run software from different computer or use raspberry pi etc. I currently am getting quite desperate for my machine to do some work for me, even if it just placing the 603 parts on a board I need to make soon, so I am currently planning to get attempt to get a very basic operation working and try to improve my camera setup later.

I am considering ordering one of these to play with:

https://www.aliexpress.com/item/Ultra-Low-Illumination-1-2-8-SONY-IMX222-IP-Camera-ONVIF-P2P-1080P-Camera-IP-2MP/32374418681.html?spm=2114.01010208.3.255.1JgENU&ws_ab_test=searchweb0_0,searchweb201602_1_10152_10065_10151_10130_10068_5010016_10136_10137_10157_10060_10138_10155_10062_10156_437_10154_10056_10055_10054_10059_303_100031_10099_10103_10102_10096_10147_10052_10053_10050_10107_10142_10051_5190016_10084_10083_10080_10082_10081_10110_519_10111_10112_10113_10114_10179_10181_10183_10182_10185_10184_10078_10079_10073_10123_142,searchweb201603_1,ppcSwitch_5&btsid=beeead7f-e2b2-4b39-b404-1827203285da&algo_expid=ce46ebf1-2190-47bf-a272-8d7388662b91-35&algo_pvid=ce46ebf1-2190-47bf-a272-8d7388662b91

Any thoughts on that? I would need to dremel out my camera mount to fit it as it has many more headers.

The plan now:

I will also put off the axis mapping for now and run with one nozzle (I assume I can do that?)

I will swap the lens on the down cam to give a more sensible pixle per mm for basic 603 placement (temporary fix).

I will then try to set up my pick and place commands, i.e. setup the GCODE, (leaving axis mapping for the near term and running one nozzle)

Then on to try a simple feeder (taped down strip on to the bed) and see if I can I place a couple of 603.   

I badly need to get this machine to do something to get my enthusiam back up, and I will refine it later.

Thanks to all who have helped so far, wish me luck.



Cue several questions about the GCODE and feeder setup.........



Auto Generated Inline Image 1
Auto Generated Inline Image 2
Auto Generated Inline Image 3

SMdude

unread,
May 21, 2017, 4:08:19 AM5/21/17
to OpenPnP
Good stuff Bob!
One thing with the down-looking camera, make sure the field of view is large enough to see a few parts on your widest tape ;)
Just managed to get mine to do its first placement job today, bunch of 603's and some fine pitch ic's. Reasonably impressed with the results, but still have some tuning up to do.
Good luck with it..
Reply all
Reply to author
Forward
0 new messages