Template:UGcontrolpanelSBC: Difference between revisions

From Phidgets Support
(Created page with "Make sure you have the latest version of the Phidget Drivers installed on your PC. If you don't, follow these steps: # Go to the quick downloads section on the OS_-_Windows|...")
 
Line 19: Line 19:
** There is no default for the IP address
** There is no default for the IP address
** The SBC will only have an IP address if it successfully gained one through DHCP (Dynamic Host Configuration Protocol) over Ethernet
** The SBC will only have an IP address if it successfully gained one through DHCP (Dynamic Host Configuration Protocol) over Ethernet
You will need one of these two pieces of information when you start working directly with the SBC Operating System for tasks such as writing and running code on the SBC, so write these down somewhere while you work through the rest of this Getting Started page.
You will need one of these two pieces of information when you start working directly with the SBC Operating System for tasks such as writing and running code on the SBC, so write these down somewhere while you work through the rest of this page.


===Basic Use===
===Basic Use===

Revision as of 08:42, 20 October 2016

Make sure you have the latest version of the Phidget Drivers installed on your PC. If you don't, follow these steps:

  1. Go to the quick downloads section on the Windows Page.
  2. Download and run the Phidget22 installer (32-bit or 64-bit, depending on your system)
  3. You should see the PIcon.jpg icon on the right hand corner of the task bar.

Running Phidgets Sample Programs

[[Image:{{{1}}}_Panel.jpg|right|link=]]

Double clicking on the PIcon.jpg icon will start the Phidget Control Panel, which acts as an easy example launcher and will automatically detect any Phidgets plugged in to your computer. We'll use the Control Panel to ensure that the new Phidget works properly.

After double clicking on the icon, a window will open with a list of all attached Phidgets. Click on the PhidgetSBC tab, and you should see a list of PhidgetSBCs connected to your network. Double click on an SBC to bring up the configuration page in your default web browser. You can differentiate multiple SBCs by their MAC address, which is printed on a sticker on the underside of the board.

This control panel view will tell you (at the bottom):

  • The link local address of the SBC (called the mDNS address), here it is phidgetsbc.local
    • The name phidgetsbc.local is the default link local address
    • Although there is a period after the link local address in the Phidget Control panel, the address itself does not include that final period
  • The IP (Internet Protocol) address of the SBC, here it is 192.168.2.181
    • There is no default for the IP address
    • The SBC will only have an IP address if it successfully gained one through DHCP (Dynamic Host Configuration Protocol) over Ethernet

You will need one of these two pieces of information when you start working directly with the SBC Operating System for tasks such as writing and running code on the SBC, so write these down somewhere while you work through the rest of this page.

Basic Use

Basic use of the PhidgetSBC allows the opening of connected Phidgets over the network. Using another Phidget with the PhidgetSBC in this way is almost exactly like using Phidgets over USB, in respect to the API calls and behavior. However, some extra considerations need to be made when working with the PhidgetWebservice.

Phidget Webservice

Support for opening Phidgets over the network is made possible via the Phidget Webservice. This allows a user to write an application in a system and language of their choosing and then operate Phidgets connected to the PhidgetSBC. It is a socket based server that runs on the PhidgetSBC, and allows any attached Phidgets to be seen and opened directly over the network. To use this server go to the "Phidgets->WebService" tab in the web configuration page and enable it.

Opening and controlling a Phidget over the network is nearly the same as opening one locally. The main differences are:

  • Different open calls that include server information. New calls OpenRemote and openRemoteIP (naming depends on language).
  • Access to Webservice based properties: Server hostname, port and ID.
  • Access to server connect and disconnect events, and network error events.
  • Phidgets can be opened by more then one separate application at the same time.
  • Reliability is more of a issue because network connections are easily broken

Opening a Phidget over the network is asynchronous and pervasive, just like opening locally. This means that if a connection to the remote server cannot be established right away, it will keep trying indefinitely, and even survive the server being stopped and started, etc. Instances of the Phidget Webservice can be referred to either using hostname (IP Address) and port number, or by Server ID. The advantage of using a Server ID is that it stays consistent compared to IP addresses, and you don’t need to know the Port number. A Webservice Server ID is assigned when the Webservice is run - which on the PhidgetSBC defaults to ‘phidgetsbc’. In order to use a Server ID, the Bonjour utility also needs to be installed. Refer to the Programming Manual and the API manual for your language for more information about using the Phidget Webservice.

Reliability

Determining reliability needs can become important while opening Phidgets over the network, because the network connection can potentially be interrupted at any time. This can leave the network attached Phidget in an undesirable state. For example - if a motor controller is driving a motor and the connection is lost, there is no way to stop the motor until the connection is re-established. These issues are less important if you are just receiving sensor data from an Interface Kit.

It’s generally a good idea to catch server connect and disconnect and Phidget attach and detach events in order to know the state of the connections. It’s also a good idea to catch error events - this is where network errors will be reported. If reliability is important, you should consider writing a program to run locally on the PhidgetSBC, and communicate with it through the Dictionary interface. This way, if the connection is broken, the local application will notice and be able to take any appropriate actions. See the advanced chapter for more information.

Finding Phidgets on the Network

Any Phidgets attached to the PhidgetSBC can be identified using the Status >> Phidgets page in the configuration interface, and should be seen on the network through the Webservice. The Phidget Control Panel has a Bonjour tab (under WebService >> Bonjour) that lists all detected network attached Phidgets. The Phidgets connected to the PhidgetSBC should be seen here and can be opened by double clicking its name in the menu. Network attached Phidgets can also be located programmatically with the Phidget Manager. The Phidget Manager is used with either hostname and port, or server ID, just like with ‘Open’. The manager can also be used to find all Phidgets on any Webservice through Bonjour, by specifying a NULL Server ID. See your specific language’s guide for more information about coding with the Phidget Manager.