General Troubleshooting: Difference between revisions

From Phidgets Support
Line 84: Line 84:
If the Phidget works locally on both ends but not remotely, the problem is with the Webservice.  First, try slowing your program down.  Sometimes a network will introduce a bit of delay.  This will primarily affect how quickly you can use the Phidget after opening and attaching it, as well as the speed of reading continuous data from the device.  Using a '''<code>sleep</code>''' or '''<code>wait</code>''' function for short periods at these points will slow down your program.  If the program works when slowed, network lag is probably at fault.
If the Phidget works locally on both ends but not remotely, the problem is with the Webservice.  First, try slowing your program down.  Sometimes a network will introduce a bit of delay.  This will primarily affect how quickly you can use the Phidget after opening and attaching it, as well as the speed of reading continuous data from the device.  Using a '''<code>sleep</code>''' or '''<code>wait</code>''' function for short periods at these points will slow down your program.  If the program works when slowed, network lag is probably at fault.


Another problem might be an error in the numerous details that need to match on each computer.  You either need an IP address and port, or the server name (when using muticast DNS (mDNS) from '''<code>Bonjour</code>''' on Windows and Mac OS X or '''<code>avahi</code>''' on Linux).  The server name is set at the Webservice start up, or it will default to the name of the computer with the direct connection.  Double-checking all of these details may uncover the problem.
Another problem might be an error in the numerous details that need to match on each computer.  You either need an IP address and port, or the server name (when using muticast DNS from '''<code>Bonjour</code>''' on Windows and Mac OS X or '''<code>avahi</code>''' on Linux).  The server name is set at the Webservice start up, or it will default to the name of the computer with the direct connection.  Double-checking all of these details may uncover the problem.


Finally, if you suspect mDNS may be the problem, use the IP address and port form of '''<code>open()</code>''' (if you can) to directly connect to the computer controlling the Phidget.
Finally, if you suspect multicast DNS may be the problem, use the IP address and port form of '''<code>open()</code>''' (if you can) to directly connect to the computer controlling the Phidget.


==Device Troubleshooting==
==Device Troubleshooting==

Revision as of 20:58, 6 January 2012


To troubleshoot a Phidget problem, we strongly recommend a logical approach to pin down the source. Although Phidgets are designed to be easy to use, they actually are a complex system with many levels of interfacing between the Phidget, cables, possible networking, operating systems, USB ports, the Phidget Libraries, and ultimately your code.

To help you narrow down the source of the problem into a specific part of the overall system, we provide an overview of the entire system below. In each grey box we have the affected parts of the system (computer, the Phidget, your code, etc) and a simple step or two you can take to see if the problem is within that part of the overall system.

Once you have found the part of your system with the problem, click on the green link within the box to learn more about how to troubleshoot that portion.

Troubleshooting.png

Quick Links

The sections linked from the image above are:

Code Troubleshooting

Quick Fixes...
Syntax help can be found in the API download and code snippets for your programming language
High-level concept help (logging, catching errors, using the API) is on the General Phidget Programming page
Generic API help (error types and codes, information about each function) is on the General API page.
Hardware help (number of ports returned in code, maximum software sampling speed) can be found in the API section on the page for your device
Compiler help (linking libraries, running code) can be found on the page for your language
Ensure you wait enough time for the Phidget to respond to your requests, such as when switching between ratiometric and non-ratiometric sensing, or to get and set device data.

To determine whether the problem is within the code you're writing, you should run the provided examples for your programming language. To download and run the examples, visit the page about your programming language. The examples are designed to test and flex most of the Phidget API, including your device API. This holds true for the majority of devices and languages, but we also provide a HelloWorld example for each language that you can use with any device to test part of the API.

  • If the examples run, the problem is within your code.
  • If the examples do not run, the problem is at a lower level. Read on to the operating system troubleshooting section below.

If an example specific to your device exists, the source code file will be named similarly to the hardware. If you are still not sure which source code file or project to use, check the API section within the page for your device which will tell you the software object -- and thus example file name -- for your Phidget. Make sure to use either that device-specific example, or the HelloWorld example.

When debugging code, it helps to extract what is known as a Minimum Reproducible Unit (MRU), which is the minimum lines of code that can reproduce the issue. This will allow you to find what part of your use of Phidgets in code is causing the problem. We can help with this. Extracting an MRU is a powerful process which can not only isolate the problem, but also allow you to examine and organize your code. Also, it helps us debug your problem faster if you can show exactly what the problem is in your Phidget API code.

If you have found the problematic lines and want to see what is wrong, you can try turning on Phidget logging. Logging can save and display many different levels of messages (errors, debugging, or even individual Phidget library actions) to either a file or the program console. You can find help to turn logging on and off in the logging section of our General Phidget Programming guide.

Note: We do not offer services to debug general programming projects, or to develop code from scratch. We do, however, support any and all questions about the Phidgets and their use. So, if you have ideas for helpful examples, more documentation, or other useful material we could provide, we welcome your suggestions!

Operating System Troubleshooting

Quick Fixes...
Make sure no other programs are accessing the Phidget USB port at the same time as your code. This includes the Phidget Control Panel on Windows and the Phidget Preference Pane on Mac OS X.
Make sure your operating system version is supported
Ensure the Phidget libraries and drivers for your operating system are the most recent version
Check the Limitations section for your operating system as some problems arise from special combinations

To determine whether the problem is with your operating system, or at a lower level, you should check your operating system logs for the appearance of the Phidget as a hardware device. The process to check these logs varies by platform - whether by the Device Manager (Windows), About This Mac (Mac OS X) or the kernel logs (Linux) - and is described on the page for your operating system.

If you plug in the Phidget and the system logs show:

  • It does not appear, or
  • It does not disconnect, or
  • It only appears sometimes

The problem may be in the communication portion of the system, or lower. Start with the Communications Troubleshooting section below and work your way down.

If, on the other hand, your computer consistently detects the Phidget on the USB port but the libraries fail to communicate with it (i.e. the provided examples do not run, as described above), the problem is probably (a) your Phidget library versions, (b) other, third-party drivers causing a conflict, or (c) your operating system. Details about these problems for each platform can be found in the Troubleshooting section on the page for your operating system.

Communications Troubleshooting

Quick Fixes...
Make sure the Phidget is plugged in to the computer (always good to check)
Use short USB cables (<5 m)... long wires lead to poor sensor data and/or inadequate power
If you are using an unpowered USB hub, try connecting directly to a computer
Make sure any cables between multiple Phidgets (such as sensors and an Interface Kit, for example) are correctly connected. Helpful pictures can be found on the Getting Started page for your device

Communication problems come from either (a) power issues, or (b) connection issues. Once everything is plugged in and powered properly, there is not a whole lot that can go wrong with cables. The proper way to hook up your device can be found on the Getting Started page for your device. The proper way to provide additional power (only needed for some devices such as motors and relays, most Phidgets get power directly from USB) can be found on the product page for your device.

The one exception to communications problems being only from power or connections is if you're using a wireless internet connection to the Single Board Computer. Help for setting up and troubleshooting that Wifi connection can be found on its product page.

Webservice Troubleshooting

Quick Fixes...
Make sure the Phidget library versions are the same on both computers. The Webservice and libraries are on the page for your operating system
Wait a little time before trying to do things with the Phidget upon first connecting remotely, sometimes delay occurs over a network
Check the network setup on both sides (IP address and port correct? Server name spelling? User name and password?)

To narrow down the problem to the Webservice, try using the Phidget only on the directly connected system. Then, if possible, also try using the Phidget on the remotely controlling system. (Some platforms only allow remote use, so this may not be possible.)

If the Phidget works locally on both ends but not remotely, the problem is with the Webservice. First, try slowing your program down. Sometimes a network will introduce a bit of delay. This will primarily affect how quickly you can use the Phidget after opening and attaching it, as well as the speed of reading continuous data from the device. Using a sleep or wait function for short periods at these points will slow down your program. If the program works when slowed, network lag is probably at fault.

Another problem might be an error in the numerous details that need to match on each computer. You either need an IP address and port, or the server name (when using muticast DNS from Bonjour on Windows and Mac OS X or avahi on Linux). The server name is set at the Webservice start up, or it will default to the name of the computer with the direct connection. Double-checking all of these details may uncover the problem.

Finally, if you suspect multicast DNS may be the problem, use the IP address and port form of open() (if you can) to directly connect to the computer controlling the Phidget.

Device Troubleshooting

Quick Fixes...
What your device can and can't do (power, functionality, etc) will be found on its product page.
Make sure all the pieces are hooked up correctly. Helpful photos can be found on the Getting Started page for your device.
If you're trying to do something especially involved, become well-versed in your hardware. We provide lots of education on our primer pages.

An easy way to tell you have a new problem with your device is that it suddenly stops working. If you run the same code, on the same system, with the same libraries, and the same Phidget and suddenly it doesn't do the same thing anymore, you almost certainly have a hardware problem.

This can happen especially on boards and/or components that handle some form of external power (motors, relays, etc). It is important to make sure you don't overload the board, or you could do some serious damage. Check the specs for your device and remember, be conservative!

However, sometimes you get a board right out of the box and it doesn't seem to work. Some Phidgets, being flexible to many tasks, have their own connections between sensors, batteries, power, intermediate boards (like temperature), and so on. Although usually this is an intuitive hookup process, take another look at the photos in the Getting Started Guide for your device and make sure all the wires are in their proper place.

Once you have confirmed this, slow down and (if you haven't already) work carefully through the setup process. starting with that same Getting Started Guide for your device - to make sure it is indeed a problem with the hardware. This troubleshooting page itself shows that even something as simple as a device "not working" could be due to a problem at several different points.

Contact Us

If you are still having trouble after working through this guide, please contact us.

It helps if you can you can give us precise information about your issue, such as:

  • Minimal code to reproduce the problem
  • What part of the system you think the issue might be in, and why
  • And, of course, photos or even videos (we love these)!