Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Phidget Input Parameter List

NameDescriptionHow Used?

DeviceType

Specify the type of device that requires interaction. Supported values are:

PhidgetRFID, PhidgetTextLCD, PhidgetGPS, PhidgetInterfaceKit, PhidgetAdvancedServo

DeviceType is passed as a modifier to Invoke.

<Invoke Method="Get" DeviceType="PhidgetInterfaceKit"/>

SerialNumberThis represents the interface port number to which the sensor or motor is connected.SerialNumber is passed as a modifier to Invoke
ServoAngleAngle to be applied to a Advanced Servo Motor.

ServoAngle is passed as a payload to Invoke wrapped within

Message/Value container.

<Invoke Method="Post" DeviceType="PhidgetTextLCD">

<Message><Value><ServoAngle>110.0</ServoAngle></Value></Message>

</Invoke>

SimulatedSimulates Sensor Behavior by sending random integer values between 1 and 100 
-

Some time if you need to pass a String value to the handler as input - usually in case of RFID Writer

or LCD Text Display, you can pass it as part of <Message><Value>Hello</Value></Message> as payload to Invoke.

Payload of <Invoke>.

<Invoke Method="Post" DeviceType="PhidgetTextLCD">

<Message><Value>Hello</Value></Message>

 </Invoke>

 

Phidget Output Format

Output from the Phidget Handler is simply a text value.

...

Reading Data from a GPS Sensor

  • Note that GPS sensor is directly attached to the USB of controller i.e (Raspberry Pi or Laptop or VM)
  • If there are multiple GPS sensors you plan to attach you can use SerialNumber create a unique protocol string i.e. phid://1 etc
Code Block
languagexml
titlePhidget Handler Thing Facet to Read GPS Sensor
linenumberstrue
<ThingFacet Name="PhidgetSimulatedFacetGPSPhidgetSensorFacet">
  <Integer	<String Name="SimulatedValueGPSOutput" Updateupdate="auto" KnownBy="PhidgetSimActionGPSPhidgetSensorAction" />
    <String Name="DeviceTypeSerialNumber" />
  	<String Name="SerialNumberDeviceType" />
  	<Action Name="PhidgetSimActionGPSPhidgetSensorAction" Documentation="ReturnsConnect integerto values from 1 - 100 in Random orderGPS sensor">
    	<Workflow Limit="1" Live="1" Timeout="-1">
      		<Task Namename="Main" Whilewhile="Truetrue">
        				<Event Namename="Argument" Asas="ActionArgument" />
        				<Invoke Namename="ReadValue" waitFor="Argument" Get
                       Post="phid://[%:Event.Argument.SerialNumber.Value:%]" SerialNumber="[%:Event.Argument.SerialNumber.Value:%]"
						DeviceType="[%:Event.Argument.DeviceType.Value:%]" Simulated="true"/>
        <Output Name="Result" As="ActionResult">      <!-- Optionally parse the string <Value>if desired -->
				<Output name="Result" as="ActionResult">
       <SimulatedValue>					<Value>
						<GPSOutput>[%:[%:@Output:%]Invoke.ReadValue.Message.Value:%]</SimulatedValue>
          GPSOutput>
					</Value>
        				</Output>
      			</Task>
    		</Workflow>
  	</Action>
</ThingFacet>

Controlling Servo Motor AngleDisplay Text on LCD Screen.

Code Block
languagexml
titlePhidget Handler Thing Facet to control Servo Motordisplay text on LCD Screen
linenumberstrue
<ThingFacet Name="PhidgetSimulatedFacetPhidgetTextLCDFacet">
  <Integer	<String Name="SimulatedValueDisplayString" UpdateKnownBy="autoLCDDisplayAction" KnownByDocumentation="PhidgetSimAction"/>This is a <Stringruntime Name=parameter"DeviceType" />
  	<String Name="SerialNumberDeviceType" />
  	<Action Name="PhidgetSimActionLCDDisplayAction"
		Documentation="ReturnsDisplay integerthe valuesstring fromto 1Phidget - 100 in Random orderText LCD">
    		<Workflow Limit="1" Live="1" Timeout="-1">
      			<Task Namename="Main" Whilewhile="Truetrue">
        				<Event Namename="ArgumentActionArgument" Asas="ActionArgument" />
				<Log Message="******Invoking Phidget Text     LCD"/>
				<Invoke Namename="ReadValueWriteToLCD" waitFor="ArgumentActionArgument"
Get="phid://" SerialNumber					Post="[%:Event.Argument.SensorURL.Value:%]" 
					DeviceType="[%:Event.Argument.SerialNumberDeviceType.Value:%]">
				 <Message Type="text" DeviceTypeValue="[%:Event.Argument.DeviceTypeDisplayString.Value:%]" Simulated="true />
				 </Invoke>
				<Log Message="Invoked Phidget Text LCD"/>
				<Output name="Result" as="ActionResult">
					<Value>
						<DisplayString>[%:[%:@Output:%]Invoke.WriteToLCD.Message.Value:%]</DisplayString>
					</Value>
				</Output>
 <Output Name="Result" As="ActionResult">
          <Value>
			</Task>
		</Workflow>
	</Action>
</ThingFacet>
<!-- Combine with Model -->
<ThingModel Name="PhidgetLCDScreenModel" Combines="PhidgetTextLCDFacet">
   <Sid Name="LCDScreenID"/>
</ThingModel>
<!-- Write Text for first time -->
<Query>
  <Save format="version,current">
    <PhidgetLCDScreenModel>
      <SimulatedValue>[%:[%:@Output:%]Invoke.ReadValue.Message.Value:%]</SimulatedValue><SensorName>Rotation</SensorName>
      <DeviceType>PhidgetTextLCD</DeviceType>
      <DisplayString>Hello TQL!</Value>DisplayString>
    </PhidgetLCDScreenModel>
  </Save>
</Output>
      </Task>
    </Workflow>
  </Action>
</ThingFacet>Query>
<!-- Subsequent Writes can happen via Update Query -->
<Query>
 <Find format="version"> 
		<PhidgetLCDScreenModel>
			<LCDScreenID ne=""/>
		</PhidgetLCDScreenModel>
	</Find>
	<SetResponseData> 
		<key>Message.Value.Find.Result.PhidgetLCDScreenModel.DisplayString.Value</key>
		<value>Hello Again!!</value>
	</SetResponseData>
	<Update> 
		<from>Result</from>
		<Include>$Response.Message.Value.Find</Include>
	</Update>
</Query>
 

Driver Installation Steps

...

Code Block
languagetext
themeEclipse
titleCommand to install USB Lib
linenumberstrue
sudo apt-get install libusb-1.0-0-dev
  • Download Phidget Libraries from this location 
Code Block
languagetext
titleDownload Link
linenumberstrue
http://www.phidgets.com/downloads/libraries/libphidget.tar.gz
  • Unpack the downloaded libraries using the command
Code Block
languagetext
titleUnpack command
linenumberstrue
tar -xzvf libphidget_2.X.X.XXXXXXXX.tar.gz
  • Then run the following commands to install Phidget libraries
Code Block
languagetext
titleUnpack command
linenumberstrue
cd libphidget-2.X.X.XXXXXXXX/
sudo ./configure
sudo make
sudo make install

Note: - For additional information and troubleshooting visit the following website                                    website (http://www.phidgets.com/docs/OS_-_Linux)