Using the Phidget extension

To use Phidgets in your mixes, you have to define them as a service in your mix. The properties are the same for all phidgets but the attributes and attribute values differ per type.

Prerequisites

  • Make sure you have installed the Phidgets drivers and libraries on your computer.
  • Make sure you have the Phidget extension in your distro.
  • Make sure the Phidget extension is running on the node(s) you connect the Phidgets to.
    Note: This extension, like any other SPARKL extension, can be stopped and started per node in the Node Elements view of the Developer Console.

Markup

<!-- PhidgetInterfaceKit -->
  <service name="Rotary" 
    provision="phidget">
    <prop name="phidget.spec" 
      kind="PhidgetInterfaceKit" 
      domains="domain.local"/>
    <prop name="phidget.params" 
      sensor0="position"/>
   </service>

<!-- PhidgetAdvancedServo -->
   <service name="Servo" 
     provision="phidget">
     <prop name="phidget.spec" 
       kind="PhidgetAdvancedServo" 
       domains="domain.local"/>
     <prop name="phidget.params" 
       position0="position"/>
   </service>

<!-- PhidgetRFID -->
  <service name="myService" 
    provision="phidget">
    <prop name="phidget.spec" 
      kind="PhidgetRFID" 
      domains="domain.local"/>
    <prop name="phidget.params" 
      rfid="employee_ID"/>
  </service>

PhidgetInterfaceKit

Table 1. PhidgetInterfaceKit properties
Property Description
phidget.spec The property used by svc_phidget to find the phidgets.

It uses the following attributes to find phidgets:

kind
The type of the phidget. For example, PhidgetInterfaceKit.
domains
These are the domains in which svc_phidget looks for the phidget.
Name any domain specified for svc_phidget in sys.config.
Note: If more than one phidgets of the same kind are connected, specify a different domain for the similar phidgets.
phidget.params The property used to parameterise fields existing on a mix and map them to phidget-specific interfaces. The parameters possible are different for each kind of phidget.

A PhidgetInterfaceKit service can have one or more of the following parameters, based on the number and type of sensors or devices attached to the interface.

sensor0 - sensorN
Maps a field of type integer to a sensor slot.
input0 - inputN
Maps a field of type boolean to an input slot.
output0 - outputN
Maps a field of type boolean to an output slot.

PhidgetAdvancedServo

Table 2. PhidgetAdvancedServo properties
Property Description
phidget.spec The property used by svc_phidget to find the phidgets.

It uses the following attributes to find phidgets:

kind
The type of the phidget. For example, PhidgetInterfaceKit.
domains
These are the domains in which svc_phidget looks for the phidget.
Name any domain specified for svc_phidget in sys.config.
Note: If more than one phidgets of the same kind are connected, specify a different domain for the similar phidgets.
phidget.params The property used to parameterise fields existing on a mix and map them to phidget-specific interfaces. The parameters possible are different for each kind of phidget.

A PhidgetAdvancedServo service can have one or more of the following parameters, based on the number of motors connected to the motor controller.

position0 - positionN
Maps a field of type integer to a motor connection slot.

PhidgetRFID

Table 3. PhidgetRFID properties
Property Description
phidget.spec The property used by svc_phidget to find the phidgets.

It uses the following attributes to find phidgets:

kind
The type of the phidget. For example, PhidgetInterfaceKit.
domains
These are the domains in which svc_phidget looks for the phidget.
Name any domain specified for svc_phidget in sys.config.
Note: If more than one phidgets of the same kind are connected, specify a different domain for the similar phidgets.
phidget.params The property used to parameterise fields existing on a mix and map them to phidget-specific interfaces. The parameters possible are different for each kind of phidget.

A PhidgetRFID service can have one or more of the following parameters.

rfid
Maps a field of type string to the stored RFID string.
output0 - output1
Maps a field of type boolean to an output slot.
led
Maps a field of type boolean to the PhidgetRFID's LED output.