Jump to content
Neil Pate

How to tell if USB camera has failed/disconnected

Recommended Posts

I am using USB cameras (several different vendors on different projects) and have noticed that sometimes my image acquisition fails as the camera has just disconnected (or failed in some manner). My camera is configured for Continuous Acquisition and I am using IMAQdx Get Image 2.vi. When the camera has failed (or is physically disconnected) I do not get any error out of that VI, just the last image is returned. I have tried various other techniques like looking at the buffer number etc but cannot seem to get anything to work reliably.

Any ideas on what I am doing wrong or a strategy I can employ for figuring out if the camera has failed?

Thanks

n

Share this post


Link to post
Share on other sites

Hi Neil

Your cameras are powered by USB or other power supply ? USB is very delicate when there is different power sources for devices. Few time ago i have encounter lot of problem with this , and solve lot of it with one galvanic converter added on USB Link.

Something like that https://electronics-shop.dk/usb-isolator

It's a bit difficult to know if USB link are fall because with this kind of problem is low level protection who are activated and only windows can detect and restart it. Sometime on old PC you need to shutdown PC' power-supply to restart USB Link.

The only wait i show to see if it fall, is to cyclically request something to camera, and detect when there isn't reply.

Eric 

Edited by Bobillier

Share this post


Link to post
Share on other sites

Thanks Eric,

The problems I have with cameras are so strange. Also sometimes the cameras get assigned new names in MAX for apparently no reason.

I will try one of these converters if I can get my hands on one.

Share this post


Link to post
Share on other sites

If a USB device does not implement a Device Serial Number correctly, Windows cannot distinguish between a second instance of the same camera being attached and the reconnection of the same camera. This leads to numerous "instances" of devices being installed in the system.  If done correctly, the OS should be able to assign a driver to an instance of a specific device (taking serial number into account).

The serial number of a device is normally defined in the device configuration package which an OS needs to read before it can even assign a device class.  A lot of devices simply don't implement this.

Also see HERE for info on where this data SHOULD be stored.

Share this post


Link to post
Share on other sites

shoneill, the issue I have is so random though. The system will work fine for weeks on end and then the camera will rename itself in MAX twice in one day or just fall over and require a full power cycle.

Share this post


Link to post
Share on other sites

My post seeks only to explain why the renaming takes place.  If there's a rapid power off and on, not supporting a proper Serial Number can lead Windows to whink a new camera has been attached.

I think the base problem you have is a power supply issue, and there USB is flaky at best.  The issues you see with MAX are understandable from an unstable power point of view.  Sorry that I didn't portray that information more clearly.

Filtering of power over USB is nororiously crappy for most motherboards, for possible fixes, Bobillier's suggestions above soumd perfectly reasonable.

Share this post


Link to post
Share on other sites

Sorry, I did not mean to come across as hostile at all. I was just typing a quick reply before dashing out.

I massively appreciate all the insight that is shared with me here.

:oops: 

  • Like 1

Share this post


Link to post
Share on other sites

No problem, no hostility detected. Honestly. Also none implied at all.  I just noticed that the focus of my answer wasn't explained properly.  Your "oops" while acknowledged, is not neccessary at all.  Nothing whatsoever to apologise for.  :beer_mug:

Although I knew my post was only focussing on the "multiple devices" issue, I simply didn't convey that properly.  My bad.  I only realised it after your post.

  • Like 1

Share this post


Link to post
Share on other sites

I am actually trying to move away from USB cameras to GigE as I have just had so much hassle with the USB ports. I have tried pretty much everything except that galvanic isolator mentioned earlier. 

Share this post


Link to post
Share on other sites

Just for info Neil. Low-cost NI USB DAQ card (USB6008) don't have  galvanic isolation and crash frequently, but more expensive NI USB DAQ card like USB-6216 have it:cool:'  (look page 13 of data-sheet)

Share this post


Link to post
Share on other sites

Be sure as well to never use hub. I have many issues with USB hub.

If you want to get the list of USB device connected, you can use this VI. note that if your web cam do now have embedded serial number, the device path is reported according to the USB port connected. if you connect the same model of webcam at the same port, Windows will use the same friendly name.

I use Spinnel USB cam 2M. they do have a embedded serial number programmed upon request... 50$ per unit. quite decent for this usb camera with a low distortion lenses.

USB Scanner.vi

  • Like 1

Share this post


Link to post
Share on other sites

Hi Benoit

Thanks for your vi. But do you know if there is property to get serial port associate to USB in the case of the device are used like USB-Serial Bridge ?

Eric

Share this post


Link to post
Share on other sites

Try it by yourself. it's depend of your adapter. This VI use the friendly name that is usually a copy of what is seen in the DEVICE MANAGER.

Share this post


Link to post
Share on other sites
5 hours ago, Benoit said:

if you connect the same model of webcam at the same port, Windows will use the same friendly name.
 

Ah yes, I remember this now,  I "abused" this when doing some USB programming of my own to install LibUSB drivers for a given device on one port, and standard NI-USB drivers on another port for testing.  In order to change driver, all I had to do was switch USB port instead of constantly uninstalling and re-installing.  It was a nice trick (in XP at the time), I don't know if it still works with Windows 10.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.