What is a Phidget?: Difference between revisions

From Phidgets Support
No edit summary
 
(58 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[[Category:Overview]]
[[Category:Overview]]
<font size="+1"><b>Phidgets</b></font> are <font size="+1" color="#336633">building-block tools</font> for <font size="+1" color="#772222">sensing and control</font> from a <font size="+1" color="#222299">computer, tablet, or smartphone</font>.
__NOTOC__
At Phidgets, our philosophy is that you don't have to be an electrical engineer in order to create sophisticated projects using motors, sensors and other electronics. You simply need to know how to code.


<div style="background-color: #f9f9f9; border-color: #1c9edb; border-width:1px; border-style: dashed; padding:15px;">


In the programming language of your choice, you create applications that use Phidgets to interact with the physical world.
Phidgets are building-blocks for sensing and control using a computer, tablet, or phone. Phidgets enable your software application to interact with the physical world.


Phidgets connect to a USB port of a computer:
[[File:HUB0000 with LED Image.jpg|link=|250px]]  [[File:RFID Image.jpg|link=|250px]]  [[File:STC1000 with Motor Image.jpg|link=|300px]]


[[Image:wiap-image1.png|border|500px|link=|alt=]]
[[File:NoBreadboard.jpg|right|link=|180px]]


</div>


The advantage of using Phidgets is that all Phidgets can be plugged in and used in your project out of the box, without having to follow complex pinout diagrams or configure communication between the device and computer. With Phidgets, we deal with the details of getting the electronics behaving as they should, so you can focus on the programming and details of your final product.
<br clear="all">
==Hardware Introduction==


<div style="background-color: #f9f9f9; border-color: #1c9edb; border-width:1px; border-style: dashed; padding:15px;">
Phidgets connect via a USB port:
[[Image:wiap-image1.jpg|500px|link=|alt=|center]]


Some Phidgets are a ''complete, self-contained sensing package''. 


One example is our '''Spatial''', which measures motion:
----


[[Image:wiap-image2-spatial.png|border|450px|link=|alt=]]
Some Phidgets are a complete, self-contained sensing package. An example is the [{{SERVER}}/products.php?product_id=1042 1042]
, which measures motion:
[[Image:wiap-image2-spatial.jpg|500px|link=|alt=|center]]


Or, a Phidget may be a ''building block to use other sensors''. 


One example is our '''Temperature Sensor''', which allows use of wire thermocouples:
----


[[Image:wiap-image2-temp.png|border|500px|link=|alt=]]
Other Phidgets are a 'building block' to use other sensors. An example is the [{{SERVER}}/products.php?product_id=1048 1048] which allows the use of wire thermocouples:
[[Image:wiap-image2-temp.jpg|700px|link=|alt=|center]]


Or, a Phidget may be a flexible ''I/O (input/output) board'' which can record and control analog sensors and digital inputs and outputs. 


One example is our '''Interface Kit''' 8/8/8, with eight ports of each type:
----


[[Image:wiap-image2-ifkt.png|border|500px|link=|alt=]]


Last but not least, a Phidget may be a [[What_is_VINT?|VINT Hub]], whose versatile ports can be used as inputs or outputs, and can also connect to smart [[What_is_VINT?|VINT]] devices.
Finally, a Phidget may be a [{{SERVER}}/?view=comparetable&rel=VINTHub VINT Hub], made up of versatile ports that can be used as inputs or outputs, and also connect to smart [[What_is_VINT?|VINT]] devices.
[[Image:wiap-vint.jpg|700px|link=|alt=|center]]


[[Image:wiap-vint.png|border|500px|link=|alt=]]
==Programming==


Other Phidgets are our:
For the most part, using Phidgets requires writing software. The '''Phidgets API''' is available in many different programming languages:
* [{{SERVER}}/products.php?category=1 Analog sensors], which plug into our I/O boards,
* VINT Devices
* Motors, switches, LEDs, and other components,
* [{{SERVER}}/products.php?category=21 Single Board Computer] - a complete embedded computer, plus Phidget I/O.


</div>
{{Programming Languages Table}}
 
 
<div style="background-color: #f9f9f9; border-color: #1c9edb; border-width:1px; border-style: dashed; padding:15px;">
 
Data and control flows up and down the USB connection:
 
[[Image:wiap-image3.png|border|600px|link=|alt=]][[Image:wiap-vintFlow.png|border|600px|link=|alt=]]
 
You can use ''more than one Phidget at a time'' to control motors, measure motion, and much, much more.  You can also use multiple sensors, inputs, and outputs on our I/O boards. 
 
Combining these abilities lets you build extensive systems that can sense the environment and react to it.
 
</div>
 
 
<div style="background-color: #f9f9f9; border-color: #1c9edb; border-width:1px; border-style: dashed; padding:15px;">
 
Using Phidgets means writing code.  Within your code, you can create a software object to access our full Phidget library API to access each type of Phidget and use its functions.
 
The software object sends and receives data to and from the Phidget:
 
[[Image:wiap-image4.png|border|500px|link=|alt=]]
 
The software object might be a {{Code|VoltageInput()}} for the sensors attached to an Interface Kit, or a {{Code|RFID()}} for an RFID reader, for example.
 
</div>
 
 
<div style="background-color: #f9f9f9; border-color: #1c9edb; border-width:1px; border-style: dashed; padding:15px;">
 
We provide support for many different languages to program in:
 
{| style="border:1px solid darkgray;" cellpadding="5px;"
|-style="background: #f0f0f0" align=center
|-
 
|'''Core Languages''' || |'''Mobile Languages''' || |'''Other Languages'''
|-
|[[Image:Icon-CSharp.png|alt=C Sharp|24x24px|link=Language - C Sharp]] [[Language - C Sharp|C#]] || [[Image:Icon-Android.png|alt=Android Java|24x24px|link=Language - Android Java]] [[Language - Android Java|Android Java]] || [[Image:Icon-LabVIEW.png|alt=LabVIEW|24x24px|link=Language - LabVIEW]] [[Language - LabVIEW|LabVIEW]]
|-
|[[Image:Icon-C++.png|alt=C/C++|24x24px|link=Language - C/C++]] [[Language - C/C++|C/C++]] || |[[Image:Icon-iOS.png|alt=iOS|24x24px|link=Language - iOS]] [[Language - iOS|iOS]] || |[[Image:Icon-MaxMSP.png|24x24px|alt=Max/MSP|link=Language - Max/MSP]] [[Language - Max/MSP|Max/MSP]]
|-
|[[Image:Icon-Python.png|alt=Python|24x24px|link=Language - Python]] [[Language - Python|Python]]
|-
|[[Image:Icon-Java.png|alt=Java|24x24px|link=Language - Java]] [[Language - Java|Java]]
|-
|[[Image:Icon-Visual Basic Net.png|alt=Visual Basic .NET|24x24px|link=Language - Visual Basic .NET]] [[Language - Visual Basic .NET|Visual Basic .NET]]
|-
|[[Image:Icon-Cocoa.png|alt=Cocoa|24x24px|link=Language - Cocoa]] [[Language - Cocoa|Cocoa]]
|-
|}
 
You can visit the [[Software Overview]] page for more information on the supported programming languages.
 
 
Writing code for your Phidget can be as simple as creating a handle, opening it, getting a sensor value, and printing it.
 
A simple, stripped-down program in C to read the the value of a sensor connected to an Interface Kit might look like this:
 
<div class="source">
<syntaxhighlight lang=cpp>
#include <stdio.h>
#include <phidget22.h>
 
int main(int argc, char* argv[]) {
    // A "VoltageInput" Phidget Handle; the name we use to access properties and methods of the Phidget
    PhidgetVoltageInputHandle voltageInput;
 
    // Our Sensor Reading
    int sensorValue;
 
    // Create a new VoltageInput object
    PhidgetVoltageInput_create(&voltageInput);
   
    // Set the channel to the port the sensor is plugged into on the InterfaceKit
    Phidget_setChannel((PhidgetHandle)voltageInput, 0);
 
    // Open and attach the Phidget
    Phidget_openWaitForAttachment((PhidgetHandle)voltageInput, 5000);
 
    // Read Sensor on Port 0
    PhidgetVoltageInput_getvoltage(voltageInput, &sensorValue);
 
    printf("Hello World!  My Port 0 sensor reads %d.\n", sensorValue);
 
    // Close and clean up
    Phidget_close((PhidgetHandle)voltageInput);
    PhidgetVoltageInput_delete(&voltageInput);
    return 0;
}
</syntaxhighlight>
</div>
 
 
The Phidget library includes powerful logging and error checking not shown in this brief program. To see some full-featured example programs, check the [[Software_Overview#Language_Support|downloads section]] for the language of your choice.
 
</div>
 
 
<div style="background-color: #f9f9f9; border-color: #1c9edb; border-width:1px; border-style: dashed; padding:15px;">
 
Our software libraries are modular.  A {{Code|VoltageInput}} software object, for example, has functions you can use to control and read the Voltage Input, such as setting the data interval or reading the voltage:
 
 
[[Image:voltageInput_object.jpg|border|300px|link=|alt=]]
 
 
The API for each Phidget contains multiple of these objects. For example, the [http://www.phidgets.com/products.php?product_id=1018 1018 Phidget InterfaceKit] uses five distinct objects:
 
 
[[Image:1018_objects.jpg|border|600px|link=|alt=]]
 
 
The {{Code|Phidget Common}} object contains basic functions like {{Code|open()}} and {{Code|close()}} and is used by every Phidget. It's the same no matter what Phidget you're using. The other objects will also contain largely the same functions, properties, and events across different Phidgets, although there may be minor differences which are explained in the API manual. For example, the [http://www.phidgets.com/products.php?product_id=1024 1024 PhidgetRFID Read/Write] has a {{Code|DigitalOutput}} object which is just like the one for the [http://www.phidgets.com/products.php?product_id=1018 1018 Phidget InterfaceKit]:
 
 
[[Image:1024_objects.jpg|border|400px|link=|alt=]]
 
 
</div>
 
 
<div style="background-color: #f9f9f9; border-color: #1c9edb; border-width:1px; border-style: dashed; padding:15px;">
 
Not only can you control a Phidget locally, but we also provide a tool called the [[Phidget WebService]]. 
 
The WebService allows you to control a Phidget over your local network:
 
[[Image:webservice_general_broadcast.png|border|700px|link=|alt=]]
 
This allows your to use more than one computer, or even a smartphone:
 
[[Image:webservice_general_pctoandroid.png|border|700px|link=|alt=]]
 
The WebService also includes the [[Phidget Dictionary]], which is a central place to store your data in a distributed application.
 
</div>
 
 
<div style="background-color: #f9f9f9; border-color: #1c9edb; border-width:1px; border-style: dashed; padding:15px;">
 
Your Phidgets program can run under any of the major operating systems. With the WebService, you can even use operating systems that don't normally have USB ports, such as Android and IOS:


The Phidget software libraries are supported on a number of operating systems:
{| style="border:1px solid darkgray;" cellpadding="7px;"
{| style="border:1px solid darkgray;" cellpadding="7px;"
|-style="background: #f0f0f0" align=center  
|-style="background: #f0f0f0" align=center  
Line 193: Line 51:
|'''Desktop OSes''' || |'''Mobile/Wireless OSes'''
|'''Desktop OSes''' || |'''Mobile/Wireless OSes'''
|-
|-
|[[Image:Icon-Windows.png|alt=OS - Windows|24x24px|link=OS - Windows]][[OS - Windows|Windows]] || |[[Image:Icon-Linux.png|alt=OS - Phidget SBC|24x24px|link=OS - Phidget SBC]][[OS - Phidget SBC|Phidget SBC]]
|[[Image:Icon-Windows.png|alt=OS - Windows|24x24px|link=OS - Windows]][[OS - Windows|Windows]] || |[[Image:Icon-Phidgets.png|alt=OS - Phidget SBC|24x24px|link=OS_-_Phidget_SBC]][[OS_-_Phidget_SBC|Phidget SBC]]
|-
|[[Image:Icon-Mac-OS.png|alt=OS - OS X|24x24px|link=OS - OS X]][[OS - OS X|OS X]] || [[Image:Icon-Android.png|alt=OS - Android|link=OS - Android|24x24px|link=OS - Android]][[OS - Android|Android]]
|-
|-
|[[Image:Icon-Linux.png|alt=OS - Linux|24x24px|link=OS - Linux]][[OS - Linux|Linux]] || [[Image:Icon-iOS.png|alt=OS - iOS|link=OS - iOS|24x24px|link=OS - iOS]][[OS - iOS|iOS]]   
|[[Image:Icon-Linux.png|alt=OS - Linux|24x24px|link=OS - Linux]][[OS - Linux|Linux]] || [[Image:Icon-iOS.png|alt=OS - iOS|link=OS - iOS|24x24px|link=OS - iOS]][[OS - iOS|iOS]]   
|-
|-
|[[Image:Icon-Mac-OS.png|alt=OS - OS X|24x24px|link=OS - OS X]][[OS - OS X|OS X]] || [[Image:Icon-Android.png|alt=OS - Android|link=OS - Android|24x24px|link=OS - Android]][[OS - Android|Android]]
|}
|}


With the WebService, you can even mix and match multiple operating systems to control one Phidget. For example, you could connect your Phidgets to a PhidgetSBC running Linux, and control it over the WebService using an Android tablet.
== Network Server ==
 
</div>
 
 
<div style="background-color: #f9f9f9; border-color: #1c9edb; border-width:1px; border-style: dashed; padding:15px;">
 
The Phidget Library gives the option of using software events, rather than just reading values.
 
With events, you can let the data come to you as it changes:


[[Image:wiap-image7.png|border|650px|link=|alt=]]
Using the Phidgets API, applications on remote computers, phones, and [[OS_-_Phidget_SBC|Single Board Computers]] can attach to Phidget devices over the network as if they were local.  This includes WWW based applications using the Phidget JavaScript library.
 
[[Image:NetworkServer_PhidgetServer.jpg|link=|800px|center]]
This allows clean integration with GUI programs, which are usually already event-driven.
 
</div>
 
 
<div style="background-color: #f9f9f9; border-color: #1c9edb; border-width:1px; border-style: dashed; padding:15px;">
 
The library also includes support for using (and distinguishing between) more than one Phidget in your code - even the same type of Phidget.
 
This is usually done by reference to the unique serial number of each Phidget, as here in a Python code example:
 
[[Image:wiap-image8.png|border|650px|link=|alt=]]
 
There are other ways to do this, such as setting your own labels, or using our [[Phidget Manager]] to detect attached Phidgets.
 
</div>
 
 
<div style="background-color: #f9f9f9; border-color: #1c9edb; border-width:1px; border-style: dashed; padding:15px;">


== Further Reading ==
With the combination of events, modular sensors, and network support, your system can range from simple to incredibly complex.
With the combination of events, modular sensors, and network support, your system can range from simple to incredibly complex.


We encourage customers to not only build projects for themselves, but also to design and build real-world products using Phidgets.  Our libraries can be distributed with your code to your customers.
We encourage customers to not only build projects for themselves, but also to design and build real-world products using Phidgets.  Our libraries can be distributed with your code to your customers.
And this can all occur with the same devices, and the same flexible software API.


Want to learn more?  Check out our:
Want to learn more?  Check out our:
* [{{SERVER}} Products on our main website]
* [{{SERVER}} Products on our main website]
* [[Software Overview | Languages and Operating Systems]]
* [[Phidget Programming Basics]]
* [{{SERVER}}/?view=articles Example Projects and Articles]
* [{{SERVER}}/?view=articles Example Projects and Articles]
* [[:Category:Primer|In-depth hardware information]]


Questions?  Please {{ContactUs|contact us}}.
Questions?  Please {{ContactUs|contact us}}.
</div>

Latest revision as of 14:50, 26 June 2019


At Phidgets, our philosophy is that you don't have to be an electrical engineer in order to create sophisticated projects using motors, sensors and other electronics. You simply need to know how to code.


Phidgets are building-blocks for sensing and control using a computer, tablet, or phone. Phidgets enable your software application to interact with the physical world.

HUB0000 with LED Image.jpg RFID Image.jpg STC1000 with Motor Image.jpg

NoBreadboard.jpg


The advantage of using Phidgets is that all Phidgets can be plugged in and used in your project out of the box, without having to follow complex pinout diagrams or configure communication between the device and computer. With Phidgets, we deal with the details of getting the electronics behaving as they should, so you can focus on the programming and details of your final product.

Hardware Introduction

Phidgets connect via a USB port:



Some Phidgets are a complete, self-contained sensing package. An example is the 1042 , which measures motion:



Other Phidgets are a 'building block' to use other sensors. An example is the 1048 which allows the use of wire thermocouples:




Finally, a Phidget may be a VINT Hub, made up of versatile ports that can be used as inputs or outputs, and also connect to smart VINT devices.

Programming

For the most part, using Phidgets requires writing software. The Phidgets API is available in many different programming languages:

Core Languages Mobile Languages Other Languages
C Sharp C# Objective C Objective C LabVIEW LabVIEW
C/C++ C/C++ Swift Swift Max/MSP Max/MSP
Python Python Android Android Java
Java Java
Visual Basic .NET Visual Basic .NET
JavaScript JavaScript

The Phidget software libraries are supported on a number of operating systems:

Desktop OSes Mobile/Wireless OSes
OS - WindowsWindows OS - Phidget SBCPhidget SBC
OS - LinuxLinux OS - iOSiOS
OS - OS XOS X OS - AndroidAndroid

Network Server

Using the Phidgets API, applications on remote computers, phones, and Single Board Computers can attach to Phidget devices over the network as if they were local. This includes WWW based applications using the Phidget JavaScript library.

NetworkServer PhidgetServer.jpg

Further Reading

With the combination of events, modular sensors, and network support, your system can range from simple to incredibly complex.

We encourage customers to not only build projects for themselves, but also to design and build real-world products using Phidgets. Our libraries can be distributed with your code to your customers.

Want to learn more? Check out our:

Questions? Please contact us.